How is the gain on selling a flat taxed under income tax (the “IRPF”)? What expenses can I deduct?

What is taxed is the gain, which is the sale price minus the costs of the sale and minus what the flat cost you, including the expenses and taxes of the purchase. That gain is added to the interest and other gains for the year and is taxed in bands, from 19 % to 30 %. It is declared in the income tax return filed in the year following the sale. You can deduct, among other things, notary's and Land Registry fees, property transfer tax (the “impuesto de transmisiones”) or VAT on the purchase, improvement works, the estate agent's commission and municipal capital gains tax (the “plusvalía municipal”), but not mortgage interest.

Alburquerque Abogados

José Manuel Alburquerque

What can be deducted

The gain is calculated as follows:

  • What you obtain is the sale price minus the costs you pay as the seller, such as the estate agent's commission, the municipal capital gains tax or your share of the notary's fees. If you declare a price below market value, the tax authorities use the market value.
  • What it cost you is the purchase price plus the expenses and taxes you paid when buying, such as notary's and Land Registry fees, the fees of the agency (“gestoría”), the estate agent's fees if you paid them, property transfer tax or VAT and stamp duty (the “impuesto de actos jurídicos documentados”).
  • Improvement works, such as adding a bathroom or extending the flat, are added to what it cost you. Repairs and maintenance, such as painting or replacing the boiler with a similar one, are not added.
  • Mortgage interest is not deducted.
  • If the flat was inherited, what it cost you is the value declared for the “impuesto de sucesiones”, the Spanish inheritance tax, plus the expenses and taxes of the inheritance.

If it was let or you bought it before 1995

  • If the flat was let, the depreciation for those years is subtracted from what it cost you, that is, what the law allowed you to deduct from the rental income for wear and tear on the flat. For each year it was let, at least 3 % of the higher of two values is subtracted, what the building cost you or its cadastral value, never counting the land, even if you did not deduct it. That is why having let the flat increases the gain when you sell it.
  • If you bought it before 31 December 1994, the part of the gain corresponding to the years up to 19 January 2006 is reduced, the more so the older the purchase. If you bought it before 31 December 1986, that part is not taxed. The reduction is capped at 400.000 euros of sale price, adding together all the sales to which it has been applied since 2015.

There is no other reduction for the number of years you have owned the flat.

How much is paid

The gain is added to the interest, dividends and other gains for the year, which is known as the savings base (“base del ahorro”). It is taxed in bands:

  • Up to 6.000 euros, 19 %.
  • From 6.000 to 50.000 euros, 21 %.
  • From 50.000 to 200.000 euros, 23 %.
  • From 200.000 to 300.000 euros, 27 %.
  • Over 300.000 euros, 30 %.

For example, a flat bought in 2014 for 200.000 euros, with 22.000 in taxes and expenses, is sold in 2026 for 320.000, with 10.000 in estate agent's fees and 2.000 in municipal capital gains tax. The gain is 86.000 euros. If there are no other gains or interest that year, 18.660 euros is paid in the 2026 income tax return, which is filed in 2027.

If there is a loss, it is offset against other gains for the year and, if any remains, against up to 25 % of the interest and dividends. Whatever is left is offset over the following four years. The scale is the same throughout Spain, except in the Basque Country and Navarre, which have their own income tax. The sale of a principal residence also has two exemptions, for reinvestment and for people over 65, which are a separate matter.

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.