Selling Your US Home After Moving to Spain: Section 121 and IRPF
Published Last verified
In this article
- Does Spain get to tax a house that sits in the United States?
- The two clocks, side by side
- The Section 121 exclusion and its 5-year window
- The 3.8 percent surtax and what the exclusion shields
- The Spanish side: savings base, exemptions, and the credit
- The reinvestment exemption
- Over 65: the exemption without reinvestment
- The state layer
- A home you rented out after the move
- Put the three dates on one line before you list the house
- FAQ
Selling your U.S. home after moving to Spain sounds like a U.S. tax question, and half of it is: whether the Section 121 exclusion still covers the gain, and whether the 3.8 percent surtax reaches the rest. The other half is Spanish. Once you are a Spanish tax resident, Spain taxes your worldwide gains, house included, while the treaty lets the United States tax it too, and Spain credits the U.S. tax. Three dates decide the bill: the day you moved out, the day you pass 183 days in Spain, and the closing. This article is for informational purposes only and is not immigration, tax or medical advice; verify current requirements with the relevant Spanish authority or a licensed professional.
Does Spain get to tax a house that sits in the United States?
Yes, once you are resident. The Agencia Tributaria treats you as a Spanish tax resident for any calendar year in which you spend more than 183 days in Spain, and a resident is taxed on gains wherever the asset sits. There is no partial year: exceed 183 days in the year you arrive and you are resident for that whole year, sale in February included.
The U.S.-Spain income tax convention keeps the United States in the picture. Its capital gains article states that gains from the alienation of real property situated in the other contracting state may be taxed in that other state, so a house in Texas stays taxable in the United States whatever your residence, and the treaty’s saving clause lets the United States tax its citizens as if the treaty did not exist. Spain, as the country of residence, is the one that gives relief: the Agencia Tributaria’s deduction for international double taxation takes the lesser of the tax actually paid abroad on the gain and the Spanish tax that corresponds to it.
The consequence is easy to state and easy to miss. A sale that produces no U.S. tax because the exclusion absorbs the gain produces no U.S. credit either, so the Spanish tax on that same gain is paid in full unless a Spanish exemption applies. Sell before Spanish residency begins and the Spanish side never opens.
The two clocks, side by side
The U.S. clock runs from the day you stop living in the home, because the use test looks at the five years before the sale. The Spanish clock runs from the calendar year in which you pass 183 days. The table reads down from the sale date.
| When the sale closes | IRS | Spain |
|---|---|---|
| Before the move, while the home is still your main home | Exclusion of up to $250,000, or $500,000 on a joint return, if you owned and used it 2 of the last 5 years | Nothing: you are not a Spanish resident |
| In the calendar year of arrival, staying more than 183 days | Same exclusion, same tests | Resident for the whole year: the gain is taxable, with a deduction for U.S. tax paid; the reinvestment exemption can apply if the home was your habitual residence within the 2 years before the sale and the proceeds buy a habitual residence within 2 years |
| Within 2 years of moving out, in a later year | Same exclusion, same tests | Same as above: the 2-year window for a former habitual residence is still open |
| Between 2 and 3 years after moving out | Exclusion still available while 24 months of use fall inside the last 5 years | No reinvestment exemption and no over-65 exemption: the home is no longer a habitual residence, so the full gain is taxed at 19 to 30 percent, less the U.S. tax credited |
| More than 3 years after moving out | Exclusion generally lost; the gain is taxed and the 3.8 percent surtax can apply above the income thresholds | Full gain taxed, less the U.S. tax credited |
The Section 121 exclusion and its 5-year window
The IRS lets you exclude up to $250,000 of gain from the sale of your main home, or up to $500,000 if you file a joint return with your spouse, provided you meet both an ownership test and a use test. You meet the ownership test if you or your spouse owned the home for at least 24 months of the 5 years ending on the date of the sale, and the use test if you lived in it as your residence for at least 24 months of those same 5 years. The two 24-month periods need not coincide, but both must fall inside the 5 years before the sale.
That is the clock. A person who moves to Spain on May 5, 2026 and had lived in the home for years keeps meeting the use test as long as 24 months of residence sit inside the 5 years before the sale, which is roughly until May 2029. After that the exclusion is generally gone, and Topic 701 refers to Publication 523 for the exceptions to the two-year rule and for the situations that suspend the 5-year period.
On a joint return, either spouse may meet the ownership test but both must meet the use test individually, and the IRS states that you are generally not eligible if you excluded the gain from another home during the two years before the sale. Reporting is not optional when the sale is documented: if you receive Form 1099-S, Proceeds From Real Estate Transactions, you must report the sale even if all the gain is excludable, and you must report it in any case if you cannot exclude all of the gain, on Schedule D and Form 8949.
The 3.8 percent surtax and what the exclusion shields
Gain above the exclusion is investment income. The IRS applies a 3.8 percent net investment income tax to the lesser of your net investment income and the amount by which your modified adjusted gross income exceeds $200,000 for a single filer or head of household, $250,000 for a couple filing jointly, and $125,000 for a married person filing separately. The IRS states that net investment income does not include gain on the sale of a personal residence that is excluded from gross income, so the exclusion shields what it covers and nothing more. The tax is figured on Form 8960.
Two figures move the result for a seller living in Spain. The gain itself is added to income in the year of sale, which is often the year that pushes a household past the threshold. And whether the foreign earned income exclusion changes modified adjusted gross income for this tax is a question for the Form 8960 instructions, a point to check with whoever prepares the return before assuming a Spanish salary keeps you under the line.
The Spanish side: savings base, exemptions, and the credit
A resident’s gain on real estate goes into the savings base of the IRPF. For 2025 the state scale and the regional scale published by the Agencia Tributaria each run from 9.5 percent to 15 percent across five brackets, and they are applied together: 19 percent on the first 6,000 euros, 21 percent to 50,000 euros, 23 percent to 200,000 euros, 27 percent to 300,000 euros and 30 percent above that. A $400,000 gain on a house is not taxed at 30 percent; it climbs through the brackets, and the credit for the U.S. tax comes off the result.
The gain is computed in euros on the Spanish return, so the exchange rates behind a purchase price paid in dollars years ago and a sale price received in dollars now change the figure, in either direction. That conversion is a calculation to hand to the adviser with the closing statements, not one to estimate.
The reinvestment exemption
The Agencia Tributaria exempts the gain on the sale of your habitual residence when the full amount obtained is reinvested in buying another habitual residence, or in rehabilitating the one that will be. Four conditions carry the weight. The exemption is not automatic: you have to state on the return that you are claiming it. Both the home sold and the home bought must qualify as habitual residences. The reinvestment must happen within two years, counted date to date, and the two years can run before the sale as well as after it. And if you reinvest less than the full amount obtained, only the proportional part of the gain is exempt.
What makes a home habitual is defined in the same terms for the over-65 exemption: a building in which you live for a continuous period of at least three years, counted from the day you moved in, provided you moved in within twelve months of acquiring it. A shorter period still qualifies when circumstances that necessarily require a change of address arrive first, and the Agencia Tributaria’s own examples include a job transfer, a first job or a change of job, marriage and separation. And a home counts as your habitual residence for these exemptions if it was so at the moment of sale or at any day within the two years before it.
For an American who lived in the U.S. home for three years or more and left it for Spain, that reads as a two-year window: sell within two years of moving out, buy the Spanish home within two years of the sale, claim the exemption, and the Spanish tax on the gain disappears to the extent the proceeds go into the new home. Miss the window and the Spanish gain is taxed in full, with only the U.S. tax, if any, as a credit.
Over 65: the exemption without reinvestment
The Agencia Tributaria states that gains from the transfer of the habitual residence by a person over 65 are exempt, with no reinvestment required, and the same two-years-prior rule applies to whether the home was habitual. When ownership is split between a bare owner and a usufructuary, neither can use the exemption. For a retiree who sells the family home within two years of the move, this is the Spanish side of the calculation, and it makes the sale date a matter of months.
The state layer
A state can tax the sale too. The California Franchise Tax Board states in its residency guidelines that gain from the sale of real estate has its source where the property is located, and that a California property sold after you move out of state produces California-source income even though you are a nonresident. Other states apply their own sourcing rules, and none of them is bound by the U.S.-Spain treaty. The state side of a move is covered in breaking state tax residency before you leave.
A home you rented out after the move
Renting the house out while you decide changes both halves. On the U.S. side, Topic 701 sends rental and business use of the home to Publication 523, which is where the arithmetic on periods of use and on depreciation lives, and it is not the arithmetic of a plain sale. On the Spanish side, a resident reports the rent as income during the rental years, and the home stops being a habitual residence from the day you leave it, so the two-year window above is running whether or not a tenant is in place. Anyone considering a rental period should have both halves priced before signing the lease, because the tenant’s term and the two-year window rarely end on the same day.
Put the three dates on one line before you list the house
Write down the day you moved out, the day you will pass 183 days in Spain, and the earliest day a sale could close. If the sale closes in a calendar year you spend mostly outside Spain, the question is a U.S. one and the exclusion usually answers it. If it closes in a Spanish tax year, the two-year window from the day you moved out decides whether Spain taxes the gain or exempts it, and the pre-departure checklist in moving to Spain from the U.S. is where that date belongs.
A seller who lived in the home for years, sells before Spanish residency begins, and stays under the exclusion can generally handle the U.S. return alone with Publication 523 and Form 8949. A sale in a Spanish tax year, a gain above the exclusion, a rental period, a couple where only one spouse meets the use test, or a purchase in Spain that the reinvestment exemption depends on: those are cases for a cross-border tax professional who files in both countries, and the fee is small next to a two-year window missed by a month.
The Spain Navigator, the app that puts every step of your move to Spain in order, keeps the move-out date, the 183-day count and the visa steps in one plan, so the sale is timed against the same calendar as everything else.
FAQ
If I sell the house in the year I move, will Spain tax the gain?
It depends on the day count, not the sale date. Spain decides residency for the whole calendar year: spend more than 183 days in Spain that year and you are resident for all of it, months before your arrival included, so the gain is taxable in Spain with a deduction for the U.S. tax. In a year you are not a Spanish resident, Spain has no claim on it.
Can I use the Spanish reinvestment exemption for a house in the United States?
The rules turn on whether the home qualifies as your habitual residence, not on where it sits: three continuous years of living there, with exceptions such as a job transfer, and it still counts as habitual until any day within the two years before the sale. The proceeds then have to buy a new habitual residence within two years, and the exemption has to be claimed.
Is the $500,000 exclusion automatic for a married couple?
No. The IRS conditions it on a joint return for the year of the sale, on either spouse meeting the ownership test, on both spouses meeting the use test individually, and on neither spouse having excluded gain from another home in the two years before the sale. A couple that fails the use test for one spouse is generally back to $250,000.
Do I have to report the sale if all the gain is excluded?
Yes if you receive Form 1099-S, Proceeds From Real Estate Transactions, and yes if any part of the gain cannot be excluded. The IRS reporting goes on Form 8949 and Schedule D of Form 1040. Spain has its own line for the gain on the IRPF return, so a sale in a Spanish tax year is reported twice even when the U.S. tax is zero.
Does the exclusion protect me from the 3.8 percent surtax?
For the excluded part, yes. The IRS states that net investment income does not include gain on the sale of a personal residence that is excluded from gross income for regular income tax purposes. Gain above the exclusion counts as investment income, and the tax applies once modified adjusted gross income passes $200,000 for a single filer or $250,000 on a joint return.
I am over 65. Does Spain tax the sale of my former home?
Not if it qualifies as your habitual residence. The Agencia Tributaria exempts the gain when a person over 65 sells the habitual residence, and it treats a home as habitual if it was your habitual residence at the time of the sale or at any day within the two years before it. The three-year residence definition applies, with its exceptions for a forced change of address.
Sources
Official pages this guide was checked against, with the date we last read them.
- Topic no. 701, Sale of your home
- Net investment income tax
- Income Tax Convention with Spain, with Protocol (Article 13, Capital Gains)
- FTB Publication 1031, 2025 Guidelines for Determining Resident Status
- Contribuyentes por el IRPF (residencia habitual en territorio español), manual IRPF 2025
- Gravamen estatal de la base liquidable del ahorro, Manual práctico de Renta 2025
- Gravamen autonómico de la base liquidable del ahorro, Manual práctico de Renta 2025
- Transmisión de la vivienda habitual con reinversión
- Transmisión de la vivienda habitual por personas mayores de 65 años, Manual específico de Renta 2025
- Deducción por doble imposición internacional, Manual práctico de Renta 2025