Should I sell shares at a gain this year if I already have capital losses, or is it better to keep the losses to offset against next year's Spanish income tax (IRPF)?
Reviewed by Axel Castillo · Last updated:
It is a common question as the year end approaches: if you have already realised capital losses and hold shares with unrealised gains, should you sell now or wait? The answer depends on how loss offsetting within the savings tax base of the IRPF (Spanish personal income tax) works.
Selling shares is a capital gain, not investment income
Selling shares gives rise to a capital gain or loss (ganancia o pérdida patrimonial) (articles 33 and 37 of the IRPF Act). It is the difference between the disposal value and the acquisition value, after deducting buying and selling costs. The same applies to redemptions of investment funds and to options and futures on regulated markets that do not hedge a business activity.
By contrast, the following are investment income (rendimientos del capital mobiliario) (article 25 LIRPF), among others:
- dividends;
- the sale or redemption of fixed-income securities (bonds).
Both types of income go into the savings tax base (base del ahorro, article 46 LIRPF).
How gains and losses are offset (article 49 LIRPF)
- Step 1: capital gains and losses for the year are offset against each other without limit.
- Step 2: if the result is negative, it is set against the positive balance of investment income, capped at 25% of that balance. The 25% is calculated on the income, not on the losses.
- Step 3: anything that cannot be offset is carried forward to the following four tax years, in the same order: first against gains, then against 25% of investment income.
Offsetting is mandatory and must be applied to the maximum amount allowed each year. Losses cannot be "banked": the only real decision is when to sell the position showing a gain.
Sell this year or next?
Assume investment income is similar in both years and there are no other transactions. In that case, the combined savings base for the two years is the same in both scenarios, because the losses are fully used. All that changes is the year in which the tax is paid:
- With no investment income or only low income, the result is identical.
- With high investment income, waiting may shift part of the tax into the following year. But if the base moves into a higher band that year, the total may end up slightly more expensive.
The savings rates are 19% up to €6,000, 21% up to €50,000, 23% up to €200,000, 27% up to €300,000 and 30% above that (article 76 LIRPF).
Risks of waiting and points to check
- Certainty: if you sell this year, the gain is covered straight away. If you wait and the share price falls, surplus losses can only be recovered gradually against 25% of investment income and expire after four years.
- Buying back: you can sell and repurchase the same shares to step up their acquisition cost. The anti-avoidance (wash sale) rule only blocks losses, not gains.
- Identical securities: if identical securities were bought in the two months before or after a sale at a loss (one year if unlisted), that loss cannot yet be claimed.
- Partial sales: the oldest shares are treated as sold first (FIFO), so the actual gain may differ from what you expected.
- Losses brought forward from earlier years: these are applied first and change the figures.
- Origin of the losses: if they come from bonds, they are negative investment income and are offset the other way round, against 25% of capital gains.
- Deadline: if you decide to sell this year, the trade must be executed before 31 December, allowing time for settlement.
Related service: Personal income tax
Would you like us to look at your case?
I am interestedRelated questions
- Can my Spanish company pay my children's private school fees as a benefit in kind and save on income tax and corporation tax?
- What expenses can I deduct for Spanish income tax (IRPF) if I'm a self-employed company director, draw a salary from my SL and rent it premises I own?
- How is the premium on a sold (written) put option taxed under Spanish income tax (IRPF) if it is exercised, and what is the tax base cost of the shares received?

