Capital gains tax in Spain isn’t a separate tax. If you’re a Spanish tax resident, your gains are taxed under Personal Income Tax (IRPF) at rates from 19% to 30%. If you’re not, you pay a flat 19% under Non-Resident Income Tax (IRNR). What people call “capital gains tax” is simply the part of your Spanish return that taxes the profit from selling a home, shares, or an investment fund.
The detail that changes everything is your tax residency. It decides whether Spain taxes only what you sell in Spain or also what you sell back home, which rate applies, and which exemptions you can use. It also pays to work with the current numbers. Many search results and AI assistants still quote 26% or 28% as the top rate, but gains above €300,000 have been taxed at 30% since 2025.
In this guide, you’ll see what counts as a capital gain and how it’s calculated, with a worked example. You’ll also learn when a gain is exempt, what changes for non-residents and under the Beckham Law, how Spain’s exit tax works, and which mistakes make the bill bigger.
In 30 Seconds
- Not a separate tax: capital gains tax in Spain is part of IRPF for residents and of IRNR for non-residents.
- Residents: gains from selling assets go to savings income, taxed at 19% to 30%, and gains anywhere in the world count.
- Non-residents: a flat 19% on Spanish gains, and when you sell real estate, the buyer withholds 3% of the price.
- Before you sell: the main home exemptions, the year’s losses, and the timing of the sale can change what you owe.
What Is Capital Gains Tax in Spain (and What It Isn’t)
A capital gain (ganancia patrimonial) is an increase in the value of your assets that shows up when their makeup changes. It usually arises when you sell, swap, or gift something for more than it cost you. It’s calculated by subtracting the acquisition value from the transfer value, and it’s taxed under IRPF, as Article 33 of Law 35/2006 sets out.
Here’s what it isn’t. It isn’t the plusvalía municipal, a local tax the town hall charges on the increase in value of urban land, which you pay separately. Dividends and interest aren’t capital gains either: they’re investment income, even though they’re taxed in the same savings bracket. And inheriting doesn’t create a gain under IRPF, because inheritance tax covers it; the law doesn’t see a gain for the person who dies, either.
One point for anyone paid in equity: exercising stock options is employment income. Only what you make when you later sell those shares is a capital gain.
How Capital Gains Are Taxed in Spain: Rates From 19% to 30%
Capital gains from selling an asset are taxed as savings income under IRPF, with five brackets running from 19% to 30%.
Spanish law splits gains into two groups. Gains that arise when you transfer an asset (selling an apartment, shares, a fund, or crypto) go to the savings income base. Gains that don’t come from a sale, such as prizes or many government grants, go to the general income base. There, they’re added to your salary or pension and taxed at your marginal rate.
How Much Is Capital Gains Tax in Spain?
It depends on your total savings income for the year, not on each sale separately. The scale is progressive, so each bracket pays its own rate. That’s what Law 35/2006 on Personal Income Tax provides, as amended by Law 7/2024 effective January 1, 2025.
| Savings income | Bracket rate | Tax accumulated at the start of the bracket |
|---|---|---|
| Up to €6,000 | 19% | €0 |
| €6,000 to €50,000 | 21% | €1,140 |
| €50,000 to €200,000 | 23% | €10,380 |
| €200,000 to €300,000 | 27% | €44,880 |
| Over €300,000 | 30% | €71,880 |
A note on Spain’s regions: the scale combines a national share and a regional share, but the capital gains tax rate in Spain is the same everywhere. The exceptions are the Basque Country and Navarre, which apply their own regional tax rules. And if a website lists 28% as the top rate, it’s the old scale: the bracket above €300,000 rose to 30% in 2025.
How to Calculate Capital Gains Tax in Spain Step by Step
To calculate the gain, subtract the acquisition value, including purchase costs and improvements, from the transfer value, net of the costs of selling.
- Start with the sale price and subtract the costs and taxes you paid as the seller, such as the real estate agent’s commission or the plusvalía municipal. That’s the transfer value.
- Add up what the asset cost you: the price, the purchase costs and taxes (notary, land registry, transfer tax or VAT), and any improvements you can document. Mortgage interest doesn’t count.
- Subtract depreciation if you rented it out. Watch out here: the Spanish Tax Agency deducts at least the minimum depreciation that applied, even if you never claimed it.
- Find the difference between the two values. If it’s positive, you have a gain; if it’s negative, a loss.
- Add the result to the rest of the year’s sales and apply the savings scale to the total.
Steps at a Glance
- Subtract the selling costs from the sale price.
- Add purchase costs, taxes, and improvements to the purchase price.
- Deduct depreciation if the property was rented.
- Subtract one value from the other to get the gain or loss.
- Apply the savings scale to the year’s total.
Two special rules complete the picture. If you sell shares bought on different dates, Spain treats the oldest ones as sold first. And if you bought the asset before 1995, the part of the gain built up until January 19, 2006, may be reduced with what are called reduction coefficients (coeficientes de abatimiento). The cap: the total sold with that reduction since 2015 can’t exceed €400,000, under the ninth transitional provision of the law.
How Is Capital Gains Tax Calculated in Spain? A Worked Example
The savings scale is applied to the year’s net gain, bracket by bracket. Here’s an example: an American engineer who has lived in Barcelona since 2019 sells the Málaga apartment she used as a second home. She bought it in 2016 for €220,000, paid €18,000 in purchase taxes and costs, and spent €22,000 renovating it. She now sells it for €410,000, with a €14,000 agent’s commission and €3,000 of plusvalía municipal.
- Transfer value: €410,000 − €17,000 = €393,000.
- Acquisition value: €220,000 + €18,000 + €22,000 = €260,000.
- Capital gain: €133,000.
- Tax: €1,140 + €9,240 + €19,090 = €29,470, or 22.2% of the gain.
Capital Gains Tax Exemptions in Spain: When You Don’t Pay
Almost all capital gains tax exemptions in Spain revolve around your main home: your age, reinvesting the proceeds, or handing the home to the bank.
- Over 65: selling your main home creates an exempt gain. The same applies if you’re officially recognized as severely or highly dependent (Article 33.4 of the IRPF Law).
- Reinvesting in another main home: the gain is exempt if you reinvest the full amount in a new main home within the two years before or after the sale. If you reinvest only part, the exemption is proportional.
- Deed in lieu of foreclosure (dación en pago): handing over your main home to cancel a mortgage, or losing it in a foreclosure, is exempt if you have no other assets to pay the debt.
Do You Pay Capital Gains Tax When Selling Your Home in Spain?
Yes, at the same savings rates as any other sale, unless one of the exemptions above applies. Watch out for the requirement that trips up the most people. For tax purposes, your main home is one you’ve lived in continuously for at least three years. There are exceptions, such as a job transfer or a divorce, but the Spanish Tax Agency reads them strictly. A timing tip: once you move out, the sale still counts as the sale of your main home for the following two years.
Capital Gains Tax in Spain for Residents, Non-Residents and Beckham Law
Your tax residency decides which gains Spain taxes, at what rate, and on which form, even if you sell exactly the same asset.
You’re a Spanish tax resident if you spend more than 183 days a year in Spain or if your main economic interests are here (Article 9 of the IRPF Law). Unless proven otherwise, it’s also presumed if your non-separated spouse and your dependent minor children live in Spain.
| Tax resident | Non-resident | Beckham Law | |
|---|---|---|---|
| What Spain taxes | Gains from any country | Spanish gains only | Spanish gains only |
| Rate | 19% to 30% scale | Flat 19% | 19% to 30% scale |
| Return | Annual IRPF, Form 100 | IRNR, Form 210 for each sale | Special regime, Form 151 |
| Selling real estate | No buyer withholding | Buyer withholds 3% of the price | No buyer withholding |
If You’re a Spanish Tax Resident: Gains Anywhere in the World
As a resident, you report your worldwide gains in Spain. If you live in Madrid and sell a house in Texas or shares held in a US brokerage account, that gain goes on your Spanish return. To avoid paying twice, the tax treaty with that country decides who can tax it. On top of that, Article 80 of the IRPF Law lets you credit, within limits, the tax you’ve already paid abroad.
How Much Is Capital Gains Tax in Spain for Non-Residents?
A flat 19%, and only on what you earn in Spain, whatever country you live in. The 24% you’ll see on some websites is the general rate for other kinds of income, not for gains from a sale: Article 25.1.f) of the Non-Resident Income Tax Law sets 19% for every gain that comes from a transfer.
For non-residents, capital gains tax on property in Spain works in two steps, as the Spanish Tax Agency explains. The buyer withholds 3% of the price and pays it with Form 211 within a month of the sale. The seller then files Form 210 within the following three months, paying the balance or claiming a refund if the withholding exceeds the tax.
Using the same figures as above, a seller who lives in the US would owe €25,270 (19% of €133,000). The buyer would already have paid €12,300 in withholding, so €12,970 would remain due with Form 210. Keep in mind that non-residents can’t use the over-65 exemption, and the main home reinvestment exemption only applies to residents of the EU or the European Economic Area. We cover it in detail in our guide to taxes in Spain for non-residents.
Capital Gains Under the Beckham Law
Under the impatriate regime, the Beckham Law, Spain only taxes gains you make in Spain. The same 19% to 30% savings scale applies, under Article 93 of the IRPF Law. Gains from selling assets located abroad, such as an investment portfolio back home, aren’t taxed in Spain while the regime lasts. What your home country expects is a separate question. For companies relocating executives to Spain, this point can weigh as much as salary when deciding whether to opt in.
Spain Exit Tax: Capital Gains When You Move Abroad
If you stop being a Spanish tax resident, Spain can tax the increase in value of your shares even if you don’t sell them. That’s the exit tax.
Article 95 bis of the IRPF Law governs it as “capital gains from a change of residence.” The rule applies if you’ve been a resident for at least 10 of the previous 15 years and one of these two situations applies:
- Your shares or holdings are worth more than €4,000,000 in total.
- You own more than 25% of a company and those holdings are worth more than €1,000,000.
The difference between their market value and what they cost you is added to your savings income for the last year you file in Spain. The law has special rules depending on where you move, for example within the European Union.
Put simply: if you hold a significant stake in your company and plan to leave Spain, planning has to start before you change residency, not after.
How to Legally Reduce Capital Gains Tax in Spain
You can lower your Spain capital gains tax bill with planning: document your costs, offset losses, and choose when and from where you sell.
- Keep every deed and invoice: transfer tax, notary and registry fees, and renovations raise your acquisition value, but only if you can prove them.
- Use the year’s losses: if you sell other assets at a loss, that result is subtracted from your gains.
- Watch the two-month rule: a loss doesn’t count if you buy back the same listed securities within two months before or after the sale, or within a year for unlisted ones.
- If you’re paid in installments, report in installments: when payment is deferred for more than a year, you can report the gain as you collect it, under Article 14 of the IRPF Law.
- Time the sale around your residency: selling just before or just after you move to Spain, or leave it, can change which country taxes the gain and at what rate. That’s at the core of our tax planning in Spain service.
Calculating the gain is the easy part. What really changes the bill is knowing where you’re a tax resident, which costs you can document, and which exemption fits your case, and knowing it before you sign the sale.
At ILLAY Legal, we review the whole transaction. We calculate the gain from your deeds and invoices, confirm your tax residency, and file the right return, whether that’s IRPF or Form 210. We handle it through our personal tax returns in Spain service, fully online and in your language. Tell us what you’re selling, when you bought it, and where you live now, and we’ll tell you how much you’ll pay and how to reduce it legally.
Frequently Asked Questions About Capital Gains Tax in Spain
Is there a capital gains tax allowance in Spain?
No. Unlike the US or the UK, Spain has no tax-free amount for capital gains: the first euro of gain is taxed at 19%. What Spain does have is a filing threshold: under Article 96 of the IRPF Law, some residents don’t have to file. That’s the case if their total income and gains for the year stay at or under €1,000, with losses under €500, or if they only have up to €1,600 of investment income and gains already subject to withholding. Selling a property at a profit almost always means you’ll need to file.
How is capital gains tax calculated on inherited property in Spain?
The starting point is the value declared for inheritance tax, capped at market value. Added to it are the costs and the share of inheritance tax that relate to that property, under Article 36 of the IRPF Law. So if you sell shortly after inheriting, at the declared value, the gain is usually small or zero. Watch out for a common mistake: declaring a very low value on the inheritance to pay less inheritance tax means a bigger capital gain when you sell.
Do I pay capital gains tax in Spain and in the US?
You may have to report the gain in both countries, but you shouldn’t pay twice on it: as a US citizen, you’re taxed by the IRS on your worldwide income wherever you live. Spain taxes your worldwide gains if you’re a Spanish tax resident, or only your Spanish gains if you’re not. The Spain-US tax treaty and foreign tax credits sort out who taxes first: Spain keeps the right to tax gains on Spanish real estate, and the US generally lets you credit that tax. Because rates and timing differ, it pays to run the numbers in both systems before you sell.
What happens if I have a net capital loss in Spain?
If your losses from sales exceed your gains in a given year, the net loss is first offset against your net interest and dividend income, up to 25% of it. Whatever is left can be carried forward for the next four years, under Article 49 of the IRPF Law. It also works the other way: net negative interest and dividend income can offset up to 25% of your capital gains. It’s worth reporting the loss even if you owe nothing, so there’s a record of what you plan to offset later.
Is there a capital gain if I sell a property with a mortgage in Spain?
Yes, if you sell for more than it cost you: the mortgage doesn’t change the calculation. The gain is the difference between the transfer value and the acquisition value, and the outstanding loan isn’t subtracted. Mortgage interest isn’t added to the cost either, because Article 35 of the IRPF Law excludes it. Where the mortgage does matter is the main home reinvestment exemption. There, the amount you must reinvest is the transfer value minus the loan balance you pay off, as the Spanish Tax Agency explains in its tax return manual.
Can I reinvest the proceeds in a life annuity to avoid capital gains tax?
Yes, if you’re over 65, and it doesn’t have to be your home: any asset qualifies. The gain is exempt if, within six months, you use the proceeds to set up a life annuity in your favor. The cap is €240,000, under Article 38.3 of the IRPF Law. You don’t need this for your main home, which is already exempt at that age: it’s most useful for a second home, a commercial property, or a share portfolio. Note that if you later cash in the annuity early, the gain becomes taxable again.


