Cryptocurrency trading: how the FIFO method works in practice
The FIFO (First In, First Out) method is the only valuation method that Spanish regulations allow to calculate gains and losses on cryptocurrency transmissions. In this article we explain it with real examples.
What is FIFO?
FIFO means that when you sell units of a cryptocurrency, you are considered to sell the units you bought earlier in time first. The sales order is chronological from the oldest.
This is crucial because in volatile markets, the purchase price varies greatly and the order directly affects the calculated profit.
Basic example
Bitcoin purchase history:
- Jan 1, 2024: Buy 0.5 BTC at €40,000 = Cost €20,000
- Mar 1, 2024: Buy 0.5 BTC at €60,000 = Cost €30,000
- Jun 1, 2024: Buy 0.3 BTC at €70,000 = Cost €21,000
Sale:
- Dec 1, 2024: Sale 0.6 BTC at €90,000 = Income €54,000
Applying FIFO (oldest first):
- First 0.5 BTC: cost €20,000
- Next 0.1 BTC (from March purchase): cost 30,000 × (0.1/0.5) = €6,000
- Total cost of the 0.6 BTC sold: 20,000 + 6,000 = €26,000
Profit = 54,000 - 26,000 = €28,000
If you had applied LIFO (last entries first), the gain would be less. But LIFO is not allowed in Spain.
Special cases of FIFO
Multiple exchanges
FIFO applies per cryptocurrency, not per exchange. If you have BTC on Binance and BTC on Coinbase, they are pooled into a single exchange and FIFO is applied to the total.
This means that you must maintain a unified record of all your purchases of each cryptocurrency, regardless of the exchange.
Crypto received by staking or airdrop
When you receive crypto by staking or airdrop:
- Their acquisition cost is the market value at the time of receipt.
- They enter the "FIFO queue" as if you had bought them at that price.
Exchanges between cryptocurrencies
When you exchange BTC for ETH, from the FIFO point of view:
- A "sale" of BTC is generated (removing the oldest units).
- A "buy" of ETH is generated at the current market price.
Commissions
Exchange commissions reduce the effective sale price:
- Sale of 1 BTC at €80,000 with commission of €100 → net price: €79,900
Purchase commissions are added to the acquisition cost.
Common errors when applying FIFO
- Ignore minor exchanges: The AEAT can cross-reference data from Kraken, OKX, Coinbase, etc. All operations must be included.
- Not reporting crypto-to-crypto swaps: Many traders do not declare crypto-to-crypto exchanges.
- Mix FIFO by exchange instead of by currency: This is incorrect. The FIFO is per asset type, not per platform.
- Forget commissions: They underestimate the acquisition cost or overestimate the profit.
Tools for automatic FIFO
Doing the FIFO calculation manually with hundreds of operations is unfeasible. declaracrypto.es imports your CSVs from exchanges and automatically calculates the capital gain with FIFO, ready to transfer to the declaration.
Updated: April 2026 | Fiscal year: 2025


