If I sell my principal residence and buy another, do I avoid paying income tax (the “IRPF”) on the gain?

Yes, if you put everything you obtain from the sale towards buying your new principal residence within the following two years, or if you already bought it in the two years before. If you reinvest only part, you do not pay on the corresponding proportion of the gain. If you bought the flat you sold with a loan you had not finished repaying, it is enough to reinvest the proceeds minus what was still owed on that loan. You must state this in your income tax return for the year of the sale. The exemption only applies to income tax, so the “plusvalía municipal”, the municipal capital gains tax, is still payable.

Alburquerque Abogados

José Manuel Alburquerque

Both must be your principal residence

The exemption only applies if the home you sell and the one you buy are both your principal residence:

  • The one you sell must be your principal residence when you sell it or have been so at any time in the previous two years. If you have already moved out, you have two years to sell it without losing the exemption.
  • In general, you must live in each one for at least three consecutive years, unless you have to move earlier for reasons such as a death, a marriage, a separation or a change of job.
  • You must actually and permanently move into the new one within twelve months of the purchase or of the completion of the works.

It does not apply if what you buy is a second home or a flat to let out or for a child. Nor if what you sell is a second home or a let flat.

How much to reinvest and when

  • You must reinvest everything obtained from the sale, after deducting the costs of the sale. If you bought the home you sold with a loan you had not finished repaying, what counts is the proceeds minus what was still owed on that loan.
  • The time limit is two years from the sale, in one go or in several instalments. A home bought in the two years before the sale also qualifies.
  • You do not have to pay for the new one with the same money. According to the “Tribunal Supremo”, Spain's Supreme Court, paying for it with a new loan is valid.

For example, you sell for 300.000 euros, after deducting expenses, with a gain of 100.000. You still owed 50.000 on the loan with which you bought it, so you must reinvest 250.000. If the new one costs you 200.000, you have reinvested 80 % and pay no tax on 80.000 euros of the gain. The other 20.000 is taxed, on which you pay 4.080 euros if you have no other gains or interest that year. If the new one costs 250.000 or more, you pay nothing on the gain.

How it is applied

In your income tax return for the year of the sale you must state that you are going to reinvest and how much. If you then fail to reinvest within the time limit, or reinvest less, you must file a supplementary return for that year, with late-payment interest. If you are over 65, you do not need to reinvest to avoid paying tax on the gain on your principal residence.

This answer is provided for educational purposes and offers initial guidance on the question raised. Every matter has its own circumstances and nuances that require individual assessment. For that reason, before taking decisions with significant consequences, it is advisable to consult a professional and not to rely solely on this information. Personalised advice makes it possible to apply these explanations to the specific case and to assess the options available with greater certainty.