Crypto-to-crypto swaps: every trade is a disposal
Swapping BTC for ETH, or any token for a stablecoin, is not moving money between pockets. For the Spanish tax agency it is an exchange: you give one asset and receive another, and that realises the gain or loss built up in what you give.
Why it is taxable
Article 37.1.h of the Income Tax Act treats an exchange as a change in your assets, and the DGT applies it to cryptocurrencies (rulings V0999-18 and V1604-18). It is a capital gain or loss from a disposal and goes to the savings base, just like a sale for euros.
What counts as a swap
A DEX swap, trading against stablecoins, switching token inside a rebalance, or reinvesting a claimed reward into another token. They are all the same thing. Moving the same token between your own wallets, by contrast, is not a swap and is not taxed.
How it is valued
The side you give is the one taxed. The transfer value is the market value of the trade minus fees, and the law asks for the greater of the value you give and the value you receive. On an AMM they usually match, but with high slippage or illiquid pairs they can drift apart. The cost of the lots consumed is then subtracted from that value.
What you receive starts a new lot
The token received does not inherit the cost of the one you gave: it starts with the market value of the swap as its acquisition cost. That keeps the total gain along a chain of swaps exact, never counted twice and never lost along the way.
FIFO across all your wallets
Units of the same asset form a single chronological queue per holder, whether they sit on an exchange or in a cold wallet: the first bought are the first sold. The DGT has confirmed this in several rulings, including V0999-18 and V1550-25, which rules out calculating it per platform. A judgment of the Basque Country High Court questions FIFO for cryptocurrencies, but it is regional law and not binding in the rest of Spain.
Fees
The fee on a swap, including swap gas, reduces the transfer value (art. 35 of the Income Tax Act). If one trade gives several tokens, the fee is split in proportion to their value and subtracted only once. The fee on a transfer between your own wallets is irrelevant for income tax.
What PortCodex does with this
PortCodex treats every crypto-to-crypto swap as a taxable event: it works out the gain or loss on the side you give by consuming lots with FIFO across your whole history, and opens a new lot for the token you receive. The same applies to token changes inside a rebalance or a reward reinvestment. If lots are missing because history is missing, it does not invent a cost: it flags which disposals have no acquisition cost. It does not replace a tax advisor.
Private beta
Every swap, worked out with FIFO
PortCodex is in private beta. Leave your email and, when there is room, it will work out the gain or loss on each swap by consuming lots with FIFO across your whole history.
Sources: arts. 35, 37.1.h and 37.2 of Law 35/2006 on Personal Income Tax; DGT binding rulings V0999-18, V1604-18, V0975-22, V2520-22, V0525-25, V1550-25 and V0648-24; Basque Country High Court judgment of 9 January 2025.
Informational guide, written from the criteria published by the DGT. It is not tax advice: for your specific case, talk to an advisor.