‹ Back to the blog

Buying & selling · · 18 min read

Taxes When Selling a Flat in Spain in 2026: Plusvalía Municipal in Madrid, Income Tax (IRPF) and Exemptions

Selling a flat in Madrid involves two taxes of its own: the plusvalía municipal (municipal capital gains tax), charged by the City Council at 29%, and IRPF (income tax) on the gain, at rates from 19% to 30%. We explain how they are calculated, what changes on 1 December 2026, which exemptions exist, and walk you through a complete worked example with figures.

29%Plusvalía municipal rate in the city of Madrid; the legal maximum is 30% (guiafiscal.es, August 2026)
19–30%IRPF bands for the gain on the sale: 9.5% to 15% national plus the same again regional (Agencia Tributaria, 2025 tax return)
1 Dec 2026Date from which Royal Decree-law 29/2026 changes the maximum plusvalía coefficients, if it is ratified (Iberley, October 2026)
27 daysHow long the coefficients of Royal Decree-law 16/2025 lasted in January 2026 before being repealed (OCU, 27 January 2026)
3%Withholding the buyer pays to the tax authorities when the seller is not resident in Spain (Agencia Tributaria)
30 working daysDeadline to file the plusvalía municipal after signing the sale deed (Ayuntamiento de Madrid, according to urbanismoyarquitectura.com, October 2026)

When people talk about the taxes on selling a flat, almost everyone thinks about what they'll receive, not what they'll pay. And yet, in an ordinary sale in Madrid, the seller's tax bill can come to several thousand euros, sometimes tens of thousands. There are two taxes that fall on the seller: the plusvalía municipal, charged by the Ayuntamiento (City Council), and IRPF, Spain's personal income tax, which taxes the capital gain in your annual tax return.

What's more, 2026 is proving to be a particularly turbulent year for the plusvalía municipal in Madrid and across Spain. The coefficients used to calculate it have changed and been reversed twice, and a new decree-law plans to change them again from 1 December. In this guide we go through how each tax is calculated, which exemptions exist and what happens if you don't live in Spain, and we bring it all together in a complete numerical example.

General information, not advice. This article explains the rules in general terms, using data published up to 13 October 2026. Every sale has its nuances (dates, inheritances, co-owners, lettings, tax residence) and some rules are pending ratification. Before setting the price or signing, consult a tax adviser or a lawyer.

Which taxes the seller of a home pays

The seller of a second-hand home doesn't pay transfer tax or VAT: those are paid by the buyer, as we explain in “Costs of buying a home in the Comunidad de Madrid”. What the seller does pay are two direct taxes linked to the sale, each with different rules, deadlines and tax authorities.

  • Plusvalía municipal (Impuesto sobre el Incremento de Valor de los Terrenos de Naturaleza Urbana, IIVTNU, tax on the increase in value of urban land): charged by the town hall where the property is located. It taxes only the increase in value of the land, not of the building, and in a sale it is paid by the seller.
  • IRPF on the capital gain: collected by the Agencia Tributaria (Spanish Tax Agency). It taxes the difference between what you get from the sale and what the home cost you, after deducting expenses. It is declared in the tax return for the year following the sale.
  • If you're not resident in Spain, instead of IRPF you pay the Impuesto sobre la Renta de No Residentes (non-resident income tax), and the buyer must withhold 3% of the price.
  • Other costs that aren't taxes but reduce what you keep: cancelling the mortgage at the Land Registry, the energy certificate, intermediary or lawyer fees. Many of these are deductible for IRPF, as we'll see.

Plusvalía municipal in Madrid: how it works after the 2021 reform

The plusvalía municipal was reformed by Royal Decree-law 26/2021, after the Tribunal Constitucional (Constitutional Court) struck down the old calculation system in its judgment 182/2021. Since then, taxpayers can choose between two ways of calculating the tax base and apply whichever is cheaper. In addition, if there is no increase in the value of the land, there is no tax.

The objective method multiplies the cadastral value of the land at the time of sale by a coefficient that depends on how many years you've owned the property, up to a maximum of 20 years. The cadastral value of the land appears on the IBI (property tax) bill or on the Sede Electrónica del Catastro (the land cadastre's online portal). The real method, on the other hand, takes the actual gain between the purchase deed and the sale deed and multiplies it by the percentage the land represents within the total cadastral value.

In practice, for those who have owned the flat for many years, the objective method usually works out cheaper, because cadastral land values are administrative and well below market values. The real method is mainly worthwhile when the gain has been small. The Ayuntamiento de Madrid's self-assessment application calculates both methods if you enter the purchase and sale values, and applies the more favourable one.

On that base, the tax rate set by each town hall is applied, with a legal maximum of 30%. The Ayuntamiento de Madrid applies 29%. Bear in mind that the rate and some details vary between municipalities in the Comunidad de Madrid (Madrid region), so if you're selling in Alcobendas, Getafe or Pozuelo de Alarcón you'll need to check that town hall's bylaw.

Plusvalía coefficients in 2026: which table applies and what changes in December

The maximum coefficients for the objective method are set out in article 107.4 of the Ley Reguladora de las Haciendas Locales (Local Finances Act), and the national government can update them. In 2026 there have been three attempts. Royal Decree-law 16/2025, published in the BOE (Official State Gazette) on 24 December 2025, raised several coefficients, but the Congreso (Spanish parliament) did not ratify it on 27 January 2026 and it was repealed after being in force for just a few weeks. Royal Decree-law 26/2026, from late September, again included an update, and Congress voted it down on 2 October.

After the January repeal, town halls went back to the table approved by Royal Decree-law 8/2023, in force since 1 January 2024. The Ayuntamiento de Pozuelo de Alarcón, for example, published this in the Boletín Oficial de la Comunidad de Madrid (Madrid regional gazette) on 16 February 2026, with effect from 28 January. The Ayuntamiento de Madrid applies the maximum legal coefficients, and its taxpayer portal shows that same table for transfers from 28 January 2026.

The third attempt is Royal Decree-law 29/2026 of 6 October, published in the BOE on 7 October and in force since the 8th. Its article 10 sets new maximum coefficients with effect from 1 December 2026. Like the rest of the decree, it needs to be ratified by the Diputación Permanente (Standing Committee) of Congress; if it isn't ratified, it will be repealed and the 2024 table will continue to apply.

Years of ownershipCurrent maximum coefficient (RDL 8/2023)Maximum coefficient from 1 December 2026 (RDL 29/2026)
Less than 1 year0.150.17
1 year0.150.16
2 years0.140.16
3 years0.140.17
4 years0.160.17
5 years0.180.19
6 years0.190.21
7 years0.200.23
8 years0.190.24
9 years0.150.25
10 years0.120.22
11 years0.100.18
12 years0.090.14
13 years0.090.12
14 years0.090.11
15 years0.090.11
16 years0.100.11
17 years0.130.11
18 years0.170.13
19 years0.230.20
20 years or more0.400.30

Source: RDL 8/2023 table published by the Ayuntamiento de Pozuelo de Alarcón (BOCM, 16 February 2026) and by the Ayuntamiento de Ponferrada; table from 1 December 2026 according to article 107.4 of the TRLRHL (consolidated Local Finances Act) as worded by RDL 29/2026 (Iberley, 8 October 2026). The second column depends on the decree being ratified.

The new table raises the coefficients for those who have owned the property for between 1 and 16 years, sometimes considerably: at 10 years it goes from 0.12 to 0.22. On the other hand, it lowers them for ownership of 17 years or more, and from 20 years it goes from 0.40 to 0.30. The law establishes that, if the coefficient approved by a town hall ends up above the new maximum, the legal maximum applies directly until the town hall corrects its bylaw.

In short: if you sign the sale before 1 December 2026, the current table will apply. If you sign afterwards, it will depend on the decree being ratified and on how the City Council applies it. That's why, on the day of the deed, it's worth checking the table published by the Agencia Tributaria Madrid (Madrid's municipal tax agency) on its taxpayer portal.

When plusvalía municipal isn't payable, and tax relief in Madrid

No plusvalía municipal is payable when there is no increase in the value of the land, that is, when you sell for less than you bought according to the deeds. This is set out in article 104.5 of the Local Finances Act, and to prove it you'll need to provide the purchase and sale deeds. Even if nothing is payable, the transaction must be declared to the City Council within the deadline.

  • Sale at a loss: there is no increase in value and therefore no tax, provided this is proven with the deeds.
  • Dación en pago (handing the habitual home over to the bank to cancel the mortgage): exempt from plusvalía municipal if the legal requirements are met.
  • Transfers between spouses due to separation or divorce and contributions to the community property of the marriage: not subject to the tax.
  • Inheritance of the deceased's habitual home by a spouse, descendants or ascendants: the Ayuntamiento de Madrid applies relief of up to 95% of the tax, with percentages that fall as the cadastral value of the land rises.
  • An ordinary sale: in Madrid there is no relief for selling your habitual home, nor for age. The exemption for people over 65 applies to IRPF, not to the plusvalía.

If in January 2026 you paid the plusvalía using the coefficients of the repealed decree and it worked out more expensive, there may be scope to claim back what you overpaid. In that case, have a professional review your self-assessment and don't let the correction deadlines pass.

IRPF when selling a home: how the capital gain is calculated

For IRPF, what is taxed is the capital gain, which is the difference between the transfer value and the acquisition value, according to article 35 of the IRPF Act. It isn't calculated on the sale price, but on the net profit. That's why it's so important to keep the invoices for the purchase, the renovations and the sale.

The acquisition value is the price you paid plus any investments and improvements you've made and the costs and taxes of the purchase that you paid, excluding mortgage interest. If the flat has been let, the corresponding depreciation for those years must be deducted. The transfer value is the sale price minus the costs and taxes of the sale paid by the seller; if the declared price were lower than the normal market value, the latter would prevail.

  • Added to the acquisition value: the tax you paid when buying (transfer tax, or VAT and stamp duty), notary, registry, gestoría (paperwork agency) and, where applicable, the commission on the purchase.
  • Improvements are also added: works that increase the value or useful life, such as a kitchen or bathroom renovation. Repairs and ordinary maintenance don't count.
  • Deducted from the transfer value: the plusvalía municipal you pay as seller, intermediary or lawyer fees for the sale and other costs inherent to the sale paid by you.
  • Deducted from the acquisition value: depreciation if the property was let.
  • Not counted: mortgage interest, IBI and community fees for the years you were the owner.

If the home belongs to several owners, each declares only their share. The Agencia Tributaria itself, in its data form for declaring property transfers, asks for only the share corresponding to each owner, together with the cadastral reference, dates, amounts and costs.

IRPF savings income bands in 2026

The gain from selling a property is included in the savings tax base, which has its own scale. With effect from 1 January 2025, articles 66 and 76 of the IRPF Act were amended, and the scale now reaches 30% for the part of the base exceeding €300,000. The scale has equal national and regional parts, and together they give the rates shown in the table.

Savings tax baseNational rateRegional rateTotal rate
Up to €6,0009.5%9.5%19%
€6,000 to €50,00010.5%10.5%21%
€50,000 to €200,00011.5%11.5%23%
€200,000 to €300,00013.5%13.5%27%
Over €300,00015%15%30%

Source: Agencia Tributaria, 2025 tax return Practical Manual and Help Manual (national and regional scales for the savings tax base). They apply to 2026 sales unless a later rule changes them.

The rates are progressive by band: 23% is not applied to the whole gain, but 19% to the first €6,000, 21% to the next €44,000 and so on. If you have other capital gains or losses in the same year, they are offset against each other before the scale is applied.

IRPF exemptions when selling: over-65s, reinvestment and dación en pago

The IRPF Act provides for several cases in which the gain on the sale is not taxed, wholly or partly. They are among the few legal tools for reducing the bill, and it's worth understanding their requirements well before signing, because a detail about dates can mean losing them.

  • Over-65s: the gain on selling their habitual home is exempt (article 33.4.b of the IRPF Act). A habitual home is one that is so at the time of sale or was so up to any day in the previous two years, and in general you must have lived there for at least three consecutive years.
  • Reinvestment in a habitual home: if you sell your habitual home and reinvest the amount obtained in another habitual home, the gain is exempt (article 38.1). The reinvestment period is two years, before or after the sale. If you reinvest only part, the exemption is proportional, and if there was a mortgage, the amount obtained is taken after deducting the outstanding capital that is paid off.
  • Dación en pago of the habitual home: the gain is exempt when the debtor or their guarantor hands the habitual home over to the bank to cancel the mortgage, or loses it through foreclosure, if they don't have other sufficient assets to pay the debt (article 33.4.d).
  • Sale to public housing bodies: Royal Decree-law 29/2026 adds a temporary exemption, between 8 October 2026 and 31 December 2027, for sales under €800,000 of homes left empty without justified cause during the previous two years. It is total up to €200,000 and decreasing up to €800,000, and depends on the decree being ratified.

There's a special case that often goes unnoticed: properties bought before 31 December 1994. For these there are the so-called coeficientes de abatimiento (reduction coefficients, ninth transitional provision of the IRPF Act), which reduce the part of the gain generated up to 19 January 2006. For property, the reduction is 11.11% for each year of ownership exceeding two, counted up to 31 December 1996.

This means that a flat bought before 1987 can have the part of the gain prior to 2006, calculated in proportion to the days of ownership, reduced by 100%. The benefit has a cumulative limit of €400,000 of transfer value per taxpayer across all the sales to which it is applied. The Agencia Tributaria includes a worked example of this calculation in its 2025 tax return manual.

Non-resident sellers: the 3% withholding and form 210

If the seller is not tax resident in Spain, the gain is taxed under the non-resident income tax at a flat rate of 19%. In addition, the buyer, whether resident or not, must withhold 3% of the agreed price and pay it to the tax authorities using form 211 within one month of the sale. They must give a copy to the seller so that they can offset it.

The seller then files form 210, calculates the actual tax on their gain and subtracts the 3% already withheld. If the withholding is higher than the tax, they can claim a refund of the difference. Residents of the European Union or the European Economic Area can also apply the exemption for reinvestment in a habitual home.

There's another particularity with the plusvalía municipal: when the seller isn't resident in Spain, the buyer acts as the taxpayer's substitute and is the one who must pay it to the City Council. In practice, the parties usually deduct it from the price at the notary's office, so it's worth agreeing this clearly in the arras (deposit contract).

Full example: how much a seller pays on a flat in Madrid in 2026

Let's look at a fictional but realistic case. An owner resident in Madrid, aged 50, bought a flat in March 2014 for €250,000 and paid €17,000 in purchase costs, including tax, notary, registry and gestoría. In 2019 they renovated the kitchen and bathroom for €12,000, with an invoice. They sell in October 2026 for €420,000, with intermediary fees of 3% plus VAT and another €800 in sale costs.

The flat's total cadastral value is €190,000, of which €95,000 corresponds to the land, that is, 50%. They have owned the home for 12 full years. They have no other gains or losses in the year, and the flat is not their habitual home, or it is but they won't be reinvesting.

ItemCalculationAmount
Plusvalía, objective method€95,000 × 0.09 (12 years) = €8,550 × 29%€2,479.50
Plusvalía, real method(420,000 − 250,000) × 50% = €85,000 × 29%€24,650.00
Plusvalía payableThe more favourable method applies€2,479.50
Intermediary fees420,000 × 3% = €12,600 + 21% VAT€15,246.00
Transfer value420,000 − 15,246 − 800 − 2,479.50€401,474.50
Acquisition value250,000 + 17,000 + 12,000€279,000.00
Capital gain401,474.50 − 279,000€122,474.50
IRPF: first band6,000 × 19%€1,140.00
IRPF: second band44,000 × 21%€9,240.00
IRPF: third band72,474.50 × 23%€16,669.14
Total IRPFSum of bands (22.1% of the gain)€27,049.14
Total taxes on the salePlusvalía + IRPF€29,528.64

Indicative example prepared by Llavely using the current coefficient table (RDL 8/2023), Madrid's 29% rate and the Agencia Tributaria's savings scale. It doesn't include other income, personal allowances or individual circumstances.

Now let's change some circumstances. If the deed were signed after 1 December 2026, the decree were ratified and the City Council applied the new maximum, the 12-year coefficient would go from 0.09 to 0.14 and the plusvalía would rise to €3,857, about €1,377 more. As the plusvalía is deducted for IRPF, part of that increase would be offset by slightly less income tax.

  • If the seller were 65 or over and the flat were their habitual home, the gain would be exempt: they would pay €0 in IRPF, but would still pay the €2,479.50 of plusvalía municipal.
  • If it were their habitual home and they reinvested the €420,000 in another habitual home within two years, they would also be exempt from IRPF. If they reinvested only half, half of the gain would be exempt.
  • If they lived outside Spain, the buyer would withhold €12,600 (3%). Their tax would be 19% of the gain, €23,270.16, and they would have €10,670.16 left to pay with form 210.
  • If they hadn't kept the renovation invoice, the gain would rise by €12,000 and they would pay €2,760 more in IRPF.

Deadlines for paying the plusvalía and IRPF

Each tax has its own calendar and filing method. In Madrid, the plusvalía is a self-assessment: the seller calculates and files it themselves, online on the Agencia Tributaria Madrid portal or by appointment at a taxpayer service office. Filing late means surcharges.

TaxWho files itDeadlineHow
Plusvalía municipal (sale)Seller; buyer if the seller is non-resident30 working days from the deedSelf-assessment on the Agencia Tributaria Madrid portal
Plusvalía municipal (inheritance)Heirs6 months from the death, extendable by another 6Self-assessment
IRPF (residents)SellerTax return for the following year; a 2026 sale is declared in 2027Annual income tax return
3% withholding (non-residents)Buyer1 month from the saleForm 211
Non-resident income taxNon-resident sellerAfter the withholding is paid, within the period set by the tax authoritiesForm 210

Sources: Agencia Tributaria (non-residents manual); guides published in 2026 on the plusvalía in Madrid (urbanismoyarquitectura.com, tuinmueble.net).

A practical tip: although IRPF isn't paid until the spring of the following year, the money from the sale arrives on the signing day. Set aside what you'll owe the tax authorities from that moment, especially if you're going to use the proceeds for a deposit on another home or to pay off debts.

Common mistakes that make the sale more expensive

Many tax surprises don't come from the law but from how the sale is prepared. In the industry it's still common to set the price thinking only about the commission and what the market will bear, leaving taxes until after the signing. The result is a seller who discovers months later that their net profit was considerably smaller than they thought.

  1. Setting the price without first calculating the plusvalía and IRPF. In the example above, almost €30,000 of tax on a €420,000 price changes the negotiation considerably.
  2. Not keeping invoices for the purchase and renovations. Without proof, the tax authorities may not accept those amounts and the gain goes up.
  3. Not checking the signing date. In 2026 a change of a few weeks can alter the plusvalía coefficient; and for habitual home exemptions, the two- and three-year periods are strict.
  4. Forgetting the plusvalía when selling at a loss. Nothing is payable, but it must be declared and the absence of an increase proven.
  5. Not agreeing in the arras who pays what. If the seller is non-resident or there's a mortgage to cancel, it's best to put it in writing to avoid arguments at the notary's office.

For the other steps of the sale, from the paperwork to the notary, you can read our guide “How to sell a flat in Madrid in 2026”. And if you want to see how demand and prices are evolving, there's “The home sales market in 2026”.

How we do it at Llavely

With “Venta Llavely” (our Llavely Sale service) you pay 2.5% + VAT, only if you sell and on the day of the notary signing, all inclusive and done by us: valuation, photos, screened and verified buyers, viewings, offers and the arras. No extra payments or hidden costs: what you see is what you get.

If what this article explains is exactly what worries you, at Llavely you have specialised lawyers with more than 35 years of experience, from start to finish and included in that 2.5% + VAT. Before setting the price, they calculate the plusvalía municipal and IRPF for your case with you, so you know how much you'll really keep. They also review charges and the nota simple (land registry extract), draft the arras, prepare the deed and come with you in person to the notary on signing day.

If you'd rather handle the tax side with your own adviser, you can do that too: the rest of “Venta Llavely” stays the same, with valuation, screened buyers, viewings, offers and the arras, anti-money-laundering checks, coordination with the notary and your private seller portal to follow everything. Either way, what we don't want is for anyone to discover their taxes after signing.

Frequently asked questions

How much tax do you pay when selling a flat in Madrid?

It depends on the gain and how many years you've owned the flat. The seller pays the plusvalía municipal, at 29% on a base that under the objective method is usually small, and IRPF on the gain, at rates from 19% to 30%. For a flat bought for €250,000 and sold for €420,000 after 12 years, the total comes to around €29,500.

Who pays the plusvalía municipal, the buyer or the seller?

In a sale, the seller pays it, because they are the one who obtains the increase in value. The exception is when the seller isn't resident in Spain: the buyer then acts as substitute and pays it to the City Council, usually deducting it from the price.

Do you pay plusvalía municipal if you sell at a loss?

No. If the sale value is lower than the purchase value according to the deeds, there is no increase in value and nothing is payable. Even so, you must file the declaration within the deadline and prove the loss with the purchase and sale deeds.

When is IRPF paid on the sale of a flat?

It is declared in the tax return for the year following the sale. If you sell in 2026, you'll include it in the return filed in 2027. It's wise to set the money aside from the signing day.

Do people over 65 pay tax when selling their home?

If they sell their habitual home, the gain is exempt from IRPF. They do pay the plusvalía municipal, because that exemption doesn't exist for the local tax. If they sell a second home, they are taxed like any other taxpayer.

What costs can I deduct from the capital gain?

You can add to the purchase value the taxes and the notary, registry and gestoría costs of the purchase, as well as improvements with invoices. From the sale price you can deduct the plusvalía municipal, intermediary or lawyer fees and other sale costs you pay. Mortgage interest cannot be deducted.

What is the 3% withholding when selling if I don't live in Spain?

It's a payment on account that the buyer makes to the tax authorities using form 211 in the month following the sale. The seller then files form 210, calculates their tax at 19% of the gain and deducts that 3%. If too much was withheld, they can claim a refund.

Does the plusvalía municipal change in December 2026?

Royal Decree-law 29/2026 provides for new maximum coefficients from 1 December 2026: they rise for ownership of up to 16 years and fall from 17 years onwards. They will only apply if the Diputación Permanente ratifies the decree, and their effect in each municipality depends on its bylaw.

Do I have to reinvest all the money to avoid paying IRPF?

For the whole gain to be exempt, you must reinvest the total amount obtained in another habitual home within two years. If there was a mortgage, the outstanding capital paid off is deducted. If you reinvest only part, the exemption is proportional.

How do I know which plusvalía method suits me?

Calculate both: the objective method multiplies the cadastral value of the land by the coefficient for your years of ownership, and the real method applies the land percentage to the gain shown in the deeds. The Ayuntamiento de Madrid's self-assessment calculates both and applies the more favourable one if you enter the purchase and sale values.

Sources

  1. Real Decreto-ley 29/2026, de 6 de octubre, on urgent measures for the social function of housing, consolidated text (BOE, Official State Gazette, 7 October 2026)
  2. Article 107 of the consolidated Ley Reguladora de las Haciendas Locales (Local Finances Act), current version (Iberley, 8 October 2026)
  3. New housing tax measures in Royal Decree-law 29/2026 (Iberley, October 2026)
  4. Tax measures introduced by Royal Decree-law 29/2026 (Agencia Tributaria, Spanish Tax Agency, 7 October 2026)
  5. How the plusvalía municipal rose for 27 days in 2026 (OCU, 27 January 2026)
  6. Ayuntamiento de Pozuelo de Alarcón: IIVTNU coefficients applicable from 28 January 2026 (BOCM no. 39, 16 February 2026)
  7. Coefficients for determining the IIVTNU tax base in force from 1 January 2024 (Ayuntamiento de Ponferrada)
  8. Taxation of the savings tax base, 2025 tax return Help Manual (Agencia Tributaria)
  9. Tax calculation: main changes, 2025 tax return Practical Manual (Agencia Tributaria)
  10. Capital gains and losses: worked example, 2025 tax return Practical Manual (Agencia Tributaria)
  11. Data form for property transfers, 2025 tax return (Agencia Tributaria)
  12. Capital gains from the sale of property, Non-residents Taxation Manual (Agencia Tributaria)
  13. Plusvalía municipal in Madrid: how and where to pay, deadlines and calculation in 2026 (urbanismoyarquitectura.com, updated 5 October 2026)
  14. Plusvalía Madrid 2026: how much you pay (guiafiscal.es, updated 22 August 2026)
  15. Plusvalía municipal in Madrid 2026: calculation, table and exemptions (tuinmueble.net, updated 4 October 2026)
  16. Plusvalía municipal: what it is and how much the coefficients could rise in 2026 (Bankinter, 12 January 2026)

Sell to people who can already buy.

Listing is free. 2.5% + VAT only if you sell, no hidden costs.