Skip to content
Calculadora Capital

Spain's capital gains reinvestment relief

The rule everyone repeats is that you must reinvest everything you got. The regulation says otherwise.

6 min readReviewed By Thorben Rasmus IdelReviewed by Nahar Geva

TL;DR

If you sell your main home in Spain and buy another, the gain can be entirely exempt. What you must reinvest is not the sale price: article 41.1 of the regulation reduces it by the mortgage principal still outstanding on the day of the sale. The window is two years, and money paid for a home bought in the two years before also counts.

The short answer

Selling your main home in Spain produces a capital gain taxed in the savings base, at rates that today run from 19 to 30 per cent3. Article 38.1 of the income tax law allows it to be excluded from tax entirely if "the total amount obtained on the transfer is reinvested in the acquisition of a new main home"1.

The question that decides everything is what that total amount obtained is. Almost everything published answers that it is the sale price. The regulation answers something else.

What you must reinvest is not the sale price

The first paragraph of article 41.1 of the income tax regulation says it in as many words: where the taxpayer used borrowing to acquire the property being transferred, the total amount obtained is, for this purpose only, "the result of reducing the transfer value by the principal of the loan outstanding at the moment of the transfer"2.

Someone selling for 300,000 euros with 120,000 of mortgage still running does not have to reinvest 300,000. They have to reinvest 180,000. And that is not an arithmetic detail: it decides whether the relief is full or partial, and with it whether the return comes out at zero or several thousand euros of tax.

A 300,000 € sale with a 120,000 € mortgage, costs ignored to isolate the effectThe usual readingArticle 41.1
Amount you must reinvest300,000 €180,000 €
Reinvesting 180,000 €partial relieffull relief
On a gain of 90,000 €36,000 € of the gain is taxednothing taxed

The window is two years and it runs backwards as well

Article 41.3 gives two years from the transfer to reinvest, "in one go or successively"2. What is rarely added sits in the closing paragraph of the same section: amounts obtained on the sale and put towards a main home "acquired within the two years before" that sale also qualify for the relief.

The real window is therefore four years wide, and someone who bought the new home before selling the old one is still inside it. One formal duty is easy to lose sight of: if the reinvestment does not happen in the same year as the sale, the taxpayer must state the intention to reinvest in that year's return.

And if they then fail to, article 41.5 does not leave the matter open: the non-exempt part of the gain is attributed to the year it arose and a supplementary self-assessment with late-payment interest is due.

What counts as a "main home" here

Article 41 bis of the regulation defines the concept for articles 7.t), 33.4.b) and 38 of the law2: that is, for this relief and for the over-65 exemption at the same time. It asks two things:

  • that the building has been your residence for a continuous period of at least three years;
  • that you occupied it actually and permanently within twelve months of the acquisition or the completion of works.

The article itself opens the first condition: the home is treated as having been your main one even without the three years where the taxpayer dies or "other circumstances necessarily requiring a change of address" arise, and it lists marriage, marital separation, a job transfer, obtaining a first job and a change of job.

The two over-65 exemptions are not the same

They sit five articles apart and answer different questions. Confusing them makes someone pay who did not have to, or expect a relief that does not exist.

Article 33.4.b)Article 38.3
What is soldThe main homeAny asset
Must you reinvestNoYes, into an insured lifetime annuity
DeadlineNoneSix months
CapNo cap240,000 €
Covers severe dependencyYesNot mentioned

Article 33.4.b) exempts the gain arising "on the transfer of their main home by people over 65 years of age or by people in a situation of severe or major dependency"1. No conditions. Article 38.3 exempts the transfer of any asset by someone over 65 "provided the total amount obtained on the transfer is used within six months to set up an insured lifetime annuity in their favour", and adds that "the maximum total amount that may be applied to setting up lifetime annuities shall be 240,000 euros"1.

A 66-year-old selling their house pays nothing and has to do nothing. The same person selling a second flat for 400,000 euros and putting all of it into a lifetime annuity is still taxed on 40 per cent of the gain, because the cap does not move.

Reinvest less and you do not lose it all

Article 41.4 and the second paragraph of article 38.1 say the same thing from both sides: where the amount reinvested is less than the total obtained, "only the proportional part of the capital gain corresponding to the amount reinvested shall be excluded from tax"12.

It is a proportion, not all or nothing. Against an amount to reinvest of 200,000 euros, reinvesting 50,000 exempts a quarter of the gain.

A worked example with real numbers

A main home bought in 2010 for 180,000 euros, with 15,000 euros of purchase costs and taxes, sold today for 300,000 euros with 12,000 euros of selling costs. 90,000 euros of mortgage was still outstanding.

ItemAmount
Acquisition value (art. 35.1)195,000.00 €
Transfer value (art. 35.2)288,000.00 €
Capital gain93,000.00 €
Tax with no relief20,270.00 €
Amount to reinvest (art. 41.1)198,000.00 €

Without the article 41.1 reduction, anyone reading that they must reinvest "everything obtained" will believe they need 288,000 euros. They need 198,000. And reinvesting that figure leaves the gain entirely exempt and the tax at zero rather than 20,270 euros.

The municipal plusvalía is separate: it is a town-hall tax on the increase in land value and is unaffected by this relief4.

Common mistakes

  • Believing you must reinvest the whole sale price

    The first paragraph of article 41.1 of the regulation says that where borrowing was used to buy the property being sold, the total amount obtained is the transfer value reduced by the principal of the loan outstanding at the moment of the transfer. That is what turns many partial exemptions into full ones.

  • Thinking the window only runs forwards

    The closing paragraph of article 41.3 says amounts put towards a main home acquired in the two years before the sale also qualify for the relief. Someone who bought first and sold afterwards is still inside it.

  • Not declaring the intention to reinvest

    Where the reinvestment does not happen in the year of the sale, article 41.3 requires that intention to be stated in the return for the year the gain arose. It is a formal requirement that is easily forgotten and awkward to argue afterwards.

  • Mixing up the two over-65 exemptions

    Article 33.4.b) exempts the sale of the main home with no condition and no cap. Article 38.3 exempts anything else only if the amount goes into an insured lifetime annuity within six months, and only up to 240,000 euros. Applying the second to a main home makes someone pay who did not have to.

  • Adding mortgage interest to the acquisition value

    Article 35.1.b) includes the costs and taxes inherent to the purchase, EXPRESSLY EXCLUDING INTEREST. Twenty years of payments do not raise the acquisition value. And if you let the property, the depreciation you deducted LOWERS it.

Frequently asked questions

How much must I reinvest to pay nothing?
The transfer value less the mortgage principal still outstanding on the day of the sale. The transfer value is the price less the costs and taxes you bore as seller. Someone selling for 300,000 euros, paying 12,000 in costs and carrying 120,000 of mortgage must reinvest 168,000 euros to be fully exempt.
How long do I have to reinvest?
Two years from the transfer, and article 41.3 allows it to be done in one go or successively. The same article adds that amounts put towards a main home bought in the two years before the sale also qualify, so the real window is four years wide.
What counts as a main home?
Article 41 bis of the regulation requires it to have been your residence for a continuous period of at least three years, and to have been actually and permanently occupied within twelve months of the purchase or the completion of works. The three years are treated as met if circumstances necessarily require a change of address, and the article itself lists marriage, separation, a job transfer, a first job and a change of job.
What if I am over 65?
Then you do not have to reinvest anything. Article 33.4.b) exempts the gain on the transfer of the main home by people over 65, and also by people in a situation of severe or major dependency. There are no conditions, no deadline and no cap on the amount.
What if I reinvest only part of it?
Article 41.4 says only the proportional part of the gain corresponding to the amount actually invested is excluded from tax. If you had to reinvest 200,000 euros and you reinvest 50,000, a quarter of the gain is exempt and the rest is taxed.
What if I never reinvest?
Article 41.5 requires the non-exempt part of the gain to be attributed to the year it arose, with a supplementary self-assessment and late-payment interest. The deadline runs from the breach to the end of the filing period for the tax year in which that breach occurs.
Does renovating count instead of buying?
Yes. Article 41.1 treats rehabilitation as an acquisition, by two routes: works subsidised under a state housing rehabilitation programme, or works whose main purpose is reconstruction through the consolidation and treatment of structures, facades or roofs, provided the overall cost exceeds 25 per cent of the purchase price or market value, with the land element taken out.
Does this relieve me of the municipal plusvalía too?
No. They are separate taxes and the reinvestment relief belongs to the IRPF. The municipal plusvalía is charged by the town hall on the increase in urban land value and has its own rules, including non-subjection where the property is sold at a loss.
Work out your gain and the amount to reinvest using the real price and mortgage from your own sale.

Sources

  1. 1.Law 35/2006 on personal income tax, article 38: gains excluded from taxation on reinvestment · Boletín Oficial del Estado
  2. 2.Personal income tax regulation, article 41: the mortgage reduction, the two-year window and partial reinvestment · Boletín Oficial del Estado
  3. 3.Law 7/2024, seventh final provision: the 30 per cent savings-base band from 2025 · Boletín Oficial del Estado
  4. 4.Practical income tax manual, chapter 11: capital gains and losses · Agencia Tributaria

Author / Reviewed by

Author

Thorben Rasmus Idel

Co-founder & writer

Co-founder of Calculadora Capital and the writer behind the methodology on every calculator and article. An entrepreneur and active investor, Thorben founded Idel Versandhandel GmbH, an international trading company operating across 16 countries, and invests across stocks, ETFs and cryptocurrency. He writes the methodology and verifies the math behind each page, drawing on hands-on business and investing experience to keep the tools and explanations grounded in how money, markets and taxes actually work for everyday people in Spain.

Reviewed by

Nahar Geva

Co-founder & reviewer

Co-founder of Calculadora Capital and the independent reviewer behind every calculator and article. An entrepreneur and active investor, Nahar brings a data- and product-driven mindset together with hands-on experience in the markets, investing across stocks and ETFs as well as cryptocurrency and other digital assets, alongside broader personal finance and real estate. On each page Nahar reviews the methodology and double-checks the math and figures, pressure-testing how the tools and explanations hold up against the way money, markets and taxes actually work for everyday investors.

Published: Updated: Reviewed: