← Crypto cost basis calculator
If you bought the same coin at different prices and later sold some of it, your gain depends on which purchase the sale is matched to. The trades are identical; the matching rule is not, and it can move the estimated tax by thousands of dollars. This page walks one small example through each rule.
An invented investor, all in one account. They buy 0.5 BTC on 2023-01-10 for $10,000 plus a $10 fee, 0.5 BTC on 2023-06-15 for $15,000 plus $15, and 0.25 BTC on 2024-02-01 for $12,000 plus $12. On 2024-03-05 they receive 2 ETH from staking worth $5,000. In 2024 they sell 0.6 BTC on 2024-09-20 for $36,000 less a $36 fee, and 1 ETH on 2024-11-02 for $3,300 less a $3 fee. We assume a 24% short-term and 15% long-term rate.
| Method | Short-term gain | Long-term gain | Total gain | Estimated tax |
|---|---|---|---|---|
| FIFO | $797 | $22,951 | $23,748 | $3,634 |
| LIFO | $3,770 | $10,469 | $14,239 | $2,475 |
| HIFO | $3,770 | $10,469 | $14,239 | $2,475 |
| LOFO | $797 | $22,951 | $23,748 | $3,634 |
FIFO sells the two oldest lots: all 0.5 BTC bought in January 2023 (basis $10,010) and 0.1 BTC of the June lot (basis $3,003). Proceeds are $35,964, so the gain is $22,951, all long-term. HIFO sells the coins that cost the most per BTC, the February 2024 lot ($48,048 per BTC) and then part of the June 2023 lot ($30,030 per BTC), so basis rises to $22,522.50 and the gain falls to $13,441.50 across a short-term and a long-term piece. The ETH sale is short-term under every method, with a $797 gain on $2,500 of basis.
Gains on coins held for more than one year are taxed at long-term rates, which are lower; gains on coins held a year or less are taxed as ordinary income. A high-basis lot you bought recently is short-term, so selling it first can cut the gain but raise the rate. The calculator therefore compares estimated tax as well as gain, and offers a tax-aware rule that orders lots by the tax each coin would trigger at the two rates you enter. That rule picks one sale at a time, so it is a heuristic, not a guarantee of the best plan across a whole year.
Nothing is uploaded: the matching runs in your browser, which matters for a file listing everything you have ever bought.
Usually HIFO, because it sells the coins you paid the most for first. But the holding period matters too: selling a higher-basis coin you have held under a year can cost more tax than selling a lower-basis coin held over a year, because short-term gains are taxed at ordinary rates. That is why the calculator compares tax, not just gain.
In the United States, property sold without identifying specific units is generally treated as first in, first out. Using HIFO or another method generally relies on identifying the units at the time of sale and keeping records that prove it. Ask a tax professional what applies to you.
Exchanges often compute basis only from what happened on their own platform. Coins moved in from elsewhere arrive with no basis, and coins moved out take their history with them. Entering every purchase in one CSV, tagged by wallet, is how you find the gaps; the calculator flags any sale larger than the lots on record.