In a nutshell
- In Spain, a capital gain (ganancia patrimonial) is what you make when you sell, or give away, something worth more than it cost you: shares, funds, a flat or your business.
- Gains from a sale are taxed in the savings tax base, at rates from 19% to 30% in 2026, the same in Catalonia as in the rest of Spain outside the Basque Country and Navarre.
- Losses are first set against the year’s gains; anything left over, against 25% of your interest and dividends, and the rest over the next four years.
- Moving from one investment fund to another through a transfer (traspaso) is not taxed; with ETFs, as a rule, this is not possible.
- Among others, these are not taxed: the sale of your main home by people over 65, reinvestment in another main home and the so-called plusvalía del muerto (gains on death).
You sell shares you bought years ago, cash in an investment fund or sell the flat you inherited, and the same question comes up every time: how much capital gains tax in Spain will you have to pay? The answer lies in the capital gains rules of Spanish personal income tax (IRPF), which tax the difference between what you receive and what the asset cost you. The tax arrives with the sale, but many of the decisions that determine it are taken beforehand.
We go through Law 35/2006 on Personal Income Tax, its implementing regulations and the practical income tax manual of the Spanish Tax Agency (AEAT), with the rules as reviewed on 2 December 2026. This is general information: Diman Capital is not a tax advisory firm, and your tax advisor should confirm how it applies to your case. At Diman Capital we help you with the wealth and financial side, for example planning when and how to sell or using transfers between funds, and we work alongside your tax advisor as part of our ongoing advice.
What are capital gains under Spanish income tax (IRPF)?
Article 33.1 of the Personal Income Tax Act defines them as “changes in the value of the taxpayer’s wealth that come to light on any alteration in its composition”, unless the law classes them as income. Put simply: there is a gain, or a loss, when something leaves your wealth, usually because you sell it, and it is worth more, or less, than when it came in. Income (rendimiento), on the other hand, is what an asset gives you while you hold it, such as interest, dividends or rent. Two exceptions: what you make when you sell or redeem bonds is investment income (rendimiento del capital mobiliario, art. 25.2), and what you receive from a pension plan is employment income, as we explain in how to withdraw a pension plan. The most common cases of capital gains and losses are these:
- Selling shares, listed or not, or your holding in a limited company.
- Redeeming investment funds or selling ETFs.
- Selling a property: a flat, commercial premises, a parking space or a plot of land.
- Giving away an asset during your lifetime that is worth more than it cost you: the donor declares the gain (arts. 34 and 36).
- Receiving a competition prize or a public grant, even though they do not come from selling anything.
How are capital gains and losses calculated?
On a sale, the gain or loss is the difference between the transfer value (valor de transmisión) and the acquisition value (valor de adquisición) (art. 34), which are calculated as follows (arts. 35 and 36):
- Acquisition value: the price you paid, plus the cost of investments and improvements and the expenses and taxes of the purchase (fees, notary, Land Registry, transfer tax), excluding loan interest. If the asset has been rented out, the depreciation for those years is deducted, always counting at least the minimum depreciation even if you did not claim it.
- Transfer value: the sale price, minus the expenses and taxes of the sale that you pay, such as the plusvalía municipal (the local tax on the increase in value of urban land). If the price is below market value, the market value applies.
- Inherited or gifted assets: the acquisition value is the one used for inheritance or gift tax, up to the market value.
How much is capital gains tax in Spain in 2026?
First, which tax base do they go into? Gains and losses arising from selling or transferring an asset go into the savings tax base (base del ahorro), however long you have held it (art. 46). Those that do not come from a transfer, such as prizes or public grants, go into the general tax base, together with your salary, and are taxed on the general scale (art. 45); so are unexplained gains (ganancias no justificadas, art. 39).
Capital gains in the savings base are taxed on a scale of bands made up of two equal halves, one state (art. 66) and one regional (art. 76). From 1 January 2025, Law 7/2024 raised the top band, above €300,000, from 28% to 30%. This is the 2026 scale:
| Taxable savings base | State rate | Regional rate | Total rate | Cumulative tax at the start of the band |
|---|---|---|---|---|
| Up to €6,000 | 9.5% | 9.5% | 19% | €0 |
| €6,000 to €50,000 | 10.5% | 10.5% | 21% | €1,140 |
| €50,000 to €200,000 | 11.5% | 11.5% | 23% | €10,380 |
| €200,000 to €300,000 | 13.5% | 13.5% | 27% | €44,880 |
| Over €300,000 | 15% | 15% | 30% | €71,880 |
Each rate applies only to the part that falls within its band: with a gain of €320,000, the 30% rate applies only to the €20,000 above €300,000. The scale is the same in Catalonia as in the other common-regime autonomous communities (Spain’s regions), because they cannot set the rates for the savings base (art. 46.2 of Law 22/2009). The Basque Country and Navarre have their own income tax (art. 4 of the Personal Income Tax Act).
Example: you sell shares with a €60,000 gain
Laura lives in Barcelona. In 2018 she bought 2,000 shares in a listed company at €40 each and paid €200 in fees. In 2026 she sells them at €70.20 and pays another €200. She has a salary, so her personal allowance (mínimo personal) is already applied in the general base, and she has no other savings income that year.
| Item | Amount |
|---|---|
| Transfer value (2,000 × €70.20, minus €200 in fees) | €140,200 |
| Acquisition value (2,000 × €40, plus €200 in fees) | €80,200 |
| Capital gain | €60,000 |
| First €6,000 at 19% | €1,140 |
| €6,000 to €50,000 (€44,000) at 21% | €9,240 |
| €50,000 to €60,000 (€10,000) at 23% | €2,300 |
| Total IRPF on the sale | €12,680 |
Laura pays €12,680, 21.1% of her gain. She declares it in her income tax return for the year of the sale (art. 14.1.c), that is, the 2026 return filed in 2027, and since no tax is withheld when you sell shares, she will pay all of it then.
How are capital gains and losses offset?
Losses are not wasted. Article 49 of the Personal Income Tax Act lets you set them off within the savings base, in this order:
- Gains and losses from the same year are offset against each other, without limit.
- If there is a net loss, it is deducted from the interest, dividends and other investment income in that year’s savings base, up to 25% of its positive balance. And the other way round: a negative balance of that income can be deducted from up to 25% of the gains.
- Anything left over is carried forward to the next four years, in the same order and for the maximum amount possible each year (art. 49.2): you cannot hold it back for a year that suits you better.
- They cannot be deducted from your salary, pension or other income in the general base, which is calculated separately (arts. 47 and 48).
Example: selling at a loss to offset a gain
Back to Laura. Her portfolio also holds other shares that cost her €50,000 and are now worth €30,000. If she sells them in 2026, and she has not bought identical shares in the previous two months and does not buy them back in the following two, her €20,000 loss is deducted from the €60,000 gain. She will be taxed on €40,000: €1,140 for the first band plus €7,140 for the second (€34,000 at 21%), a total of €8,280, that is, €4,400 less. That said, selling just for tax reasons does not always make sense: what comes first is that the portfolio is still the right one for you.
Shares, funds and ETFs: what is sold first and when is there no tax?
If you have bought the same shares or the same fund on different dates, the tax authorities treat the oldest ones as sold first (the FIFO rule, arts. 37.2 and 94.1.a). If you bought units in 2015 and in 2022 and now sell part of them, the 2015 units go first, even if you would rather declare the ones that cost you more.
The great advantage of investment funds is the transfer (traspaso): if you redeem a fund and the money goes directly into another one, without passing through your account, you pay no tax, and the new units keep the value and purchase date of the old ones (art. 94.1.a). It works for Spanish funds, for harmonised funds from other EU countries registered with the CNMV (Spain’s securities regulator) if you deal through a registered distributor, and for SICAVs (investment companies) with more than 500 shareholders in which you have not held more than 5% in the last twelve months (art. 94). When you actually cash out, the provider will withhold 19% of the gain on account (art. 101.6). ETFs are left out: Spanish ones already were and, since 1 January 2022 (Law 11/2021), so are foreign ones, with one transitional exception: those not listed on a Spanish stock exchange that you bought before that date, provided the money does not go into another ETF (thirty-sixth transitional provision).
If you sell the shares in your company, the gain also goes into the savings base. If the company is unlisted, and unless you can prove the price is a market price, the sale value cannot be lower than the higher of two figures: the net equity in the last balance sheet closed, or the average profit of the last three financial years capitalised at 20% (art. 37.1.b). It is a transaction worth preparing well in advance; we cover it in selling your business.
Which capital gains are exempt or not taxed?
- Main home sold by people over 65 or by people with severe or major dependency: exempt, with no limit on the amount (art. 33.4.b). Your main home (vivienda habitual) is the one you have lived in for at least three consecutive years, and it still counts as such for two years after you leave it (art. 41 bis of the regulations).
- Reinvestment in another main home, at any age: if you reinvest everything you receive in another main home within two years after the sale, or you bought it in the two years before, the gain is exempt; if you reinvest part of it, proportionally. If you bought it with a loan, what counts is the amount received minus the outstanding capital (art. 38.1 and art. 41 of the regulations).
- Life annuity for people over 65: the gain from selling any asset is exempt if, within six months, you put the proceeds into an insured life annuity in your favour, up to a total of €240,000 (art. 38.3).
- Plusvalía del muerto (literally, the gain of the deceased): on death, the increase in value of the assets is not taxed in the deceased’s IRPF (art. 33.3.b), and the heirs take the inheritance tax value as their acquisition value (art. 36).
- Gift of a family business that meets the requirements for the reduction in article 20.6 of the Inheritance and Gift Tax Act: there is no gain for the donor, and the recipient takes on its value and purchase date (arts. 33.3.c and 36).
- Donations to organisations listed in article 68.3 of the Personal Income Tax Act, such as those covered by Law 49/2002 on charitable patronage (art. 33.4.a).
Assets bought before 1995: the reduction coefficients
If you sell something you bought before 31 December 1994, part of the gain may be reduced (ninth transitional provision). Only the part generated up to 19 January 2006: as a rule, the part corresponding to the days up to that date; for listed shares and funds, the part resulting from their value for 2005 wealth tax. That part is reduced, for each year of ownership at 31 December 1996 (rounded up) beyond two, by 11.11% for property, 25% for listed shares and 14.28% for everything else. And only as long as the sum of the sale prices of the assets entitled to this reduction sold since 1 January 2015, including the current one, does not exceed €400,000; if your sale goes over that limit, only the proportional part below it is reduced.
Capital gains tax on property in Spain: what you pay when you sell a flat
When you sell a property, two different taxes usually apply. The IRPF capital gain taxes the difference between what you receive and what it cost you. The plusvalía municipal (officially, impuesto sobre el incremento de valor de los terrenos de naturaleza urbana) is a local council tax on the increase in value of urban land (art. 104 of the Local Finance Act): on a sale it is paid by the seller and, on an inheritance or a gift, by the recipient (art. 106). You can estimate it with our plusvalía municipal calculator. What you pay in plusvalía municipal when you sell is deducted from the transfer value for IRPF.
Example: you sell a flat that is not your main home
Marta bought a flat in Barcelona in 2010 for €250,000 and paid €20,000 in taxes and purchase costs. In 2015 she renovated it for €30,000. She has never rented it out and it has never been her main home. In 2026 she sells it for €450,000 and pays €5,000 in plusvalía municipal. She has no other savings income that year.
| Item | Amount |
|---|---|
| Purchase price | €250,000 |
| Taxes and purchase costs | +€20,000 |
| 2015 renovation (improvement) | +€30,000 |
| Acquisition value | €300,000 |
| Sale price | €450,000 |
| Plusvalía municipal paid by Marta | −€5,000 |
| Transfer value | €445,000 |
| Capital gain | €145,000 |
| IRPF: €10,380 on the first €50,000 and €95,000 at 23% | €32,230 |
Marta will pay €32,230 in IRPF, 22.2% of the gain, on top of the €5,000 of plusvalía municipal. Had it been her main home and had she been over 65, the gain would be exempt; if she were younger, too, provided she reinvested everything she received in another main home within two years. And if she had rented it out, the gain would be larger, because the acquisition value would be reduced by depreciation (as a rule, at least 3% a year of the value of the building, excluding the land).
What changed in 2025 and 2026?
- Top rate of 30% (law): since 1 January 2025, the part of the savings base above €300,000 is taxed at 30% instead of 28% (seventh final provision of Law 7/2024, of 20 December).
- Savings and Investment Account (law): the Cuenta de Ahorro e Inversión Financia Europa, created by Royal Decree-law 29/2026, now validated (art. 95 ter). Gains on sales inside it are untaxed until you withdraw money and, on gains from contributions over five years old, the first €10,000 per person and 20% of the rest are tax-free. Up to €150,000; opening one still awaits a ministerial order.
- Sale of empty homes to public bodies (law): until 31 December 2027, the gain from selling a home that has been empty continuously and without justified cause for the previous two years to public social housing bodies is fully exempt if the transfer value does not exceed €200,000, and partly exempt if it is below €800,000 (sixty-fifth additional provision).
- Over-65s moving into a care home (regulations): since 8 October 2026, if you are over 65 or have severe or major dependency and sell the home you left when you moved, because of your age or dependency, into a care home or the home of a relative up to the third degree, it still counts as your main home even if more than two years have passed (art. 41 bis.3).
How can you plan your sales so the tax weighs less?
- Review your portfolio before 31 December: if you already have gains in the year, see whether there are unrealised losses that make sense to realise, respecting the two-month rule.
- Use transfers between funds to reorganise your portfolio without bringing tax forward.
- Spread large sales over several years where possible: on the 2026 scale, a €600,000 gain in a single year pays €161,880; split into two years of €300,000, €143,760. That said, the market can move from one year to the next.
- If you sell in instalments and more than a year passes between handover and the last payment, you can declare the gain as you are paid (art. 14.2.d).
- Coordinate decisions with your tax advisor and with whoever manages your wealth. A wealth review is a good starting point to see where your unrealised gains and losses are.
Frequently asked questions
What is the difference between a capital gain and investment income?
Income (rendimiento) is what an asset gives you while you hold it: interest, dividends or rent. A capital gain arises when the asset leaves your wealth, usually when you sell it. Interest, dividends and gains from sales go into the savings base, on the same scale; rent goes into the general base. Watch out with bonds: what you make when you sell them is investment income (rendimiento del capital mobiliario, art. 25.2), not a capital gain.
In which year do you declare a capital gain?
In the year the sale or change in your wealth takes place (art. 14.1.c). If you are paid in instalments and more than a year passes between handover and the last payment, you can choose to declare the gain as you receive each instalment (art. 14.2.d).
Do I have to pay tax when I sell my main home?
It depends. If you are over 65, or have severe or major dependency, the gain is exempt. If you are younger, it is exempt if you reinvest everything you receive in another main home within the following two years, and proportionally if you reinvest part of it. If you do not reinvest, it is taxed in the savings base. Separately, the local council charges the plusvalía municipal.
Can I offset capital losses from previous years?
Yes, over the following four years: first against each year’s gains and, if there is anything left, against up to 25% of the positive balance of interest and dividends (art. 49). For example, if in 2025 you had €20,000 of net losses and €8,000 of interest and dividends, you offset €2,000 that year and have €18,000 left for 2026 to 2029, which must be used for the maximum amount possible each year.
How are capital gains taxed if I do not live in Spain?
If you are not tax resident in Spain (as a rule, if you do not spend more than 183 days a year here and your main centre of economic interests is not in Spain, art. 9), what you make in Spain is not taxed under IRPF but under non-resident income tax (Impuesto sobre la Renta de No Residentes); we explain it in our guide to that tax. And if you move abroad holding shares worth more than €4 million (or more than €1 million if you own more than 25% of a company), after being resident for at least ten of the last fifteen years, the unrealised gain may be taxed when you leave (the exit tax, art. 95 bis).
What is the plusvalía del muerto?
It is the popular name for an IRPF rule: when someone dies, the increase in value of their assets is not taxed in their final IRPF (art. 33.3.b), and the heirs take the inheritance tax value as their acquisition value (art. 36). The heirs do pay inheritance tax and, if there are urban properties, the plusvalía municipal. With succession agreements that take effect during the owner’s lifetime, there is a special rule if the asset is sold within five years, which we explain in our guide to the succession agreement (pacto sucesorio) in Catalonia.
Tax on capital gains is paid in the year of the sale, but it is decided beforehand: what you sell, when, which losses you offset against it and which tools you use, such as transfers between funds or reinvestment. This guide is general information and does not replace advice from your tax advisor: the outcome depends on your situation and the rules may change. If you would like to review your case with real numbers, let’s talk.
Legal sources (in Spanish), consulted on 2 December 2026: Law 35/2006 on Personal Income Tax (IRPF), consolidated text (arts. 4, 9, 14, 25, 33 to 39, 45 to 49, 66, 76, 94, 95 bis, 95 ter and 101, ninth and thirty-sixth transitional provisions and sixty-fifth additional provision); IRPF Regulations, Royal Decree 439/2007 (arts. 40, 41, 41 bis, 42 and 75); Royal Decree-law 29/2026 and its validation by Congress; Law 22/2009 on regional financing (art. 46); and the Local Finance Act (arts. 104 and 106).
Spanish Tax Agency (AEAT), 2025 income tax manuals (in Spanish): state tax on savings income, regional tax on savings income, rules for calculating gains and deferred losses.