Our guide on keeping records of your Base wallet activity covers what to log every time you transact: the date, the amounts, the value at the time, and the fees. That article mentions in passing that swapping one token for another is often a taxable event and that your cost basis matters. This one goes a level deeper into what cost basis actually is, and why the method you use to calculate it can change the answer.
What cost basis actually means
Cost basis is simply what you paid to acquire an asset, including any fees. If you buy one ETH for $2,000, your cost basis for that ETH is $2,000. Later, if you sell or swap it when it is worth $2,500, your gain is the difference: $500. That part is not complicated when you only ever hold one batch of a token.
The complication shows up the moment you acquire the same token more than once, at different prices. Say you buy 1 ETH at $2,000 in one transaction, then buy another 1 ETH at $2,600 a few weeks later. Now you hold 2 ETH, but they do not have the same cost basis. If you later swap 1 ETH away, which $2,000 or $2,600 did you actually sell? The blockchain does not tag individual units of ETH with a purchase price, so nothing on chain answers that question for you. An accounting method has to decide it.
Why this matters more with active swapping
If you buy a token once and hold it for years, you never run into this. It only becomes relevant once you are swapping the same token in and out repeatedly, which is exactly what a lot of activity on a swap-focused wallet looks like. Every additional purchase of the same asset, at a different price, adds another batch with its own basis, and every partial sale has to draw from one or more of those batches.
The three common methods
FIFO, first in first out. The oldest batch you acquired is treated as the one you sell first. In the example above, selling 1 ETH would use up the $2,000 batch, leaving the $2,600 batch untouched. FIFO is the default assumption in many jurisdictions when no other method is specified, and it tends to be the simplest to explain and audit.
LIFO, last in first out. The most recently acquired batch is treated as the one you sell first. Selling 1 ETH in the example would use the $2,600 batch, leaving the older $2,000 batch. LIFO is not accepted for tax purposes everywhere, so whether it is even an option depends on where you file.
HIFO, highest in first out. The batch with the highest cost basis is sold first, regardless of when it was acquired. In the example, this also picks the $2,600 batch, since it happens to be the higher one. HIFO is popular in crypto specifically because, all else equal, selling your highest-basis units first tends to minimize the taxable gain you report in a given transaction. Some jurisdictions allow it, others do not, and some only allow it under specific record-keeping conditions.
A simple worked example
Suppose you make three purchases of the same token over time:
- Batch A: 10 tokens at $1 each
- Batch B: 10 tokens at $3 each
- Batch C: 10 tokens at $2 each
You then swap 15 tokens away when the price is $4.
Under FIFO, you use all 10 of Batch A and 5 of Batch B. Your cost basis for the 15 tokens is (10 x $1) + (5 x $3) = $25, so your gain is (15 x $4) minus $25, which is $35.
Under LIFO, you use all 10 of Batch B and 5 of Batch C. Your cost basis is (10 x $3) + (5 x $2) = $40, so your gain is $60 minus $40, which is $20.
Under HIFO, you use all 10 of Batch B (the highest basis) and 5 of Batch A. Your cost basis is (10 x $3) + (5 x $1) = $35, so your gain is $60 minus $35, which is $25.
Same three purchases, same single sale, three different reported gains. Nothing about the transaction itself changed. Only the accounting method did.
What this means in practice
Two things follow from this. First, the method you use has to be applied consistently, not picked transaction by transaction to whichever gives the lowest number. Most jurisdictions expect a defined method used throughout a tax year, and some restrict which methods are allowed at all. Second, none of this works without the underlying data: what you paid for each batch, and when. That is exactly what the record-keeping habit from our earlier guide is for. A method can only calculate correctly from records that actually capture each purchase separately, which is one more reason to log a value and a date at the time of the transaction rather than trying to reconstruct it later.
Portfolio and tax software built for crypto usually let you choose a method and will apply it automatically across your transaction history once you have imported it, which is far less error-prone than tracking batches by hand once you have more than a handful.
This is not tax advice
Which methods are permitted, how they must be applied, and what counts as a taxable event in the first place all vary by jurisdiction and change over time. This article explains the mechanics of cost basis accounting in general terms so the concept is not a mystery when you encounter it. It is not a recommendation for how to handle your own filings. If you need to know which method applies to you, or whether you can switch between them, talk to a qualified tax professional in your jurisdiction, and bring your transaction records with you.