If you bought the same asset more than once at different prices and then sold part of your holding, something has to decide which purchase you sold. That decision is a cost-basis method, and it can change the taxable gain on an identical trade by a factor of five.
This is not a loophole and it is not clever. It is an accounting choice, it is usually constrained by where you live, and the version that looks best today is often just the version that defers the bill.
The short version
Three methods dominate:
- FIFO — first in, first out. The oldest purchase is sold first.
- LIFO — last in, first out. The newest purchase is sold first.
- HIFO — highest in, first out. The most expensive purchase is sold first.
The gain is proceeds minus cost basis. Same proceeds every time, because you sold the same thing for the same money. Different basis, because you nominated a different purchase.
HIFO minimises the gain now. It also leaves you holding the cheapest coins, so it maximises the gain later. Nothing is created. The tax is moved.
Worked example, with every number shown
Three purchases, one sale. Fees included, because they belong in the basis.
| Quantity | Unit price | Fee | |
|---|---|---|---|
| Buy 1 | 1 | 20,000 | 20 |
| Buy 2 | 1 | 60,000 | 60 |
| Buy 3 | 1 | 40,000 | 40 |
| Sell | 1 | 70,000 | 70 |
Proceeds are the same under every method, because the sale is the same sale.
Now the three answers:
| Method | Lot sold | Cost basis | Realised gain |
|---|---|---|---|
| FIFO | Buy 1 @ 20,000 | 20,020 | 49,910 |
| LIFO | Buy 3 @ 40,000 | 40,040 | 29,890 |
| HIFO | Buy 2 @ 60,000 | 60,060 | 9,870 |
FIFO: 69,930 − 20,020 = 49,910
LIFO: 69,930 − 40,040 = 29,890
HIFO: 69,930 − 60,060 = 9,870
Identical trade. The gain ranges from 9,870 to 49,910 — a difference of 40,040, or five times. At a 20% rate that is 8,008 of tax hanging on a choice of method.
The part the headline number hides
Look at what is left in the account afterwards.
| Method | Remaining quantity | Remaining cost basis | Average unit cost |
|---|---|---|---|
| FIFO | 2 | 100,100 | 50,050 |
| LIFO | 2 | 80,080 | 40,040 |
| HIFO | 2 | 60,060 | 30,030 |
HIFO produced the smallest gain today and left the cheapest two coins behind — an average unit cost of 30,030 against FIFO’s 50,050. Sell those later and the gain is 20,020 larger per coin than it would have been under FIFO.
Across the whole holding period, if you eventually sell everything, the total gain is identical under all three methods. It has to be: total gain is total proceeds minus total cost, and neither depends on the order you matched them in. The methods only decide when the gain is recognised.
That still matters, and sometimes a lot:
- Deferral is worth money, because tax paid later is paid with cheaper money and the amount stays invested in the meantime.
- Rates change. Realising a gain in a low-rate year and deferring into a high-rate year is a real loss.
- Allowances are annual and do not carry forward in most systems. A gain small enough to disappear inside an annual exemption is worth more than the same gain deferred into a year where it will not.
- If you never sell the rest, the deferred gain may never be realised at all.
The mistakes that actually cost money
Leaving fees out of the basis. In the example above the fees are small, and they still moved the basis by 20 to 60 per lot. Acquisition fees increase the basis, disposal fees reduce the proceeds, and both reduce the gain. Omitting them means overstating gains and overpaying.
Assuming you may choose. Many jurisdictions mandate a method. The United Kingdom uses share pooling with same-day and 30-day matching rules, which is not on this list at all. Ireland uses FIFO. Others allow specific identification only if you identified the lot at the time of the sale, not at the time of the tax return. Check the rule that binds you before optimising against a rule that does not.
Switching methods between years to suit the outcome. Where a choice exists it is usually a consistency requirement, not a per-trade election.
Treating HIFO as free. It is a deferral, and the table of remaining basis above is the receipt.
Matching by hand across hundreds of trades. This is where the real errors live. The arithmetic is trivial and the bookkeeping is not, especially across exchanges, transfers and partial fills.
What this does not model
No jurisdiction’s rules. This is the mechanical matching of disposals to acquisitions under three common conventions, and it is deliberately not tax advice — it does not know about pooling, wash sales, same-day rules, 30-day rules, holding-period distinctions between short and long-term rates, allowances, losses carried forward, or anything about your circumstances.
It also assumes every lot is denominated in one currency and that quantities match cleanly. Real histories include transfers between wallets that are not disposals, forks and airdrops with a basis of their own, and disposals that partially consume a lot.
Use it to understand the mechanism and to sanity-check what your accountant or your tax software produced. Do not use it as the return.