property

IRPF exemption on house sale

Responsible for this content: Frank Menze

IRPF sale exemption

Explanation

The calculator shows one route per run. Other exemptions may also be available, and the result flags a clearly better route.

Explanation

Enter the agreed price from your sale deed.

Explanation

Enter the price in your acquisition deed; for an inheritance or gift, enter the value assessed there for tax.

Explanation

Enter the full acquisition value of the new main home. Financed amounts count too, not only your own cash.

Explanation

This means your tax residence, not your nationality. It determines which exemption routes are open to you.

Explanation

Use the date of the notarised sale deed. The calculator reads every rule from the register for that date.

Explanation

For acquisitions within a transitional regime, this calculator does not calculate a proportional reinvestment exemption; it shows the tax without it and a review note.

Explanation

Enter the costs you bore as the seller: agency commission, notary and legal fees, and the plusvalía municipal (the municipal tax on the increase in land value) if you paid it. They reduce the transfer value.

Explanation

Include taxes and fees you bore on acquisition, but not interest.

Explanation

Enter documented improvements, not ordinary repairs or maintenance.

Explanation

Only enter the principal still due on the loan you used to acquire the home being sold. Later borrowing for other purposes does not count.

Explanation

Enter your completed years of age on the transfer date.

Explanation

Choose Yes only if you used the home continuously as your main residence for at least 3 years and held full title throughout; co-ownership is enough. A main home vacated up to 2 years before sale may still count. Statutory exceptions need individual review.

Explanation

No means the calculator applies no exemption. A later breach can trigger additional taxation.

Exempt share78.56%
Gain (ganancia patrimonial)
€189,200.00
Total amount obtained
€611,000.00
Eligible reinvestment
€480,000.00
Exempt gain
€148,635.02
Taxable gain
€40,564.98
Tax with exemption
Why this figure?
As a resident, you pay tax on the remaining gain under the savings scale.
€8,398.65
Tax without this exemption
€42,396.00
Tax saved
€33,997.35
Sale proceeds after costs and tax
€602,601.35

The resident calculation assumes this gain is your only savings income for the year.

Three worked cases

Full reinvestment
Gain (ganancia patrimonial)
€189,200.00
Exempt gain
€189,200.00
Tax with exemption
€0.00
Partial, with a loan
Gain (ganancia patrimonial)
€189,200.00
Exempt gain
€111,076.32
Tax with exemption
€16,848.45
Main home and age
Gain (ganancia patrimonial)
€189,200.00
Exempt gain
€189,200.00
Tax with exemption
€0.00

Legal status: 1 January 2025

This calculation is provided for guidance only and is not a substitute for tax or legal advice in specific cases.

When does the profit from a house sale remain tax-free?

If you sell your Spanish vivienda habitual (main residence), the Spanish tax authorities generally demand tax via income tax (IRPF) on the increase in value, the so-called ganancia patrimonial (capital gain). However, in three cases this gain remains wholly or partly tax-free when selling the house: if you reinvest the proceeds in a new main residence, if you are at least 65 years old at the time of sale or fall under dependencia severa or gran dependencia (the Spanish classifications for severe or highly severe care dependency), or if you invest the proceeds in a renta vitalicia (lifelong annuity). Which route suits you and how much you actually save depends on your age, your residency situation and how much you actually reinvest — that is exactly what the calculator above works out for you using your own figures. If you are a non-resident, depending on your country of residence you have access to some of these exemptions, but not all of them.

How it is calculated

In all three cases, the starting point is the same sale profit that the calculator for capital gains tax on property sales determines: sale price less the ancillary costs borne by the seller, minus the acquisition price plus acquisition-related costs and value-enhancing modernisations. The three routes differ only in what happens to this profit afterwards.

RouteRequirementWhat happens to the profit
Reinvestment in a new main residenceSale of your own vivienda habitual, reinvestment in a new oneThe proportion of the profit corresponding to the reinvested amount relative to the relevant sale proceeds remains tax-free
Exemption from age 65 onwardsAge at date of sale, vivienda habitualThe entire profit remains tax-free, without any reinvestment at all
Exemption in case of care dependencydependencia severa or gran dependencia, vivienda habitual, regardless of ageThe entire profit remains tax-free
Reinvestment in an annuityAge from 65 onwards, reinvestment within 6 months, cap €240,000The proportion of the profit corresponding to the amount credited relative to the full sale value remains tax-free

When reinvesting in a new main residence, the full sale price does not automatically count as the reference figure: if there was still an outstanding loan on the SOLD property, the tax authorities first deduct its remaining balance (more on this under "Special cases"). The reinvested sum is then set in proportion to what remains afterwards — if you reinvest at least as much as remains, the exemption is complete; if you reinvest less, only the corresponding proportion of the profit remains tax-free. What counts as "reinvested" here is the full acquisition value of the NEW property — even if you finance it via a mortgage. This is the most common misconception in this area: many people think that only the portion paid from their own funds counts, whereas the AEAT (Spanish tax administration) explicitly bases this on the full purchase price of the new property, regardless of whether it was paid in cash or financed.

The same basic principle applies to the life annuity, but with a cap: if you reinvest more than €240,000, only the amount up to this maximum value counts — and if you had already reinvested in a life annuity before, that earlier amount is deducted from the cap before the new amount is taken into account. The life annuity must also be arranged with an insurer within 6 months of the sale. Unlike with the flat, the reference amount here is not reduced by an outstanding loan — the rule on life annuities does not include this reduction, as it only applies to the flat route.

If you are over 65 years old, or recognised as severely or highly dependent, and sell your main home, you don't need to reinvest at all: this exemption applies completely, without condition and without a cap. That's why the calculator automatically checks all four routes on every run and alerts you if a more favourable route is available than the one you chose — for example, if you're actually already entitled to the full, unconditional exemption from age 65 onwards, but you've accidentally entered the reinvestment route with only partial allowance instead.

The taxable remainder, if any remains, is taxed for residents like any other capital gain via the savings-base scale — it starts at 19% and goes up to 30%. For non-residents, a separate tax rate applies, and regardless of the exemption, the tax withholding at the notary still applies (more on this in the "Special cases" section).

Special cases

The following five points concern situations that don't arise in the simple standard case above, but are anything but rare in practice.

Co-ownership and mixed acquisition histories

If the flat belongs to several people, each co-owner calculates separately: age, residency status and reinvestment behaviour can differ, and the respective exemption is only applied to that person's own share of the gain. The situation is similar if you bought part of the flat and inherited another part, or increased your share at different points in time: separate transitional rules may apply to each acquisition event, and the calculator only reflects the standard case of a single, unified acquisition. If you're selling an inherited property, it's also worth taking a look at our guide to selling an inherited property in Spain, since different acquisition values and deadlines apply there than for an ordinary purchase.

Non-residents

For non-residents, the situation is more nuanced than it first appears. If you are resident in an EU member state or in the EEA with information exchange, you now have access to the reinvestment exemption for your former Spanish main home — via a separate transitional provision, but the same rule in effect as for residents. The exemption from 65 years, on the other hand, you do NOT have the exemption for the life annuity in this case: both are expressly reserved for residents. If you are resident outside the EU and EEA, none of the three exemptions apply to you. Regardless of any exemption, the tax withholding at the notary remains in place for non-residents — more on this in our Guide to the tax withholding on property sales for non-residents. Anyone resident in the EU or EEA who earns a significant part of their income in Spain can also apply to be taxed as a resident — the calculator does not reflect this option.

The two-year grace period

Your home no longer has to currently be your main residence at the time of sale to still count as vivienda habitual: it is enough if it was your main residence at any point during the last 2 years before the sale. If, for example, you moved into another home some time ago, the exemption from 65 years and the reinvestment exemption still apply, as long as the sale takes place within this grace period.

The deduction of the outstanding loan

If you took out a loan when buying the SOLD home and part of it is still outstanding at the time of sale, the tax authorities deduct the remaining amount from the sale proceeds before calculating the reinvestment ratio. In practice, this means you often don't have to reinvest the full sale price to get the full exemption — only the amount reduced by the loan. This refers exclusively to the loan with which you originally acquired the sold home; a mortgage taken out later for other purposes does not count here.

The requirement of full ownership (pleno dominio) during the three years

For a home to count as a main residence at all, you must have lived there continuously for at least 3 years (with exceptions, for example in the case of marriage, separation, or a job-related move) and you must have actually moved in within 12 months of purchase or completion. In addition, you need to hold pleno dominio (full ownership) of the home during this time — shared ownership between several people is sufficient for this, but a mere right of use without ownership is not.

Deadlines and forms

The gain — exempt or not — must in any case be included in your tax return: residents declare it via the Modelo 100 (Spanish income tax return), non-residents via the Modelo 210 (tax return for non-residents). This applies even if the exemption covers the entire gain — the obligation to declare does not disappear because of the full exemption, only the tax liability itself.

For reinvestment in a new main home, you have 2 years from the date of sale — or you already bought the new home in the 2 years BEFORE the sale, in which case the deadline runs backwards. For the life annuity, it is 6 months. If you miss the respective deadline, the AEAT will demand the tax retroactively — with late-payment interest for the period during which it would actually have already been due.

The exemption from a certain age and the reinvestment exemption are set out in Art. 33.4.b and Art. 38 of Ley 35/2006 (Spanish Income Tax Act, LIRPF). They are implemented via Art. 41, Art. 41 bis and Art. 42 of RD 439/2007 (Implementing Regulation to the IRPF, RIRPF) — these articles regulate the deadlines, the concept of vivienda habitual and the pension investment in detail. For non-residents from the EU or the EEA, the disposición adicional séptima of RDLeg 5/2004 (Non-Resident Income Tax Act, TRLIRNR) also applies, which explicitly extends the reinvestment exemption to the former Spanish main residence.

Step by step to a tax-exempt sale

Anyone wanting to make the profit from the sale of their own vivienda habitual (main residence) tax-free should not leave the process to chance. The following steps bring structure to the procedure, regardless of which of the three exemption routes you ultimately use.

  1. Check the requirements: Do you meet the minimum period of use as a main residence, have you reached the statutory minimum age, or does recognised need for care apply, and is reinvestment realistically planned? The calculator above shows you which route is even applicable to your situation.
  2. Provisionally determine the profit: Compare the acquisition value (purchase price plus incidental costs and value-enhancing modernisations) with the transfer value (sale price minus incidental costs borne by the seller) to get an initial idea of the order of magnitude of the taxable profit.
  3. Document the reinvestment: Keep a written record of the search, letters of intent and preliminary purchase contracts for the new main residence. Note down the full acquisition value of the new home — it counts regardless of whether you pay for it in cash or finance it.
  4. Register the exemption in the tax return: Even in the case of a full exemption, the sale must be declared with the appropriate exemption code — residents via the Modelo 100 (Spanish income tax return), non-residents via the Modelo 210 (tax return for non-residents).
  5. Keep the supporting documents: Retain invoices for improvements, notarial deeds, purchase contracts and registration certificates for at least the statutory retention period.
  6. Register the new home: Have the new main residence registered within the statutory registration period via Empadronamiento (registration in the municipal population register) in the new municipality.
  7. Keep evidence ready: In the event of an audit by the AEAT (Agencia Estatal de Administración Tributaria, Spanish tax authority), you must be able to provide complete evidence of both the use as a main residence and the reinvestment.

Common mistakes

In practice, exemption applications repeatedly fail on the same points. The table shows the most common pitfalls – supplemented by two mistakes that occur particularly when reinvesting in a new home.

MistakeConsequenceCountermeasure
Minimum period of use as main residence not metFull tax liability, no entitlement to exemptionPlan the sale date carefully; when in doubt, check in advance with the calculator above
Reinvestment deadline exceededBack taxes plus late-payment interestNote the deadline firmly in the calendar, bring forward the purchase of the new home if necessary
Exemption not stated in the tax returnAEAT assesses the full tax, an appeal becomes necessaryAlways state the exemption code in the return together with a gestoría (Spanish administrative office for tax and official matters) or tax adviser
Improvement and acquisition costs not documentedHigher taxable gain because the acquisition value comes out too lowKeep all invoices since the purchase complete and without gaps
Co-ownership shares overlookedIncorrectly calculated or only partial exemptionClarify the ownership structure with an adviser beforehand, calculate each share individually
Empadronamiento missing or done too lateAEAT doubts the main-residence statusRegister immediately after moving in
Only own funds counted as reinvestmentExemption calculated too low, unnecessary tax paidUse the full acquisition value of the new home – including the part financed via a mortgage
Outstanding acquisition loan on the sold home not taken into accountReinvestment ratio calculated too low, more tax paid than necessaryDeduct the remaining debt of the original acquisition loan from the sale proceeds before calculating the ratio

Checklist before the notary appointment

  • Minimum period of use as main residence proven (padrón, electricity and water bills)
  • All improvement costs and acquisition-related expenses since the purchase compiled
  • Profit provisionally calculated (acquisition value against transfer value)
  • Legal minimum age reached or care dependency recognised? → check full exemption without reinvestment
  • Outstanding acquisition loan on the sold property quantified
  • Reinvestment intention documented and feasible within the legal deadline
  • New main residence identified, full acquisition value (including the financed portion) noted
  • Exemption code for the tax return coordinated with gestoría or tax adviser
  • All receipts secured for the legal retention period
  • Padrón registration at the new home prepared in good time

Frequently asked questions

Do I have to buy a new home straight away to avoid the tax?
No. After the sale you still have a legally defined period of several years — or you may have already bought the new home before the sale, which also counts as reinvestment.
If the new home is financed, does only the part I pay from my own funds count?
No. The Spanish tax authorities go by the full purchase price of the new home, regardless of whether you pay it in cash or finance it through a mortgage.
I'm past the legal minimum age — do I still need to reinvest?
No. From this age onwards, the entire profit from the sale of your main home is tax-free, with no reinvestment and no further condition required.
Does the exemption also apply if I need care but am younger?
Yes. Where severe or highest-degree care dependency is officially recognised, the same full exemption applies regardless of age.
I live abroad — do I even have access to any of these exemptions?
That depends on your country of residence. If you are resident in the EU or the EEA with information exchange, the reinvestment exemption is open to you, but not the exemptions based on minimum age or on a life annuity. Outside the EU and EEA, none of the three exemptions apply to you.
What happens if I miss the reinvestment deadline?
Then the tax authorities will demand the tax retroactively, plus late-payment interest for the period since the original due date.
Does my home still count as my main residence if I had already moved out beforehand?
Yes, as long as the sale takes place within a legally defined grace period after moving out — the home is then retroactively still treated as your main residence.
Can I invest part of the proceeds in a new home and part in a life annuity?
This is not conclusively settled in law. Both provisions each refer to the entire sale proceeds, and no official source explicitly states whether the two routes can be combined for the same sale.
Do I even need to file a tax return if the profit is completely tax-free?
Yes. The obligation to file remains, even if no tax is ultimately due.

What this calculator does not decide

  • It does not divide a co-ownership share: if there are several owners with different circumstances, you calculate for each person separately.
  • It does not verify the length of residence mathematically but asks for it as a confirmation — exceptions such as marriage, separation or a work-related move are judgement calls that the calculator cannot make itself.
  • It does not state whether a reinvestment outside Spain is recognised for Spanish tax purposes — there is no clear official statement on this.
  • It does not quantify the back-tax due upon a breach of deadline as an amount, but only names it as a consequence.
  • For residents, it assumes that this profit is the only income within your savings tax base for the relevant year.
  • It does not know the actual date of your reinvestment: it asks for deadlines instead of calculating them — nor does it account for a possible extension of the deadline for the amount withheld for non-residents.
  • The borderline case in which you reach the minimum age on the exact day of sale is not officially settled. Neither the legal text nor administrative guidance explicitly states whether the birthday itself already counts. The calculator treats this one day as already covered while also pointing out the uncertainty.
  • It does not account for the option whereby EU and EEA residents with predominantly Spanish income can apply to be taxed as residents.
  • Whether reinvestment in a new home and reinvestment in a life annuity can be combined for the same sale is also not conclusively settled — none of the official sources reviewed comment on this.
  • If the sold property was acquired before 1995 or between 12 May and 31 December 2012, the calculator does not calculate the proportional exemption. In these cases, an additional tax transitional regime applies, requiring a combined calculation with the reinvestment ratio — a calculation this calculator does not perform, so as not to show you a figure that depends on an unresolved interpretation. In these cases, it displays the tax without the exemptions on this page and draws your attention to the special case.

Conclusion

Whether the profit from your property sale remains tax-free rarely hinges on a single figure, but rather on the combination of age, residency status, reinvestment behaviour and the history of the property itself. The calculator above handles the calculation for the standard case and shows you which of the three routes could actually apply to your situation — and whether another route might be cheaper than you thought. In cases of co-ownership, an inherited property, a very old purchase, or residency outside the EU, it's also worth having a conversation with a gestoría (administrative office) or a local tax adviser — especially in the areas where this calculator deliberately doesn't show a figure.