Guide · Selling

Main home reinvestment exemption in Spain

A Spanish resident who reinvests a main home sale in a new one within two years can exclude the gain (art. 38 Ley 35/2006). Conditions and who is left out.

In short

If you sell your main home (vivienda habitual) in Spain and put the whole amount received into a new main home, the gain is excluded from income tax (art. 38 of Ley 35/2006). The reinvestment must be made within two years of the sale, and a home counts as a main home only after three years of continuous residence, with exceptions. If you reinvest only part, only a proportional part of the gain is excluded. This is a national rule. A non-resident can claim it only when resident in the EU or EEA, so not from the UK, Canada or the US.

The rule

Article 38.1 lets gains from selling the taxpayer’s main home be left out of tax “siempre que el importe total obtenido por la transmisión se reinvierta en la adquisición de una nueva vivienda habitual”. When the amount reinvested is lower than the amount received, only the proportional share of the gain is excluded. The conditions are set by the income tax regulation (Real Decreto 439/2007), article 41.

The conditions in the regulation

What counts as “the total amount obtained”. If you used a loan to buy the home you are selling, the amount obtained is the transfer value minus the principal still unpaid on the date of sale (art. 41.1). Only that net amount has to be reinvested.

What counts as buying. Rehabilitating a home is treated as buying one, if the works are subsidised under the housing plan named in the regulation or are a structural reconstruction costing more than 25% of the purchase price (art. 41.1.a-b).

The time limit. The reinvestment, made “de una sola vez o sucesivamente”, must happen within two years from the sale (art. 41.3). Money used to pay for a new main home bought in the two years before the sale also counts. If the reinvestment is not made in the year of the sale, you must state your intention in the return for the year in which the gain arises.

Partial reinvestment. Only the proportional part of the gain linked to the sum actually invested is excluded (art. 41.4).

Failure. If any condition is not met, the relevant part of the gain becomes taxable. You file a complementary self-assessment for the year of the sale, with late-payment interest (art. 41.5).

Calculation, not a quote. Assume a sale at €300,000 with a taxable gain of €100,000, and no loan on the home. You buy a new main home for €240,000. The reinvested share is 240,000/300,000 = 80%, so €80,000 of the gain is excluded and €20,000 remains taxable, at the savings scale in capital gains tax on a home sale. If €100,000 of the old loan was still outstanding, the amount to reinvest would be €200,000, and a €240,000 purchase would cover it in full.

What is a main home

Article 41 bis gives the definition, used also for the over-65 exemption.

  • A main home is the building that is your residence for a continuous period of at least three years (art. 41 bis.1).
  • It is accepted as a main home even before three years where you die or circumstances require a move, such as marriage, separation, a job transfer, a first job, a change of job or other justified analogous cases.
  • You must actually and permanently live in it within twelve months of acquisition or completion of works (art. 41 bis.2). Where you do, the three years run from that date.
  • For the exemptions, the home you sell must be your main home at the time of the sale or have been so on any day in the two years before the sale (art. 41 bis.3).

Changes in force since 8 October 2026, subject to validation by Congress. Real Decreto-ley 29/2026 (disposición final tercera) adds two points to article 41 bis.3. For a seller over 65 or in a situation of severe dependency, the main-home test runs up to the moment of moving to a specialised centre or to the home of a relative up to the third degree. And where a separation, divorce or annulment ends a spouse’s occupation, the occupancy requirement is met if it is met by the spouse who stayed. A decree-law lapses unless Congress validates it, and the previous version of these changes was repealed on 2 October 2026. Do not rely on these two points until validation.

Non-residents

The exemption in article 38 belongs to the personal income tax. For non-residents, the IRNR law has a separate rule (disposición adicional séptima): the gain is excluded for taxpayers resident in an EU member state, and in an EEA state that exchanges tax information effectively, who sell what was their main home in Spain and reinvest. The 3% withholding on the sale still applies, and the reinvestment can be taken into account in computing the tax if made before the filing deadline. A resident of the UK, Canada or the US does not qualify under the text read. See selling a home in Spain: costs for the withholding.

What it does not cover

It does not cover the municipal tax: the plusvalía municipal is owed regardless. It does not apply to a second home or a rental flat, which was never a main home. For sellers over 65 there is a separate route, in the over-65 exemption.

Which professional to consult

A tax adviser or a lawyer registered with a Spanish bar association (colegio de abogados) can check the three-year test and document the reinvestment: property lawyer. Keep proof of where you lived for the relevant years, together with the deed and the payment trail of the new purchase.

Frequently asked questions

Do I have to buy a more expensive home?

No. Only the amount you reinvest counts. If you reinvest less than the amount received, only a proportional part of the gain is excluded.

Can I buy the new home before selling the old one?

Yes, if the new main home was bought in the two years before the sale and the sale proceeds pay its price (art. 41.3).

Does a holiday home qualify?

Not as the home sold. A main home needs three years of continuous residence unless an exception applies.

I live in the UK. Can I use it?

Not under the text read: the non-resident version is limited to residents of the EU and certain EEA states.

What if I cannot reinvest in time?

The gain becomes taxable and you file a complementary self-assessment with interest (art. 41.5).

More guides on selling

Sources

All guides · Payotte Spain