WhatsApp and email answered by the lawyer himself.Book a call

Gain calculation · Costs · May 2026

Deductible Expenses on the Sale of the Main Residence (IRPF 2026)

The capital gain generated by the sale of your home is not simply the difference between the selling price and the purchase price. The Spanish IRPF personal income tax law allows you to add to the purchase cost all the expenses incurred when acquiring the property, and to subtract from the selling price all the expenses incurred when transferring it. The result can be a significantly lower gain — or even a loss — with the corresponding tax saving. Knowing which expenses are deductible and which are not is essential to correctly calculate the basis of the reinvestment exemption.

By Jacob Salama, Main Home Reinvestment Lawyer · Málaga Bar 11.294Updated 8 May 20268 min read
Jacob Salama, international tax lawyer, in his office

1. The capital gain formula (art. 35 IRPF Law)

Article 35 of IRPF Law 35/2006 sets out how the transfer value and acquisition value of assets are calculated. The capital gain is the positive difference between the two:

Capital Gain = Transfer Value − Acquisition Value
Transfer Value = Selling price − Sale costs and taxes
Acquisition Value = Purchase price + Purchase costs and taxes + Investments and improvements

The taxpayer's goal is for the Transfer Value to be as low as possible (subtracting all sale costs) and the Acquisition Value to be as high as possible (adding all purchase costs and improvements). Both quantities reduce the capital gain and, therefore, the IRPF payable (selling costs also reduce the amount to be reinvested).

2. The increased acquisition value

The acquisition value is not just the price set out in the original deed of sale. It also includes the costs and taxes paid by the buyer on the purchase, and the investments and improvements carried out on the property during the holding period.

Acquisition Value = Purchase price + Inherent acquisition costs + Investments and improvements − Depreciation (if the property was let)

3. Deductible purchase costs (which increase the acquisition value)

3.1. ITP/AJD or VAT paid on purchase

If you bought a second-hand property, you paid Transfer Tax (ITP). If you bought a new-build, you paid VAT + Stamp Duty (AJD). Either of these taxes is deductible by increasing the acquisition value. They are usually the most significant costs: ITP has a different rate in each autonomous community.

3.2. Notary fees on the purchase deed

Notarial fees paid by the buyer (typically the party who pays the purchase deed in Spain) are deductible. This includes notary fees as well as gestor (administrative agent) fees if one was used to handle the procedures.

3.3. Land Registry fees

Land Registry fees paid to register the property are deductible as an inherent acquisition cost.

3.4. Estate agency commission on purchase

If you paid fees to an estate agent when buying the property, they are deductible. In practice, in Spain the seller usually pays the agent's commission, but in some cases the buyer also pays a share. If you have the invoice and it is clearly a purchase cost, it is deductible.

3.5. Valuation costs

The valuation is a cost of the loan.

3.6. Cancellation of pre-existing charges assumed

If you took over the seller's mortgage when buying, the purchase price already includes that debt; it is not added again.

Practical tip
Keep all invoices and receipts for purchase costs, however long ago. The limitation period is 4 years from the end of the filing period of the return declaring the gain, but to evidence the acquisition value you may need to prove costs from 15 or 20 years ago.

4. Improvements vs. repairs: the key distinction

Improvements made to the property during the holding period increase the acquisition value and therefore reduce the capital gain. However, repairs and maintenance expenses are not deductible. The distinction is essential and frequently generates disputes with the AEAT.

4.1. What is an improvement?

An improvement is an investment that increases the useful life of the property, its quality or its market value on a permanent basis. Examples of deductible improvements:

  • Installation of a lift where there was none
  • Comprehensive kitchen or bathroom refurbishment (full replacement, not item-by-item substitution)
  • Extension of the built area
  • Installation of aerothermal, geothermal or integrated photovoltaic panels
  • Replacement of external joinery (windows) for energy efficiency
  • Installation of underfloor heating
  • Structural consolidation works

4.2. What is repair or maintenance? (Not deductible)

Repairs restore the property to its original condition without improving its characteristics. They are not deductible as an increase in acquisition value. Examples:

  • Painting walls
  • Fixing leaks or damp
  • Replacing appliances
  • Pipe or electrical repairs without an upgrade
  • Replacing broken tiles
  • Door or window repair without full replacement
Grey area: kitchen or bathroom refurbishment
A comprehensive kitchen or bathroom refurbishment (removal of tiling, complete new installation) is treated as an improvement. Simply replacing a worktop or changing taps is a repair. The key is the scale of the works and whether there is a builder's invoice documenting them as a refurbishment.

4.3. Attribution of improvements when the property was let

If the property was let at any point and depreciation was applied (deduction within real-estate income), this depreciation reduces the acquisition value. Likewise, improvement costs already deducted as letting expenses cannot be added again to the acquisition value (no double benefit).

5. The reduced transfer value

The transfer value is the actual amount of the transfer (the price in the deed), but reduced by the costs and taxes inherent to the transfer paid by the transferor. All sale costs borne by the seller reduce the capital gain.

6. Deductible sale costs (which reduce the transfer value)

6.1. Estate agency commission

This is usually the largest sale cost. In Spain, the estate agency commission ranges between 3% and 6% of the selling price and is paid by the seller. This commission is fully deductible from the transfer value. The agency invoice is essential.

6.2. Notary fees on the sale deed

The seller does not normally pay the sale deed (the buyer does), but there may be notarial costs related to the sale: powers of attorney, notarial cancellations, etc. If they are paid by the seller, they are deductible.

6.3. Municipal capital gains tax (IIVTNU)

The Tax on the Increase in Value of Urban Land (municipal capital gains tax), paid by the seller, is deductible as a transfer cost. This tax can be significant on long-held properties or in municipalities with high cadastral values. Keep the payment receipt or the self-assessment filed.

6.4. Registry cancellation of charges (mortgages)

The notary and registry fees for the formal cancellation of the mortgage at the Land Registry are deductible. Note: this is not the early repayment of the loan, but the cost of the cancellation deed and its registration.

6.5. Energy performance certificate

The cost of the energy performance certificate that the seller is required to obtain for the sale is deductible as an inherent transfer cost.

6.6. IBI and community fees: not selling costs

IBI and community fees are not inherent in the sale: they are ownership costs and do not reduce the transfer value. The DGT only treats as inherent the costs directly related to the purchase or sale (V1177-20, V2533-14).

6.7. Lawyer or adviser fees

Lawyer fees directly related to the sale (contract review, negotiation, processing) are deductible if there is an invoice supporting them as transfer costs.

7. Mortgage cancellation: what is deductible and what is not?

This point causes a lot of confusion. When selling a property with an outstanding mortgage, several payments are usually made:

Item Deductible? Reason
Outstanding principal repaid out of the sale proceeds No It is not a cost; it is repayment of the loan received
Bank early-repayment fee Debatable It is a cost of the loan. What the DGT recognises are the registry costs of cancellation (V1177-20)
Notary fees on the cancellation deed Yes Inherent transfer cost (needed to sell free of encumbrances)
Registry fees for the mortgage cancellation Yes Inherent transfer cost

8. Worked example

Worked example data:

Purchase in 2010: €180,000
ITP paid (8%): €14,400
Notary + Registry on purchase: €1,800
Kitchen and bathroom refurbishment (2018): €22,000
Total acquisition value: €218,200

Selling price 2026: €420,000
Agency commission (4%): −€16,800
Municipal capital gains tax: −€4,200
Energy certificate: −€350
Mortgage cancellation at the registry (notary + registry): −€1,100
Transfer value: €397,550

Capital gain: 397,550 − 218,200 = €179,350
(vs. €240,000 without computing costs — a difference of €60,650)

If you reinvest €397,550 (the transfer value, less any outstanding principal of the purchase loan), the exemption is full. If you reinvest less, the exemption is proportional.

But if they had calculated the gain without including the costs (simply 420,000 − 180,000 = €240,000), they would pay more tax on the part not reinvested; and without deducting the selling costs they would think they must reinvest €420,000 instead of €397,550. Computing the costs always reduces the tax burden.

9. Common mistakes that cost money

Mistake 1: not including ITP on the purchase in the acquisition value

This is the most expensive mistake. An ITP of 8% on a price of €200,000 is €16,000 that is not included in the acquisition value, artificially increasing the gain by that amount.

Mistake 2: confusing mortgage capital repayment with a deductible expense

The loan principal you repay is not a selling cost. The registry cancellation of the mortgage is (DGT V1177-20).

Mistake 3: forgetting the municipal capital gains tax

Many taxpayers file the return without including the municipal capital gains tax because they pay it months after signing the deed. Only tax actually paid can be deducted (art. 35.2 LIRPF): if you pay it after filing, the return must be amended.

Mistake 4: deducting the VAT on works twice

The VAT on improvement works forms part of the cost of the improvement and is deductible. However, if the property generated real-estate income and the VAT was deducted in that activity (business VAT), it cannot be deducted again in the capital gain.

Mistake 5: not separating refurbishment from maintenance on the same invoice

Some builder invoices mix improvement works (deductible) and maintenance work (non-deductible). In such cases, it is advisable to ask the contractor for a breakdown to evidence which part of the cost is an improvement.

10. Documentation required to evidence the costs

In the event of an AEAT review, the taxpayer must be able to prove each cost included in the calculation. Documents to keep:

  • Original deed of sale: purchase price and notary/registry costs
  • ITP payment receipt or VAT+AJD self-assessment: taxes on the purchase
  • Invoices for refurbishments and improvements describing the works carried out and the contractor's NIF (tax ID)
  • Sale deed or sale contract: transfer price
  • Estate agency invoice
  • Municipal capital gains tax self-assessment (Form 080 or similar of the town hall)
  • Energy performance certificate invoice
  • Mortgage cancellation deed and fee receipt
  • Bank invoice for the early-repayment fee

Want to compute your real capital gain?

At SALAMA LEGAL SLP we calculate the acquisition and transfer value correctly, including all deductible costs to minimise your tax burden.

Tell us your case

Statutory references

Costs that lower your gain when you sell

Which purchase costs increase the acquisition value of my Spanish home?

ITP on a resale home, or VAT and AJD on a new build, plus notary, gestor and Land Registry fees, and an agent's fee if you paid one. You need to prove each one, so keep the original deed, tax receipts and invoices however old they are.

Can I deduct the estate agent's commission when I sell?

Yes, the part you pay as seller reduces the transfer value and therefore the gain. In Spain it usually ranges between 3% and 6% of the price and is often the largest sale cost. The agency invoice is essential.

Do repainting and fixing leaks reduce my capital gain?

No. They are repairs that return the home to its original condition. Improvements such as installing a lift where there was none or extending the built area do increase the acquisition value. If an invoice mixes both kinds of work, ask the contractor for a breakdown.

I deducted some works as letting expenses. Can I use them again when I sell?

No. Improvement costs already deducted against rental income cannot be added again to the acquisition value, because that would be a double benefit. Depreciation applied while the home was let also reduces the acquisition value.

Jacob Salama

Jacob Salama

Main Home Reinvestment Lawyer · Málaga Bar 11.294

Member of the Málaga Bar (no. 11.294) and managing partner of SALAMA LEGAL, S.L.P. He advises individuals on Spanish income tax and cross-border taxation and reviews the content of this website himself.

About the lawyer (ES) · Book a call

A note on sources. Some references on this page (rulings, decisions or draft rules) could not be checked against their official text. Please confirm them before making a decision.

Last reviewed: 8 May 2026. General information on Spanish law in force; it does not replace advice on your specific case.

Further reading

Talk to the lawyer

Before you sign the sale, let a lawyer check your exemption

One wrong date or figure can cost you the whole exemption. We review your case and tell you how much you can save.

Book a callWhatsAppContact form
Book a callWhatsApp