Reference guide. Not part of the path: you come back to it when you need it.
The three reference guides
Investment taxation in Spain
· · · 24 min read
Tax section: reviewed every January, without exception.
Narration is coming later. For now the course is text, and the text is complete.
This is a reference guide, not a session to read straight through. Each section stands on its own, so you can go directly to whichever you need. It covers how shares, funds, ETFs (exchange-traded funds), and dividends are taxed under Spanish personal income tax, and the rules that move the most money.
Tax notice. The rules change every year and your specific situation may have particularities a guide can't cover. For decisions with real money involved, a tax advisor costs less than a mistake.
The savings income brackets
Gains from selling shares, funds, or ETFs, together with dividends and interest, form the savings tax base, which is taxed separately from your salary on its own five-bracket scale.
| Bracket | Rate |
|---|---|
| Up to €6,000 | 19% |
| €6,000 to €50,000 | 21% |
| €50,000 to €200,000 | 23% |
| €200,000 to €300,000 | 27% |
| Above €300,000 | 30% |
The top bracket rose from 28% to 30% under Law 7/2024 of December 20, effective January 1, 2025. It's the most recent change, which is why plenty of guides still circulate showing 28%.
Two things worth knowing about this scale:
It has no regional component. Unlike employment income, the savings base is identical across Spain: wherever you live, you pay the same on selling shares.
It doesn't depend on your salary. Earning a lot at work doesn't raise the rate on your investments, because they're two separate buckets calculated independently.
How it's calculated bracket by bracket, not all at once
It's a progressive scale: each bracket applies only to the portion falling inside it. Crossing a threshold doesn't push all your profit into the next rate.
This is by far the most common misunderstanding, so here it is with numbers.
Someone makes €40,000 selling shares in a year.
What many people believe happens: €40,000 sits in the 21% bracket, so they pay €8,400.
What actually happens:
- The first €6,000 taxed at 19% → €1,140
- The remaining €34,000 taxed at 21% → €7,140
- Total: €8,280
The difference is €120, and it widens at higher brackets. But the important part isn't the amount: it's that you never lose out by earning one more euro. Making €6,001 instead of €6,000 means paying 21% on that one extra euro, not on all €6,001.
When the gain actually arises
On selling, not before. While you hold the shares, however much they've risen, there's nothing to declare and nothing to pay.
The gain is calculated as: sale price minus purchase price, deducting commissions on both trades. Commissions count in your favour, so it's worth having them documented.
A full example:
- Buy 100 shares at €20 → €2,000, plus €5 commission = €2,005 cost
- Sell 100 shares at €26 → €2,600, minus €5 commission = €2,595 received
- Capital gain: €590
If that's your only gain of the year, it's taxed at 19% → €112.10.
What doesn't create a gain: the price rising while you hold, receiving a dividend in shares rather than cash (deferred until you sell those shares), or transferring between investment funds, which has its own section below.
Withholding on Spanish dividends
When you collect a dividend from a Spanish company, 19% is withheld before the money reaches your account. That withholding isn't the final tax: it's an advance payment.
If your gross dividend is €1,000, you receive €810 and the tax agency holds €190 upfront. When you file, that dividend enters the savings base along with your other income, the amount due is calculated on the bracket scale, and it's reconciled against what was already withheld.
If too much was withheld, you get it back. That's the case for anyone with modest savings income in the year: the 19% withholding matches the first bracket, so the adjustment is usually small or nil.
Dividends go in the investment income section of the return, not in capital gains. They're two different things within the same savings bucket.
Double taxation on foreign dividends
Here there are two withholdings, not one: the company's home country withholds and Spain withholds. The double taxation treaty lets you recover most of the first, but you have to claim it on your return: it doesn't happen automatically.
The full case, step by step
A €1,000 gross dividend from a US company, with a signed W-8BEN:
- The US withholds 15% at source → €150 gone
- €850 reaches your broker
- Spain withholds 19% on the full €1,000 gross → €190 more
- Doing nothing further, you'd have received €660 having paid €340: a 34% effective rate
How to recover it
On your return you apply the international double taxation deduction, which lets you offset what was already paid abroad, up to the limit the treaty sets — in the US case, 15%.
Applying it: you pay the €190 for Spain minus €150 deductible, meaning €40 extra. Adding the withholding at source, your total tax cost drops to 19%, the same as if the dividend had been Spanish.
The difference between claiming and not claiming is €150 on a €1,000 dividend. And it isn't applied automatically: leave it out and you pay 34%.
If your broker is foreign
A Spanish broker applies the Spanish withholding and gives you the certificate. A foreign one usually withholds nothing in Spain, so you settle that entire 19% yourself on your return, and it's also on you to document the withholding at source in order to deduct it.
The W-8BEN form
It's a document declaring to the US tax administration that you aren't a US tax resident, and it exists so the reduced treaty withholding applies to you.
With a signed W-8BEN: 15% withholding at source. Without it: up to 30%.
On a €1,000 gross dividend, the difference is €150 that stays abroad and that you won't be able to fully deduct, because the treaty caps the deduction at 15%.
Three practical points:
It's signed once, usually when opening the account or buying your first US security. It doesn't need repeating with each dividend.
It expires. It's valid for three calendar years from signing, and brokers usually prompt you to renew. If it lapses unrenewed, you're back to 30%.
Your broker handles it. You don't send it to any administration yourself: you sign it on the platform, usually a two-minute form.
Offsetting losses against gains
Losses subtract from gains, so you're only taxed on the difference. It's one of the few genuine tax advantages available to individual investors, and plenty of people don't use it because they don't know about it.
How it works within the same year
If you sell some shares at an €800 gain and others at a €500 loss, you're taxed on €300, not €800.
Offsetting is done first between capital gains and losses with each other. If a negative balance remains, it can be offset against investment income — dividends and interest — up to a limit of 25% of that positive balance.
And the following four years
If in one year your losses exceed your gains, the excess isn't lost: it's carried forward and can be offset over the following four tax years.
That detail has real consequences. A €3,000 loss in a bad year can reduce the tax bill of the following four years, provided you declared it at the time. If you didn't declare it, it doesn't exist.
Hence an administrative consequence, not a fiscal one: a declared loss stays available to offset gains for the following four tax years, even if there are no gains that year to apply it against. An undeclared loss keeps no such right.
The two-month rule
If you sell a security at a loss and repurchase the same security within two months before or after, that loss can't be offset in that tax year. It's in article 33.5.g of the Spanish income tax law.
Why it exists
Without this rule, anyone could sell on December 30 to crystallise a loss, repurchase on January 2, and end up holding exactly the same position with a free tax deduction. The tax agency's view is that if you still hold the same thing, you haven't really lost anything yet.
The example, with dates
- January 15: you sell 100 shares in a company at a €500 loss.
- February 10: you buy 100 shares in that same company again.
- Result: that €500 can't be offset on that year's return.
What almost nobody knows: the loss doesn't disappear
This is the most important part of the section and the worst-explained. The loss isn't lost: it's deferred. It gets added to the purchase price of the new shares, so it surfaces the day you sell those without repurchasing inside the window again.
It's a deferral, not a penalty.
The three caveats
It only applies to losses. Sell at a gain and repurchase the next day and absolutely nothing happens: there's no waiting period or limitation.
The window is two months for listed securities and one year for unlisted ones.
It counts in both directions. The two months are before or after the sale. Buying more shares in a company and selling them at a loss three weeks later also triggers the rule.
It applies to homogeneous securities: the same company and same share class. And it applies even across different brokers, because the tax agency looks at your overall position, not each account separately.
The FIFO rule
When you hold several purchases of the same security at different prices and sell part of it, the tax agency treats you as selling the oldest first. FIFO stands for first in, first out.
The example
- March: buy 50 shares at €10 → €500
- September: buy 50 shares at €20 → €1,000
- Now: sell 50 shares at €18 → €900
Even if mentally you were selling the September shares — which are at a loss — the tax agency treats you as selling the March ones. Your purchase price is €10, not €20.
Result: a €400 gain, which is taxable. Had you been able to choose the September batch, you'd have had a €100 offsettable loss.
What it implies
You can't choose the batch. There's no way to tell the tax agency which specific shares you're selling.
It applies across brokers. If you bought in March at one broker and in September at another, it's still FIFO by date, not by account. The tax agency looks at your total position in that security.
It applies identically to investment funds at redemption: the oldest units are treated as redeemed first.
Funds and ETFs: the difference that moves the most money
Here's the Spanish rule that most changes long-term outcomes and surprises almost everyone: you can switch between investment funds without paying tax, but switching ETFs is always taxed.
The transfer regime
Article 94 of the Spanish income tax law allows moving money between investment funds via a fund transfer without it counting as a sale. There's no taxable event: your acquisition price and original date travel to the new fund, and the tax agency waits until you actually redeem.
You can change fund, change strategy, and even change manager, and pay nothing as long as the money stays inside a fund.
ETFs were excluded
Since January 1, 2022, exchange-traded funds are excluded from that deferral regime. An ETF, for tax purposes, is treated like a share: every sale is a disposal and generates a gain or loss at that moment, even if you reinvest the proceeds in another ETF the following second.
| Investment fund | ETF | |
|---|---|---|
| Tax rate | 19%-30% | 19%-30% |
| Switching to another product | Transfer, no tax | Sale, always taxed |
| Withholding on sale | Yes, on account | No |
| When you pay | Only on redemption | On every switch |
When this difference matters and when it doesn't
It matters a lot if you rebalance frequently, change strategy, or adjust your portfolio over the years. Every ETF switch brings forward the tax on accumulated gains, and that money paid early stops compounding.
It matters little if you buy and don't touch anything for fifteen years. In that case you end up paying the same, just at different moments.
The two-month rule exception
With ETFs, the two-month rule can be avoided if the repurchase is made through a different manager, because they then aren't considered homogeneous securities. It's a recognised particularity rather than an aggressive loophole, but it's worth confirming with an advisor before building anything on it.
What your broker reports and what you must report
It depends entirely on where your broker is, and it's the practical difference that generates the most work.
With a Spanish broker
It withholds on dividends, reports to the Spanish tax agency, and gives you an annual tax certificate. Most of your data appears pre-filled in your draft return.
Even so, check it. Final responsibility for the return being correct is yours, not the broker's, and draft data can be incomplete if you trade through several firms.
With a foreign broker
It doesn't withhold, doesn't report to the Spanish tax agency, and sometimes doesn't even give you figures in euros. You enter everything:
- Every gain and loss, converted to euros at the exchange rate on each transaction's date.
- Every dividend, with its withholding at source documented so you can deduct it.
- The losses above all. If your broker doesn't report and you don't declare them, you lose the right to offset them for four years.
Form 720
If on December 31 you hold more than €50,000 in securities, accounts, or insurance located abroad, form 720 must be filed.
Three points:
It isn't a tax. It's an informational return: filing costs nothing.
The threshold applies per category. Accounts, securities, and property are counted separately, each with its own €50,000 limit.
It doesn't repeat every year. Once filed, it's only mandatory again if that category's value rises more than €20,000 above the last filing, or if you cease to hold something previously declared.
The five most expensive mistakes
- Believing that crossing a bracket raises the rate on everything. It doesn't: only on the excess.
- Not declaring losses in a year without gains, and losing the right to offset them for four years.
- Not signing the W-8BEN and paying 30% at source on US dividends instead of 15%.
- Not applying the double taxation deduction, worth €150 on a €1,000 US dividend.
- Repurchasing within two months of selling at a loss, then discovering in spring that the loss doesn't offset this year.
This guide is reviewed every January without exception, because brackets, thresholds, and deadlines change with each year's rules. If you're reading this after January 2027 and the review date still says this, verify the brackets before relying on them.
Related guides: order types and how they execute · the dividend, start to finish · Sessions linking here: how to choose a broker · what every trade really costs
Sources
- Law 7/2024 of December 20 (Spanish Official Gazette, December 21, 2024): raises the top savings bracket from 28% to 30% effective January 1, 2025
- Spanish Personal Income Tax Law, article 33.5.g: repurchase rule for homogeneous securities within two months before or after
- Spanish Personal Income Tax Law, article 94: deferral regime for transfers between collective investment vehicles; exchange-traded funds excluded since January 1, 2022
- Spanish Tax Agency: form 720 informational return on assets held abroad, €50,000 threshold
- Spain-United States double taxation treaty: 15% withholding at source with a signed W-8BEN form