Capital gains tax and IRPF when selling your home
The tax cost almost nobody calculates in time. Between 5% and 25% of what you receive from the sale can end up with the tax office or the City Council. Knowing it before signing is the difference between planning and reacting.
Most owners find out how much they owe the tax office after signing the sale. By then, there is no room for decisions: only for payments.
This guide explains the two taxes levied on the sale of a home in Spain, how they are calculated in 2026, what exemptions exist and which decisions made in time can save you thousands of euros.
The two taxes on the sale
When selling a home in Spain, the owner faces two different taxes that are calculated, managed and paid separately:
- Municipal capital gains tax (IIVTNU): collected by the City Council. It taxes the increase in value of the urban land between purchase and sale. It is paid within 30 days of signing.
- IRPF (capital gain): collected by the tax office. It taxes the difference between the sale price and the adjusted purchase price. It is declared in the following year's income tax return.
They are cumulative: you pay both. The good news is that both allow for nuances, deductions and, in some cases, full exemptions. La mala noticia es que esos matices solo sirven si los conoces a tiempo.
Municipal capital gains tax: what exactly it is
The municipal capital gains tax taxes the increase in value of the land between when you bought and when you sell. It is a municipal tax: each City Council sets its rates and coefficients within national limits.
It only taxes the urban land, not the building. That is why, for the same sale price, a home in a central area with a high cadastral land value will pay more than a home in an outlying area. The seller pays it (except for gifts and inheritances).
- Taxpayer: the seller
- Payment deadline: 30 working days from signing
- Collector: the City Council where the property is located
- In Barcelona: managed through the Institut Municipal d'Hisenda
The two methods of calculation
Since the Constitutional Court ruling of October 2021, the capital gains tax allows two methods. The taxpayer can choose whichever is more beneficial:
Objective method. Multiplies the cadastral value of the land by a coefficient determined by the years of ownership. The result is the tax base, to which the City Council applies its rate (in Barcelona, up to 30%).
Real method. Calculates the difference between the transfer value and the acquisition value, applying to that difference the proportion the land represents of the total cadastral value. The same municipal rate is applied to that base.
The City Council applies the objective method by default. If the real method is more favourable, the seller must request it by providing the purchase and sale deeds.
When is it not paid capital gains tax
There are three cases in which the seller does not pay municipal capital gains tax:
- There has been no increase in value. If you sell for a price equal to or lower than the purchase price, the transaction is exempt. You must formally apply to the City Council, providing both deeds.
- Ownership period of less than one year.
- Transfer between spouses in separation, divorce or annulment by court order, and handing over the property to the bank in lieu of payment (dación en pago) of the main residence.
IRPF: the capital gain
Selling a home generates, for IRPF purposes, a capital gain or loss. Si hay ganancia, Hacienda grava esa diferencia dentro de la savings base, with rates in 2026 ranging from 19% to 30%.
It is declared in the income tax return for the following year after the sale. If you sell in 2026, you declare it in the 2026 return (filed in April-June 2027).
Unlike municipal capital gains tax, IRPF does not accept the argument «I sold for less» as an exemption. If there is a gain (calculated according to the tax formula), it is taxed.
Real calculation, with an example
The formula the tax office uses to calculate the capital gain is:
Gain = (Sale price − Selling costs) − (Purchase price + Purchase costs + Improvements)
Deductible selling costs: agency commission, municipal capital gains tax, certificates, mortgage cancellation. Purchase costs: ITP or VAT, notary, registry, agency fees. Improvements: extensions or new installations (not repairs).
Tax brackets 2026
The capital gain is taxed in the savings base, with progressive brackets:
| Gain bracket | Applicable rate |
|---|---|
| Up to €6,000 | 19 % |
| From €6,000 to €50,000 | 21 % |
| From €50,000 to €200,000 | 23 % |
| From €200,000 to €300,000 | 27 % |
| Over €300,000 | 30 % |
On the gain in the example (€106,300), the tax office would take approximately 22.300 €. Para una venta de 450.000 €, el coste fiscal total —plusvalía + IRPF + comisiones— ronda los 40.000 €, un 8,8 % del precio de venta.
Exemptions: reinvestment and over-65s
Reinvestment in a main residence. If you sell your main residence and reinvest the full amount obtained in another main residence within a maximum of two years, the gain is fully exempt. Si reinviertes solo una parte, la exención es proporcional.
Over-65s. If the seller is 65 or over and sells their main residence, the gain is fully exempt from IRPF, with no need to reinvest.
- Reinvestment in a main residence: full or proportional exemption
- Over-65s: full exemption on the main residence
- Over-65s (other property): exemption via a life annuity up to €240,000
- Handing over the main residence to the bank in lieu of payment: exempt
- Offsetting against capital losses
How to organise it before signing
The difference between a sale that is well planned from a tax point of view and an improvised one can be several thousand euros. Steps to take before signing the deposit contract:
- Locate the purchase deed and all associated costs (ITP, notary, registry)
- Gather the invoices for improvements made
- Ask the City Council for a capital gains tax simulation using both methods
- Calculate the estimated capital gain and IRPF
- Plan the reinvestment in a main residence within the two-year period
- If the seller is 65+, check whether the home qualifies as a main residence
- Keep all invoices for selling costs
Tax is something you plan.
Not something you suffer.
At Profinca, before marketing a home we carry out a tax X-ray of the transaction. You will know precisely how much you will receive net. No surprises at the notary.