Tax on Capital Gains: How Investment Returns Are Taxed

How capital gains from selling shares, funds, or property are taxed under Spanish income tax, the savings income tax brackets, and fund-to-fund transfers.

interes-compuestoirpf

Before selling an investment that has gone up in value, it's worth understanding how that gain will be taxed, because Spanish income tax treats capital gains differently from employment income, with its own progressive scale and some important quirks.

What a capital gain is

A capital gain arises when you sell an asset (shares, fund units, a property) for more than you paid to acquire it, adjusted for buying and selling costs. If the result is negative, it generates a capital loss, which also carries tax relevance.

The savings tax scale: different from your employment income scale

Capital gains are taxed within the so-called savings tax base, with its own progressive scale, separate from the general scale applied to your salary. The savings base brackets are generally lower than the general scale's, especially for the first brackets, though they are also progressive: the bigger the gain, the higher the percentage applied on the corresponding bracket.

You can offset gains with losses

One of the most relevant mechanisms to keep in mind is the ability to offset capital gains with capital losses from the same tax year or, within certain limits, from the following four years. This means that if in a given year you've had both gains and losses across different investments, your tax bill is calculated on the net result, not on each transaction in isolation.

Transfers between investment funds: a significant tax advantage

One of the most valued features of investment funds in Spain is that they allow you to transfer money between funds without being taxed at the moment of the switch, as long as the money moves directly from one fund to another without ever becoming available in your bank account. This lets you rebalance your fund portfolio over the years without triggering an immediate taxable event, deferring taxation until the moment you actually redeem the money. This specific advantage generally doesn't apply to buying and selling individual shares directly.

The special rule for shares bought at different times: FIFO

When you sell part of a position you've built up through purchases made at different times and at different prices (for example, several purchases of the same share over time), the rules require applying the FIFO criterion (first in, first out): you're deemed to sell the shares you bought earliest first, which determines which purchase price is used to calculate the gain or loss on that specific sale.

Why it pays to keep a clear record of your transactions

Correctly calculating your capital gains and losses requires knowing precisely the price and date of every purchase and sale you've made. Keeping an organized record over time, rather than trying to reconstruct it all when tax season arrives, prevents errors and makes filing much easier.

Model the growth of your investment before selling

Our compound interest calculator helps you project how your investment would evolve over the long term, a relevant factor when deciding whether to hold a position or lock in gains at a particular moment.