Capital gains and losses

What they are, when they arise, how they are calculated and what exemptions exist. Includes transfer of main home, shares, investment funds and virtual currencies.

Capital gains and losses are changes in the value of your assets that become apparent when you change the composition of your estate: you sell a flat, transfer shares, inherit assets... If you received more than you paid, there is a gain; if you received less, there is a loss.

🔵 Legislation: Art. 33 et seq. Personal Income Tax Law


When does a capital gain or loss arise?

Three conditions must be met for a capital gain or loss to exist:

  1. There must be an alteration in the composition of the estate (sale, gift, barter, allocation with excess, etc.).
  2. That alteration must generate a change in its value (difference between what you paid and what you receive).
  3. The Law must not classify it as another type of income (employment, capital, economic activity).

Operations that do NOT generate a gain or loss

  • Division of jointly owned property among co-owners (without excess allocation)
  • Dissolution of the marital community of property or termination of the participation regime
  • Dissolution of jointly owned assets or separation of co-owners
  • Termination of the separation of property matrimonial regime by legal imposition or court order
  • Transfers on death ("mortis causa donation" or succession pacts)

If in the dissolution of jointly owned assets a co-owner receives more than their share (excess allocation) and that difference has a positive value, a capital gain does arise for the person receiving the excess.


Which gains are not taxed? Main exemptions

A. Transfer of main home by persons over 65

ℹ️ Are you over 65? A dedicated guide covers pensions, home-sale exemption, reinvestment in life annuities (€240,000), reverse mortgage and age-increased minimums: IRPF manual for taxpayers over 65.

Gains from the transfer of the main home are fully exempt when the taxpayer is over 65 or is in a situation of severe or major dependency.

B. Reinvestment in main home

Gains from the transfer of the taxpayer's main home are exempt, provided the full amount obtained from the transfer is reinvested in the acquisition of a new main home within the following time limits:

  • 2 years before or after the transfer
  • If the price is deferred, reinvestment may be made progressively as the instalments are received

If only part is reinvested, only that proportional part is exempt.

The exemption does not apply when the property transferred does not represent full ownership (for example, if only the bare ownership or usufruct is transferred).

C. Reinvestment in life annuities (persons over 65)

Gains from the transfer of any asset (not just housing) are exempt if the amount is used to set up an insured life annuity, provided:

  • The taxpayer is over 65
  • The annuity is set up within a maximum period of 6 months
  • The maximum amount of the life annuity to which the exemption applies is €240,000 (cumulative over the taxpayer's lifetime)

D. Compensation for civil liability and personal injury

Exempt to the amount legally or judicially recognised.

E. Lottery and betting prizes

SELAE, Red Cross and ONCE prizes are exempt up to €40,000 per ticket, coupon or bet. The excess is taxable at a special 20% rate.

F. Donations to entities under Law 49/2002

Gains arising from the donation of assets to non-profit entities covered by Law 49/2002 are exempt for the donor.

G. Mortgage-to-key of the main home

The capital gain arising from handing over the main home in lieu of payment to cancel mortgage-secured debts is exempt, when the debtor does not have other sufficient assets or rights to satisfy the full debt.


Gains and losses that are not counted as such

These operations occur but the Law does not recognise them for tax purposes (they are not taxed, but they also do not offset gains):

  • Gambling losses
  • Losses from transfers of assets where the same assets are reacquired within one year (shares or homogeneous securities); for real estate, the period is two years

How a capital gain or loss is calculated

General rule

Net transfer value

  • (+) Transfer value — actual price received, or market value if higher
  • (−) Transfer expenses and taxes — IIVTNU, notary, land registry, agency, etc.
  • = Net transfer value

Net acquisition value

  • (+) Acquisition price — or value declared for Inheritance and Gift Tax
  • (+) Acquisition expenses and taxes — notary, land registry, ITP/AJD, VAT, etc.
  • (+) Investments and improvements made to the asset
  • (−) Fiscally deductible depreciation — real estate that has generated income
  • = Net acquisition value

Gain or loss = Net transfer value − Net acquisition value

Transfers by way of gift (donations, inheritances)

  • Recipient: the acquisition value is the amount declared for Inheritance and Gift Tax, up to market value.
  • Donor: a capital gain or loss arises from the difference between the market value of the donated asset and its acquisition value, unless exempted.

Special valuation rules by type of asset

Shares listed on the stock exchange

Item Rule
Transfer value Quoted price on the transfer date, or agreed price if higher
Acquisition value Purchase price including expenses (less income from sale of subscription rights before 2017)
Identification criterion FIFO: the shares acquired first are deemed to be sold first
Subscription rights From 1/1/2017: capital gain in the year of transfer
  • Transfer value

    Rule Quoted price on the transfer date, or agreed price if higher

  • Acquisition value

    Rule Purchase price including expenses (less income from sale of subscription rights before 2017)

  • Identification criterion

    Rule FIFO: the shares acquired first are deemed to be sold first

  • Subscription rights

    Rule From 1/1/2017: capital gain in the year of transfer

Unlisted shares

The transfer value may not be less than the greater of:

  • The value of the equity according to the last balance sheet closed before the Personal Income Tax accrual date
  • The result of capitalising at 20% the average of profits for the last three tax years

Investment funds

Item Rule
Transfer value Net asset value on the redemption date (or net asset value if there is no liquidation value)
Transfer between funds No tax at the time of transfer: the new units retain the acquisition date and value of the original ones
Exception to deferral Does not apply to ETFs (exchange-traded funds) or where the taxpayer receives the money
  • Transfer value

    Rule Net asset value on the redemption date (or net asset value if there is no liquidation value)

  • Transfer between funds

    Rule No tax at the time of transfer: the new units retain the acquisition date and value of the original ones

  • Exception to deferral

    Rule Does not apply to ETFs (exchange-traded funds) or where the taxpayer receives the money

Virtual currencies (cryptocurrencies)

Cryptocurrencies are treated as intangible assets for tax purposes. They generate a capital gain or loss when:

  • Sold in exchange for euros or other legal tender
  • Exchanged for a different cryptocurrency (barter transaction, taxable at that point)

The gain is calculated as the difference between the transfer value (euros received or market value) and the acquisition value in euros. The identification criterion is also FIFO.

Cryptocurrency gains and losses are savings income (included in the savings taxable base).

Real estate

  • The acquisition value includes the purchase price, inherent expenses and taxes (ITP/AJD, notary, land registry, agency fees) and investments in improvements.
  • Depreciation is deducted if the property was rented (3% per year on the greater of the construction cost or the cadastral value of the construction, with the minimum of depreciation actually deducted).
  • The transfer value may not be less than the cadastral reference value for ITP/AJD purposes.

Non-monetary contributions to companies

The transfer value is the greater of:

  • Nominal value of the shares or interests received (plus issue premium)
  • Listed value of the securities received
  • Market value of the asset or right contributed

Reduction coefficients (transitional regime)

For assets acquired before 31 December 1994 and transferred before reaching a cumulative transfer value of €400,000 (since 2015), part of the gain may be reduced using abatement coefficients:

  • Only the gain generated before 20 January 2006 is reduced
  • The coefficients depend on the type of asset and the years of ownership as at 31/12/1996
  • For real estate: 11.11% per year of ownership; for securities and other assets: 25% and 14.28% per year respectively

Temporal imputation: in which year is it declared?

The general rule is that the gain or loss is attributed to the year in which the alteration in the estate occurs (normally, when the contract is signed or the asset is delivered).

Key exceptions

  • Instalment or deferred payment transactions: you may opt to attribute proportionally as the instalments are received.
  • Public aid: attributed in the year of receipt.
  • Losses from bad debts: attributed when insolvency is established (insolvency proceedings, or more than one year since the default if conditions are met).

Integration and compensation in the taxable base

Capital gains and losses are divided into two groups:

Type Where included
Derived from transfers with a generation period of any duration (including those under 1 year) Savings taxable base
Not derived from transfers (gaming prizes, subsidies, asset incorporations, etc.) General taxable base
  • Derived from transfers with a generation period of any duration (including those under 1 year)

    Where included Savings taxable base

  • Not derived from transfers (gaming prizes, subsidies, asset incorporations, etc.)

    Where included General taxable base

Compensation of losses

  • Savings losses first offset savings gains from the same year.
  • The negative balance may be offset against the positive balance of investment income up to 25% of that positive balance.
  • The remaining negative balance may be carried forward to the 4 following tax years.

Relevant special cases

Exit tax (change of residence)

If you lose your taxpayer status by transferring your habitual residence abroad and hold shares or interests with a market value exceeding €4,000,000 (or with a shareholding exceeding 25% in entities with a market value over €1,000,000), you must pay tax on the "latent" gain even though you have not sold.

You may request a deferral of payment if the relocation is for employment reasons or is temporary.

Transfer of main home with reinvestment: example

A married couple aged 70 and 68 sell their main home in 2025 for €250,000. They acquired it in 1980 for €60,000 (including expenses). Since both are over 65, the capital gain is fully exempt, regardless of whether or not they reinvest the amount.

Transfer between investment funds

If you hold units in a fund and transfer them to another without receiving any money, you are not taxed at that point. The new units retain the seniority and acquisition value of the original ones, so taxation is deferred until the final redemption.