Disposal and exchange of crypto-assets: capital gains and losses under IRPF
Selling bitcoin for euros, bartering ether for a stablecoin or paying for a service with crypto-assets are transactions a private individual carries out without considering their tax consequences, and all three produce, outside any business activity, the same effect for Income Tax (IRPF) purposes, namely a capital gain or loss to be reported. To assess it correctly one needs to know when it accrues, how the result is calculated when not a single euro has been received, and which units are deemed disposed of when the asset was acquired in several purchases and at different prices.
The law distinguishes two cases. A sale for euros is governed by the general regime for capital gains and losses in Articles 33 to 35 of the Personal Income Tax Act (LIRPF). The exchange for another crypto-asset constitutes a barter (permuta), governed by Article 37.1.h of the same Act. Both the time of accrual and the way the result of the transaction is calculated depend on this distinction, so we shall keep to it throughout.
The taxable event: when the obligation to pay tax arises
The taxable event takes place when the taxpayer loses ownership of the asset transferred: on selling it on an exchange or to another private individual, on bartering it for another crypto-asset on a decentralised market, and on using it as a means of payment for goods or services.
The most widespread error is to consider that the obligation arises when the funds are transferred from the exchange to the bank account. If bitcoins are sold on 15 December and the euros are not withdrawn until January, the gain is allocated to the tax year of the sale, not to that of the withdrawal. What the rule taxes is the change in net worth produced by the transfer, regardless of when the fiat money is drawn on.
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, less the expenses and taxes inherent to it. In a barter of one crypto-asset for another the rule is 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 usually coincide; the distinction becomes relevant where one of the assets lacks a market of sufficient depth.
The acquisition value consists of the amount paid on the purchase plus the expenses inherent to it: 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, under which the expenses and taxes inherent to the acquisition and to the transfer form part of the respective values, and the DGT has expressly extended it to crypto fees in ruling V0648-24.
Not every cost of the activity, however, reduces the capital gain. The DGT has specified 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 (ruling V1950-21, issued on foreign-exchange robo-trading, whose criterion can be carried over to crypto-asset trading bots). Unlike mining, where there is indeed a business activity with deductible expenses, anyone who uses paid bots as part of managing their own assets bears their cost with no possibility of deducting it, unless there is a business activity, which the DGT rules out for own-account trading even when automated (ruling V2232-25).
The FIFO criterion: DGT doctrine, with a regional caveat
Where the same crypto-asset has been acquired in several purchases at different prices and only part of it is disposed of, one has to determine which units are deemed disposed of, the oldest or the most recent, because the acquisition value, and with it the gain, depends on that choice.
State administrative doctrine applies the FIFO criterion (first in, first out), under which 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 DGT reasons that cryptocurrencies of the same type derive from the same protocol and are identical to one another, so that they constitute fungible and homogeneous assets; and, in the absence of a specific rule in the Personal Income Tax Act, it applies by analogy the FIFO criterion that the Act itself lays down in other cases (Articles 37.2 and 54.5 LIRPF), extending it to cryptocurrencies on account of their fungible nature. FIFO for crypto-assets is therefore a doctrinal criterion, and not an express rule laid down in any legislation.
Note 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 reach must be stated precisely, since it was handed down on regional legislation and decides a specific case. For a taxpayer subject to state legislation, the prudent position, aligned with the current criterion of the DGT and the AEAT, remains to apply FIFO to partial disposals. It should be noted, however, that the concept of fungibility is less clear when applied to the Bitcoin ecosystem: it could be argued that, while the smallest unit of bitcoin (the satoshi) is fungible, the UTXO is not.
Suppose three acquisitions and one disposal. The prices do not correspond to the actual quotations on those dates; 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. Transfer value: €51,500.
Applying FIFO, the 2 BTC disposed of come from the first lot (1 BTC, €20,100), from the whole of the second lot (0.5 BTC, €12,550) and from 0.5 BTC of 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. If, instead, the units disposed of were identified by the UTXOs actually spent (which is only possible in self-custody) and the taxpayer had chosen to spend those from the two most recent purchases, the 2 BTC would correspond to the whole of the third lot (1.5 BTC, €42,150) and to the second (0.5 BTC, €12,550). The acquisition value would be €54,700, and the result a loss of 51,500 − 54,700 = −€3,200.
Savings rates and offsetting of losses
Gains arising from the transfer 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 over €300,000. Following the example above, the €4,800 gain would be taxed at 19%, which gives a tax liability of €912.
Capital losses are offset, first, against the capital gains of the savings base for the same tax year. If that integration 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. Any balance not offset may be offset in the following four tax years, in the same order.
It should be made clear that only losses arising from a transfer are included in the savings base. Those that do not derive from a transfer, such as a loss from a cyber-fraud (ruling V1828-24) or the balance held on a failed exchange once the claim proves uncollectable (Article 14.2.k LIRPF), are included in the general IRPF tax base (Article 48 LIRPF). The loss of the private key has no administrative criterion, as we explain in the analysis on hacks, scams and losses.
Another common issue is whether, for crypto-assets, there is a “quarantine” rule (akin to a wash-sale rule) preventing the loss from being recognised where the same asset is repurchased shortly afterwards, as happens with listed shares. The two-month rule that Article 33.5.f) LIRPF applies to “homogeneous securities” refers to securities admitted to trading, and the DGT itself (ruling V0525-25) has made clear that cryptocurrencies, although 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. That said, it does not follow from that conclusion that every loss on repurchase may be freely recognised: since they are assets, the application of the general rule of Article 33.5.e), which defers the recognition of the loss where the same asset is reacquired within the year following the transfer, cannot be ruled out in advance.
Exchanges between crypto-assets: the taxable event that goes unnoticed
Bartering bitcoin for ether, or ether for a stablecoin such as USDC or USDT, on a decentralised market or on a centralised exchange, produces for tax purposes the same taxable event as a sale followed by a purchase. The DGT has consistently treated it as a barter (Article 37.1.h LIRPF and Article 1538 of the Civil Code). Under that rule, the gain or loss is calculated as the difference between the acquisition value of the asset handed over 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 swap. In a swap between liquid crypto-assets the two values coincide, so the practical result does not change.
Carrying out dozens of barters over the year means accumulating as many taxable events to report, even though the taxpayer has at no point converted the crypto-assets into euros, which is why keeping an orderly record of every transaction is indispensable.
Common errors and the consequences of not reporting
The most common errors are 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-identification criterion other than FIFO, such as average cost or LIFO; and failing to offset losses pending from prior years.
Where the regularisation is late but voluntary, the surcharge for late filing without prior demand under Article 27 LGT applies: 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 the regularisation is spontaneous, no penalty applies. The position is different where the activity comes to light in a tax audit or inspection, in which case penalty proceedings may indeed be opened. The visibility of crypto activity, moreover, is increasing, since to the block of reporting obligations already in force are added the European rollout of DAC8 and the gradual introduction 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 time 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.
- V1950-21, of 21 June 2021 — the fixed and success fees of a robo-trading service are not an expense inherent to the acquisition or transfer and do not reduce the capital gain.
- 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.