Disposal and exchange of crypto-assets: capital gains and losses
Selling or swapping crypto-assets, where it takes place outside a business activity, gives rise to a capital gain or loss in Spanish personal income tax (IRPF). A sale for euros is analysed under Articles 33 to 35 of the Personal Income Tax Act (LIRPF); the exchange of one crypto-asset for another is technically characterised as a barter (permuta), governed by Article 37.1.h of the same Act. It is worth starting from this distinction, because both the moment at which tax is due and the way the result is calculated depend on it.
The taxable event: when the obligation to pay tax arises
The taxable event occurs when the taxpayer ceases to own the asset transferred. This happens, for example, on selling through an exchange or by way of a transaction between private parties, on swapping one crypto-asset for another on a decentralised exchange (DEX), and also on using crypto-assets to pay for goods or services.
The most widespread error is to think that the obligation arises when the money is withdrawn from the exchange to the bank account. It does not. If bitcoins are sold on 15 December and the euros are not withdrawn until January, the gain is taxed in the tax year of the sale, not in the year the cash is received. What the law taxes is the change in net worth produced by the disposal, regardless of when the cash is actually accessed.
How the gain is calculated: transfer value and acquisition value
The gain or loss is the difference between the transfer value and the acquisition value.
The transfer value is the price in euros obtained on the sale, reduced by the expenses and costs associated with it. In an exchange of one crypto-asset for another the rule is somewhat different: Article 37.1.h LIRPF determines the gain or loss as the difference between the acquisition value of the asset given up and the greater of two values —the euro market value of the asset handed over or that of the asset received in exchange— both taken at the time of the transaction. In a swap between liquid crypto-assets the two values will usually coincide; the distinction becomes relevant where one of the assets lacks a deep market.
The acquisition value is made up of the price paid when buying the crypto-asset plus all the expenses associated with that purchase: exchange fees, network fees —gas on Ethereum or miner fees on Bitcoin— and any other cost directly attributable to the acquisition. This is the general rule of Article 35 LIRPF —the expenses and taxes inherent to the acquisition and to the transfer form part of the respective values—, which the DGT has expressly extended to crypto fees in ruling V0648-24. The point is not a minor one, because anyone who fails to add those expenses to the purchase price ends up paying tax on a larger gain than the one actually obtained.
Not every cost associated with the activity, however, reduces the gain. The DGT has clarified that the fees paid to a bot or automated trading system —both the fixed fee and the success fee, a percentage of the net profit for the period— are not an expense “inherent” to the acquisition or transfer within the meaning of Article 35 LIRPF, because they remunerate the overall result of the period and not specific transactions; they therefore neither reduce the capital gain nor are deductible under any other heading (V1950-21, rendered on a foreign-currency trading robot but with a criterion fully transposable to crypto-asset bots). It is an asymmetry worth bearing in mind against mining, where there is indeed an economic activity with deductible expenses: anyone operating with paid bots on a wealth-management basis bears their cost with no tax effect at all.
The FIFO criterion: settled administrative doctrine, with a regional caveat
Where there are several acquisitions of the same crypto-asset at different prices and a partial sale is made, a practical question arises: which units are deemed to have been sold, the oldest or the most recent? The answer determines the calculation of the gain.
State-level administrative doctrine applies the FIFO criterion (first in, first out): the units acquired first are deemed to be transferred first. The DGT has reiterated this expressly in ruling V0525-25, in line with rulings V1604-18, V0975-22 and V0648-24. The reasoning is as follows: crypto-assets of the same type derive from the same protocol and are identical to one another, so they constitute fungible and homogeneous assets; and, in the absence of a specific rule in the Personal Income Tax Act, the DGT applies by analogy the FIFO criterion that the Act itself lays down for the transfer of homogeneous securities and participations (Articles 37.2 and 54.5 LIRPF), transposing it to cryptocurrencies given their fungible nature. FIFO in crypto-assets is therefore a doctrinal criterion, and not an express rule introduced by any legislative reform.
It should be noted that this position is not undisputed. The High Court of Justice of the Basque Country, in its judgment 37/2025 of 9 January 2025, has denied —within the scope of Basque regional (foral) legislation— that there is sufficient legal basis to impose the FIFO method. The judgment opens a line of debate, but its scope must be placed precisely: it is handed down on regional legislation and resolves a specific case. For a taxpayer subject to state legislation, the prudent position, aligned with the current criterion of the DGT and the tax authority (AEAT), remains to calculate partial sales by applying FIFO.
Let us look at an example. The bitcoin figures do not correspond to the dates indicated; they serve only to illustrate the calculation:
- 15/01/2023: purchase of 1 BTC at €20,000, fee €100. Total cost: €20,100.
- 01/03/2023: purchase of 0.5 BTC at €25,000, fee €50. Total cost: €12,550.
- 10/05/2023: purchase of 1.5 BTC at €28,000, fee €150. Total cost: €42,150.
- 15/06/2023: sale of 2 BTC at €26,000 each, sale fee €500. Net proceeds: €51,500.
Applying FIFO, the 2 BTC sold come from the first lot (1 BTC, €20,100), the entire second lot (0.5 BTC, €12,550) and 0.5 BTC from the third lot (0.5/1.5 × 42,150 = €14,050). The combined acquisition value is 20,100 + 12,550 + 14,050 = €46,700, and the gain, 51,500 − 46,700 = €4,800.
Savings rates and offsetting of losses
Gains arising from the disposal or exchange of crypto-assets are included, as a general rule, in the savings tax base. For the current tax year, the applicable scale is 19% up to €6,000, 21% between €6,000 and €50,000, 23% between €50,000 and €200,000, 27% between €200,000 and €300,000 and 30% on the excess above €300,000. Following the previous example, the €4,800 gain would be taxed at 19%, giving a tax charge of €912.
Capital losses are offset, first, against capital gains within the savings base for the same tax year. If that produces a negative balance, it may be offset against positive investment income within the savings base, but only up to a limit of 25% of that income. The unoffset remainder is carried forward to the following four tax years, in that same order. It should be noted that only losses arising from a transfer are included in the savings base; those that do not arise from a transfer —for example, the loss of the keys or the irrecoverable balance after the failure of an exchange— follow the general-base regime (Article 48 LIRPF). One point is often confused: that 25% limit operates only in the cross-offsetting against investment income; there is no percentage limit on offsetting carried-forward losses against future savings-base capital gains. Thus, if €10,000 of losses were obtained in one year and €15,000 of savings-base capital gains are generated the next, the net balance for that second year is €5,000.
One recurring question remains: is there, for crypto-assets, a “lock-out” rule preventing a loss from being recognised if the same asset is repurchased shortly afterwards, as happens with listed shares? In our view, two planes should be kept apart. On the one hand, the two-month “homogeneous securities” rule of Article 33.5.f) LIRPF refers to securities admitted to trading, and the DGT itself (ruling V0525-25) has clarified that crypto-assets, despite being treated as homogeneous assets for FIFO purposes, do not fit the technical concept of “homogeneous securities” in Article 8 of the Personal Income Tax Regulation. On the other hand, it does not follow from that conclusion that every loss on repurchase is freely deductible: as they are assets, the general rule of Article 33.5.e) —which defers the loss where the same asset is reacquired within the year following the disposal— cannot be ruled out in advance. A different conclusion might be reached, moreover, for those crypto-assets that, by their configuration, qualified as tradable securities.
Exchanges between crypto-assets: the taxable event that goes unnoticed
Swapping bitcoin for ether, or ether for a stablecoin such as USDC or USDT, on a decentralised market or a centralised exchange, produces for tax purposes the same taxable event as a sale followed by a purchase. The DGT treats it as a barter (Article 37.1.h LIRPF and Article 1538 of the Civil Code). Under that rule, the gain or loss is the difference between the acquisition value of the asset given up and the greater of two values: the euro market value of the asset handed over or that of the asset received in exchange, both taken at the time of the exchange. In a swap between liquid crypto-assets the two values coincide, so the practical result is unchanged; the distinction matters where one of the assets lacks a deep market.
The practical consequence is worth underlining, because it is the one most often overlooked. Anyone who carries out dozens of exchanges over the year accumulates dozens of taxable events to report, even though at no point have they converted their crypto-assets into euros. Hence the need to keep an orderly record of all transactions.
Common errors and the consequences of not reporting
The most frequent errors are four: reporting only sales for euros, in the belief that “as long as the money does not leave the exchange there is nothing to report”; failing to add fees and gas fees to the acquisition value; applying a lot criterion other than FIFO (average cost or LIFO); and not recovering losses from prior years that could reduce the tax charge.
Where the position is regularised late but voluntarily, the surcharge for late self-assessment without prior demand of Article 27 LGT comes into play: 1% plus a further 1% for each full month of delay, up to 15% from twelve months onwards (with an additional 25% reduction for prompt payment). As this is a voluntary disclosure, no penalty is imposed. The position is different where the activity surfaces in a tax audit or inspection, in which case penalty proceedings may indeed be opened. In any event, the visibility of crypto activity grows each year: to the block of reporting obligations already in force are added the European rollout of DAC8 and the gradual implementation of the new reporting forms in Spain.
- V0999-18 · V1149-18 — the exchange between cryptocurrencies is characterised as a barter and gives rise to a capital gain or loss at the moment of the swap.
- V1604-18 · V0975-22 · V0648-24 · V0525-25 — cryptocurrencies as homogeneous assets and identification of the units transferred under the FIFO criterion; inclusion of fees and gas fees in the acquisition value.
- Judgment of the High Court of Justice of the Basque Country (Administrative Chamber, Section 1) no. 37/2025 of 9 January 2025 (appeal 75/2024; ECLI:ES:TSJPV:2025:41) — questions, within the regional (foral) regime, the imposition of the FIFO method on the transfer of cryptocurrencies.
Applicable legislation: Articles 33, 34, 35, 37.1.h) and 33.5 LIRPF; Article 8 of the Personal Income Tax Regulation; Article 27 LGT.