Selling Your Property in Spain as a Resident: How Is Your Capital Gain (Ganancia Patrimonial) Taxed?

Table of Contents

Are you a tax resident in Spain and have decided to sell your property? If you’ve made a capital gain between the purchase and the sale—which we hope you have—the Spanish tax authorities will tax that amount. The experts at Terreta Spain explain how this tax is calculated, how to minimize it, and how to report your “capital gain.” 

Note that the capital gain realized between the purchase and resale of your apartment is called “ganancia patrimonial” and not “plusvalía” (IIVTNU), which refers to the increase in the value of the land on which your property is built—a gain on which you will also be taxed, but at a lower rate. 

For an overview of what to expect if you’ve decided to sell your property, check out our comprehensive guide to selling in Spain. And if you don’t feel like reading the whole thing, the handy guide “Selling Your Property in Spain”covers the essentials. 

In a nutshell – You’re in a hurry but want to understand?
As a tax resident, your capital gains on real estate (“ganancia patrimonial”) are taxed through the IRPF (income tax for Spanish tax residents), at a rate of 19–26% depending on the amount.It is calculated based on the sale price, minus the purchase price and costs, improvement work with invoices, and selling expenses (notary, real estate agency, certificates).If you sell your primary residence and reinvest in a new primary residence within the specified timeframe, you may qualify for a full or partial exemption. Do not confuse “ganancia patrimonial” with “plusvalía municipal,” a local tax on the increase in land value that must be paid directly to the city hall after the sale.

Calculating capital gains on real estate in Spain: Are you a tax resident in Spain?

This is the starting point for determining how your capital gains will be taxed. You are generally considered a tax resident if:

  • You spend more than 183 days a year in Spain.
  • Or if your economic and family interests are based in Spain.

In this case, the capital gain from the sale is taxed as part of your annual personal income tax return. IRPF stands for Impuesto sobre la Renta de las Personas Físicas. To learn more about this tax, check out our guide:“Personal Income Tax.” 

Terreta Tip: Click here to access an income tax simulator (originally called “simulador de ganancias patrimoniales”) if you are a Spanish tax resident.

First and foremost: Makesure you are already filing your income tax return with the Spanish tax authorities (IRPF) and that you are properly registered as a resident. If you have any doubts, we recommend that you consult a tax advisor or a lawyer before putting the property up for sale.

How is your capital gain calculated: a concrete example

For a resident, the taxable capital gain is calculated as follows:

Net profit = selling price – (purchase price & costs + renovations/improvements) – selling expenses.

You may include the following in the purchase price:

  • The purchase price stated in the escritura (notarized deed).
  • Taxes paid at the time of purchase: ITP or VAT + AJD. For more information on these taxes, please refer to our“Terreta Spain Guide to Real Estate in Spain.”
  • Notary fees and registration fees at the time of purchase.
  • Attorney or administrative agency fees directly related to the purchase.

You may deduct the following as selling expenses:

  • The real estate agency's commission (often 3% of the sale price, excluding tax).
  • The seller is responsible for the notary fees.
  • The Energy Performance Certificate (EPC) and other mandatory certificates. Read our fact sheet on the EPC to learn more.

A very concrete example with figures

A typical scenario for a resident of Valencia:

  • 2015: Purchase of an apartment for €130,000.
  • Purchase fees and taxes (ITP, notary, registry, administrative agency): €11,000.
  • Renovation work (kitchen, bathroom, and windows), with receipts: €15,000.

Acquisition cost used:

  • 130,000 + 11,000 + 15,000 = €156,000.

In 2026, you will sell:

  • Listing price: €195,000.
  • Agency fee: €8,000.

Calculation of capital gains:

  • 195,000 – 156,000 – 8,000 = €31,000 in taxable capital gains.
What to do: Before you even post the listing, gather all the invoices related to the purchase of your property in Spain. Also gather the invoices for any “structural” renovations (see next section) that you’ve carried out on the property.

What types of improvements and expenses are actually taken into account when calculating capital gains in Spain (ganancia patrimonial)?

Be wary and don’t turn a blind eye: in practice, the Spanish government distinguishes between expenditures that increase the value and lifespan of the property (investments/improvements) and simple maintenance or cosmetic work (painting, minor repairs), which are not always taken into account.

Expenses that are often cited as improvements include:

  • Complete renovation of the kitchen and bathrooms.
  • Complete replacement of windows (double-pane glass, improved insulation).
  • Upgrading electrical or plumbing systems to meet current standards.
  • Installation of a central heating and air conditioning system.

Practical tip from Terreta Spain: When preparing for your sale, organize your invoices into two columns:

  • Deductible improvements (which increase the purchase price).
  • Routine maintenance (less tax-efficient).

Bonus: At Terreta Spain, we assist all homeowners with renovating their properties in Spain, including helping them increase their property’s value for resale and maximize capital gains. Check out our guide to home renovation. And if you’d like to discuss this with one of our experts, click here

Tax rates: How are capital gains on real estate taxed in Spain? 

As we mentioned, capital gains on real estate are taxed as part of personal income tax for residents.

In 2026, the following tax brackets will apply:Up to €6,000: 19%.
From €6,000 to €50,000: 21%.
From €50,000 to €200,000: 23%.
Over €200,000: 26% 

Avoid: signing an offer without first running at least a rough simulation with a tax advisor, especially if your capital gain is significant or if you are selling multiple properties.

Tax exemption: You are selling your primary residence to buy another one

In Spain, if you sell your primary residence (vivienda habitual) and reinvest the proceeds from the sale in a new primary residence within two years, the capital gain may be fully or partially exempt from tax, subject to certain conditions.

To qualify for the exemption from capital gains tax on real estate, you must meet these requirements. 

  • The property being sold must be your primary residence (you must have actually lived there, generally for at least three years, except in special cases).
  • You must reinvest the proceeds from the sale in the purchase or renovation of another primary residence within a specified period (in practice, within two years before or after the sale).
  • The exemption is proportional: if you reinvest only a portion of the capital gain, only that portion is exempt.

Advice from Terreta Spain: This plan is very effective, but it’s very strict. Don’t jump in headfirst—do the math first. 

  • Talk to your advisor before signing the sales contract to finalize the timeline for the new purchase.
  • Ask them to tell you which documents to keep as proof of reinvestment (title deeds, bank statements, invoices for construction work). 

The experts at Terreta Spain will guide you through the entire process of selling your property in Spain

Do not confuse capital gains with municipal capital gains tax

As we mentioned at the beginning of this guide on capital gains in Spain, when you sell a property, two different rules and two types of taxes apply:

  • Capital gains: tax on your actual capital gains, through your income tax return.
  • Municipal capital gains tax: a municipal tax calculated based on the assessed value of the property and the length of ownership. 

You may well have a small (or no) capital gain yet still have to pay municipal capital gains tax, or sell at virtually “break-even,” but find that the city calculates capital gains tax based on a theoretical increase in the land’s value.

Terreta Spain Field Guide:

  • Always request an estimate of the municipal capital gains tax from the city hall or through your notary or administrative agency before setting your net selling price.
  • In the event of a loss-making sale or a clearly disproportionate calculation, a tax attorney can explore the possibility of appealing the decision. 
In practice: Capital gains are reported as part of your income tax return using Form 100, page 15.
Capital gains tax must be paid directly at city hall within 30 days of the sale of your property.
Pay directly online via the Valencia City Hall website. For Madrid, click here
For Barcelona, capital gains tax can also be paid directly online via this link

If the property was rented out prior to the sale 

If your property was rented out, the tax authorities consider that the property has been depreciated for tax purposes during the years it was rented. When calculating the capital gain, you subtract this depreciation from your purchase price, which automatically increases the taxable capital gain.

Practical advice from Terreta Spain: Even if you’ve never considered depreciation, the Spanish tax authorities may automatically apply it based on your past rental income tax returns. If you have rented out your property (year-round or seasonally), it is crucial to consult with an advisor who specializes in rental taxation and property sales to ensure that the capital gains calculated by the tax authorities do not come as an unpleasant surprise.

Your handy checklist before accepting an offer

Before agreeing to a buyer’s offer, make sure you have:

  • Deed of purchase + any deed of division or extension.
  • Invoices for ITP or VAT + AJD, notary fees, registry fees, and administrative agency fees from that time.
  • Invoices for major renovations (kitchen, bathrooms, windows, installation of air conditioning/heating).
  • Invoice from the real estate agency (or at least an estimate of the commission if the contract has not yet been signed).
  • Latest property tax payments and certificate from the homeowners' association (confirming no outstanding debts).
  • A capital gains simulation conducted with your tax advisor, including the potential impact of past rental income and/or an exemption for a primary residence.

Avoid:

  • Accepting an offer just because the price is right, without considering the taxes that will come later.
  • Coming to the notary without a complete set of invoices. This will prevent you from arguing for a more favorable capital gains calculation.

Are you a resident of Valencia, Madrid, or elsewhere in Spain and thinking about selling your property? Discover Terreta Spain’s comprehensive support services: sales dossier, property enhancement (interior design, renovation), marketing, contracts, closing at the notary’s office, and tax advice. For a stress-free sale, talk to an expert

FAQ – Capital Gains: How Are Real Estate Capital Gains Taxed for Tax Residents in Spain?

How do I know if I'm a tax resident in Spain?

You are considered a resident if you spend more than 183 days a year in Spain or if you have economic or family ties there, in which case you will be taxed under the IRPF system.

What expenses and home improvements can I deduct?

Purchase price, property transfer tax (ITP)/VAT + stamp duty (AJD), notary fees, registration fees, attorney/administrative agency fees, real estate agency commission, and renovation costs with invoices (kitchen, bathrooms, windows, etc.).

How will my capital gains on real estate be taxed in 2026?

Income tax rates on capital gains: 19% on amounts up to €6,000, 21% on amounts from €6,000 to €50,000, 23% on amounts from €50,000 to €200,000, and 26% on amounts above that.

Can I be exempt from taxes if I sell my primary residence to buy another one?

Yes, if the property is your primary residence and you reinvest the proceeds in a new primary residence within the specified time frame, all or part of the capital gain may be exempt from tax.

What is the difference between capital gains and municipal capital gains tax?

Capital gains are reported on the income tax return (Form 100) based on the actual capital gain; the municipal capital gains tax is a tax levied by the city government based on the assessed value of the land.

What happens if the property has been rented out?

Depreciation claimed during the lease term reduces the purchase price and increases the taxable capital gain, which is why it’s a good idea to have an advisor review the calculation.

What documents should you gather before accepting an offer?

Deeds, ITP/VAT and stamp duty invoices, notary fees, registry fees, renovation costs, real estate agent’s commission, recent property tax bills, certificate of co-ownership, and capital gains estimate.

Who can help me maximize my capital gains?

A specialized agency, a tax advisor, and, if necessary, a lawyer. But the best option is to contact Terreta Spain—we’ll coordinate everything to ensure a smooth sale and handle the tax matters.

Back to top