← Back to the blog

TAX · PUNTO HABITAT

Main home reinvestment tax exemption in Spain: calculator and guide

You can sell your main home and buy another without paying Spanish income tax (IRPF) on the profit from the sale. You must reinvest the amount required by the rules and meet the conditions and time limits. If you put less towards the new home, part of the profit may still be taxable.

The key question is how much you put towards the new home. Start with this example, then check your own figures.

Keys and moving boxes in a bright living room, illustrating a move to a new main home

I made €350,000 selling my home: will I have to pay IRPF?

You bought for €200,000 and are selling for €550,000. The difference is your profit: €350,000. You are now buying another home to live in.

If you buy the new home for €550,000

You would not pay IRPF on that €350,000 profit. The new purchase covers the full amount needed to make the profit on this sale exempt from IRPF.

If you buy the new home for €350,000

You would have to pay IRPF on part of the profit. Buying another main home for this amount is not enough to make all the profit exempt from IRPF.

This example assumes the home sold is fully paid off, you are its sole owner and you meet the main home and time-limit requirements. To keep it simple, we leave out expenses, tax adjustments and other possible exemptions. This concerns IRPF: municipal plusvalía is assessed separately.

See the calculation for this example

Profit that remains taxable: €350,000 × €200,000 / €550,000 = €127,272.73.

The percentage of 36.36% is rounded for readability. The calculation uses the full amounts.

GET AN INITIAL ESTIMATE

Main home reinvestment tax exemption calculator

Check whether the amounts you enter would make the profit on your sale exempt from IRPF through reinvestment, or whether part would remain taxable. Enter only the amounts for your share of the property.

The sale price minus the sale expenses and taxes deductible under the rules. Do not subtract the mortgage here.

Only the outstanding principal of the loan used to buy it, excluding future interest. If the home is fully paid for or you bought it without a mortgage, enter 0.

As a starting point, subtract what the home cost you from what you receive when selling it. An accurate tax calculation must also account for allowable expenses, taxes and adjustments. Read the explanation.

The acquisition value that qualifies as reinvestment, including the financed portion. Only your ownership share, and within the time limit.

An estimate under the general reinvestment rules for Spanish IRPF taxpayers. It assumes that the main home, ownership and time-limit requirements are met. It does not determine your eligibility or calculate your final income tax bill. Losses, other exemptions and special circumstances require an individual review.

How is the reinvestment exemption calculated?

First calculate the required amount: the sale value for tax purposes minus the outstanding principal of the acquisition loan, if any. Divide the amount reinvested by this figure, capped at 100%. Apply that percentage to the capital gain calculated for tax purposes.

If the home is fully paid for: enter €0 in the outstanding mortgage field. No debt is deducted. For full exemption, the amount to reinvest would be the entire sale value for tax purposes, not just the profit.

Example without a mortgage: with a sale value for tax purposes of €300,000, you would need to reinvest €300,000 for full exemption. Reinvesting €150,000 covers 50%. Of an €80,000 gain, €40,000 could be exempt and the other €40,000 would not be exempt through reinvestment.

Example with an outstanding mortgage: €300,000 − €100,000 = €200,000 to reinvest. Reinvesting €150,000 covers 75%. Of an €80,000 gain, €60,000 could be exempt.

Both examples assume the other requirements are met. The sale value for tax purposes includes permitted adjustments and may differ from the price stated in the deed.

Which homes can qualify for the exemption?

The transaction must meet the IRPF rules for a main home. The exemption does not automatically apply to every property bought or sold.

What does main home mean?It is the home where you actually live on a continuous basis, subject to the tax requirements below. Buying a property and calling it your main home is not enough: it must genuinely be where you live.

  • The home you sell: it must be your main home at the time of the sale or have been your main home at some point during the previous two years.
  • The home you buy: it must become your main residence. As a general rule, you must actually move in within twelve months of acquisition or completion.
  • Length of residence: the tax definition of a main home normally requires three years of continuous residence. Exceptions exist for circumstances that necessarily require a change of home; they must be justified.

Rehabilitation may also qualify if it meets the required tax definition. An ordinary renovation does not automatically count as rehabilitation for these purposes.

An everyday examplePainting the flat or replacing the kitchen alone is not enough to meet the rehabilitation requirement. Here, that word has a specific tax meaning which must be checked.

How much money do you need to reinvest?

There are two different calculations: the capital gain and the amount you must reinvest for that gain to be exempt. The gain is calculated using the tax rules on acquisition and disposal values; it is not simply the money paid into your bank account.

Capital gain
Your profit on the sale calculated under the tax rules: the difference between the sale and purchase values, with the relevant adjustments. It is not the total amount you receive for the property.
Acquisition and disposal
In a property sale, acquisition refers to buying and disposal refers to selling. Their tax values take account of the expenses, taxes and other adjustments allowed by the rules, so they may differ from the prices in the deed.

If the home sold was bought with financing, the outstanding principal of the loan used for that acquisition is deducted from the disposal value when calculating the reinvestment required. The outstanding debt does not in itself reduce the capital gain.

The mortgage, in plain languageThe outstanding principal is the loan money you still owe the bank, excluding future interest. Here, we mean the loan that financed the purchase of the home sold. Subtracting it helps determine how much you must reinvest; it does not mean you can also subtract it from your profit on the sale.

You can finance the new purchase with a mortgage: you do not have to use exactly the same euros received from the sale. What matters is the qualifying acquisition amount, alongside the other requirements. For a jointly owned home, each owner must calculate their share and check their own circumstances.

What does qualifying mean?It means the amount that the rules allow you to count towards reinvestment. For example, taking out a mortgage on the new home does not prevent the acquisition from counting. If you buy with another person, your ownership share is taken into account, not automatically the entire property price.

If you reinvest less than the required amount, only the corresponding proportion of the gain is exempt.

Partial reinvestment example

Assume a disposal value for tax purposes of €300,000, an outstanding acquisition mortgage of €100,000, and a capital gain already calculated for tax purposes of €80,000.

  • Amount you would need to reinvest: 300,000 − 100,000 = €200,000.
  • Qualifying reinvestment made: €150,000, equivalent to 75% of the required amount.
  • Exempt gain: 80,000 × 75% = €60,000.
  • Non-exempt gain: €20,000, which would be included in IRPF under the applicable rules.

Simplified example: assumes the main home, ownership and time-limit requirements are met. The disposal value for tax purposes may differ from the price stated in the deed.

The same example, at a glance

Reinvesting 75% can exempt 75% of your gain

Amount you would need to reinvest€200,000
€150,000 reinvested€50,000 not reinvested
Capital gain already calculated€80,000
€60,000 exempt€20,000 subject to IRPF

This does not mean you have to pay €20,000. It is the portion of the gain on which tax will be calculated, according to the rates and other circumstances of your tax return.

Illustrative example, assuming the other exemption requirements are met. The reinvestment percentage applies to the gain, not the total sale price.

The two-year time limit and declaring the sale

You can acquire your new home before or after selling: the general period runs from date to date and covers the two years before or after disposal. You may also make successive payments within that period.

The time limits, at a glance

You can buy before or after selling

Up to 2 years beforeYou buy the new home, then sell the previous one.
Date of saleThis date is the reference point for calculating the period.
Up to 2 years afterYou sell first, then buy the new home.
General rule: the period runs from date to date, not by calendar year. For example, two years from 15 June ends on 15 June two years later.

Signing an arras deposit agreement does not in itself mean you have acquired the home. Before committing to a transaction, check which acquisition and disposal dates count for tax purposes.

Arras are a preliminary stepAn arras agreement is a preliminary property purchase agreement, usually accompanied by a deposit. Reserving a flat does not necessarily mean you have already acquired it for the purposes of this exemption.

Do not assume the exemption applies automatically: you must report the transaction correctly in your IRPF return. If you plan to reinvest in a later tax year, you must state that intention. An error in the return may need correcting; it should not be treated as a definitive loss of entitlement without reviewing the case.

If the requirements are ultimately not met, you may need to regularise the gain for the year of sale through a supplementary tax return, with late-payment interest. Review your circumstances before the deadline expires.

What if you do not meet the conditions?Regularising means correcting your tax position. A supplementary tax return adds what was missing from the return for the year of sale so you can pay the amount due. Late-payment interest is an additional amount for the time that has passed.

Municipal plusvalía is assessed separately

This exemption applies to IRPF. It does not automatically remove municipal plusvalía or any other taxes that may apply to the transaction.

Frequently asked questions about reinvestment

If I sell my main home to buy another, will I pay IRPF on the profit?

You may not have to pay IRPF on the profit if the new purchase covers the required reinvestment amount and you meet the conditions and time limits. If it covers only part, some profit remains taxable unless another exemption applies. For example, with no mortgage or adjustments: buying for €200,000, selling for €550,000 and buying the new home for €550,000 may make the €350,000 profit exempt from IRPF. Buying the new home for €350,000 only gives partial exemption.

How do I calculate the exemption if I reinvest only part?

Divide the amount reinvested by the amount required for full exemption, then apply the percentage to the capital gain calculated for tax purposes. For example, covering 75% could exempt 75% of the gain. Try your figures in the reinvestment exemption calculator.

Does the calculator tell me how much tax I will pay?

No. It estimates the portion of the gain that could be exempt and the portion not exempt through reinvestment. Your IRPF bill also depends on other income, offsets and personal circumstances.

Is reinvesting the profit from the sale enough?

It may make part of the profit exempt from IRPF, but not necessarily all of it. The rules compare the amount reinvested with the sale proceeds; they do not treat you as having invested the profit first and kept only your original purchase cost. If there is no outstanding mortgage, full exemption requires reinvesting the full sale value for tax purposes. Any outstanding principal on a loan used to acquire the home sold is deducted when calculating the required reinvestment. See the example of buying for €200,000 and selling for €550,000.

Can I buy the new home before selling?

Yes. The general rule allows acquisition within the two years before the sale as well as the two years after it, provided the other requirements are met.

Can I take out a mortgage to buy?

Yes. Financing does not in itself prevent the exemption. The qualifying acquisition amount and compliance with the conditions must be checked.

What happens if I reinvest only part of the required amount?

The exemption is proportional. The non-exempt portion of the gain is included in IRPF under the applicable rules.

If I am over 65, do I need to reinvest?

The disposal of a main home by someone over 65 may qualify for a different exemption that does not require reinvestment. The requirements and each owner’s circumstances must be checked. Read our guide to selling a home if you are over 65 (in Spanish).

Plan the sale and purchase of your next home

To organise your move, you need to know what your flat is worth and coordinate the timing. At PUNTO HABITAT, we help you prepare the sale and review the matters you need to consider before signing. Start with an in-person valuation.

Sources: Spanish Personal Income Tax Law 35/2006, article 38; IRPF Regulations, articles 41 and 41 bis; Spanish Tax Agency guidance on reinvestment in a main home. Content prepared by PUNTO HABITAT. General information: each transaction requires a review of its tax circumstances.

Compare listings

Compare