Crypto Cost Basis Calculator (FIFO and Average)
Bought a coin several times at different prices and sold some? See the cost of the coins sold, and the gain or loss, by first in, first out (FIFO) and by average cost (pooling), side by side, with what is left. A method calculator: it does not work out tax.
- Gain or loss, FIFO · in your price currency
- –
- Gain or loss, average cost
- –
- Cost of the coins sold, FIFO
- –
- Cost of the coins sold, average cost
- –
- Average cost per coin (before the sale)
- –
- Coins left
- –
- Cost of the coins left, FIFO
- –
- Cost of the coins left, average cost
- –
Assumptions
- Buys are entered oldest first, and each total cost already includes its fees.
- The amount received for the coins sold is after the sell fee.
- A method calculator only: your tax authority's extra matching rules are not applied.
Checked HMRC Cryptoassets Manual CRYPTO22200: pooling (section 104 pool for each token type) All sources
Where the coins sold come from
| Buy | Coins bought | Cost per coin | Taken by FIFO | Taken by average cost |
|---|---|---|---|---|
| Buy 1 | 100 | 10 | 50 | 33.33333333 |
| Buy 2 | 50 | 2,500 | 0 | 16.66666667 |
| Total | 150 | 840 | 50 | 50 |
How it is calculated
- FIFO: the coins sold come from the oldest buy first; each buy's cost is used in proportion to the coins taken from it
- Average cost (pool): cost of the coins sold = total cost of all buys × coins sold ÷ coins bought
- Gain or loss = amount received − cost of the coins sold
- Cost of the coins left = total cost − cost of the coins sold
Worked example
HMRC's own pooling example (CRYPTO22251): 100 tokens bought for 1,000 and 50 for 125,000, then 50 sold for 300,000.
| You enter | |
|---|---|
| Buy 1: coins | 100 |
| Buy 1: total cost | 1,000 |
| Buy 2: coins | 50 |
| Buy 2: total cost | 125,000 |
| Coins sold | 50 |
| Received for them | 300,000 |
| You get | |
| Gain or loss, FIFO | 299,500 |
| Gain or loss, average cost | 258,000 |
| Cost of the coins sold, FIFO | 500 |
| Cost of the coins sold, average cost | 42,000 |
| Average cost per coin (before the sale) | 840 |
| Coins left | 100 |
| Cost of the coins left, FIFO | 125,500 |
| Cost of the coins left, average cost | 84,000 |
By FIFO the coins sold cost 500, a gain of 299,500. By average cost they cost 42,000, a gain of 258,000.
Questions
Which method should I use?
The one your tax authority requires. This tool shows both so you can see the difference; it does not choose for you. If you are unsure, ask your tax authority or a qualified tax adviser.
Why do FIFO and average cost give different gains?
FIFO uses the price of your oldest coins first. If you bought cheaply long ago and dearly later, FIFO gives a lower cost and a higher gain now, and leaves the dearer coins for later. Average cost spreads every buy's price evenly.
Does this include the UK same-day and 30-day rules?
No. Those rules match buys on the same day, or within 30 days after a sale, before the pool is used. If you bought the same coin on the day of the sale or within 30 days after it, the UK result can differ from this tool.
Should fees be in the cost?
Enter each buy's total cost with its fee, and the amount received after the sell fee. Whether a fee counts as cost is a tax rule of your country.
Sources and checks
- HMRC Cryptoassets Manual CRYPTO22200: pooling (section 104 pool for each token type) · updated by the authority to 28 November 2025
- HMRC Cryptoassets Manual CRYPTO22251: basic pool disposal example (126,000 × 50/150 = 42,000; a test here) · updated by the authority to 28 November 2025
- IRS: Frequently asked questions on virtual currency transactions, Q39–Q41 (specific identification; otherwise first in, first out). The page says these FAQs generally apply to transactions before 1 Jan 2025. · updated by the authority to 30 June 2026
Last checked: 20 October 2026. This tool passes 7 automatic tests before every release. How we check our tools
Your numbers never leave your device: the calculation runs in your browser and nothing you type is sent or stored.
A method calculator, not a tax calculator. Which method you must use, and any extra rules, are set by your tax authority: for example the UK matches same-day and 30-day buys before the pool (HMRC CRYPTO22200), and the US lets you identify specific units if your records allow it. Tax rates, allowances and losses are not included. This is not tax, legal or investment advice. Results are estimates for information only and are not financial, investment, tax or legal advice. Crypto prices move fast and leveraged trading can lose more than you expect. Check figures on your exchange or wallet before you act.