A crypto capital gain is what you received for the coins you sold minus what those coins cost you. When you bought at different prices, a rule decides which purchases the sold coins came from. The usual rules are FIFO (oldest first), LIFO (newest first) and average cost, and the same sale can show very different gains under each. A crypto capital gains calculator runs that arithmetic and estimates the tax at a rate you enter.
This article is educational and is not financial advice. It is not tax advice either: tax rules depend on your country and your situation.
How is crypto tax calculated?
In many countries, crypto gains are taxed as capital gains. The core arithmetic is the same everywhere:
proceeds = coins sold × sale price gain = proceeds − cost basis of the coins sold tax ≈ gain × your rate
The US tax authority, the IRS, describes the gain or loss as the difference between your adjusted basis in the coins and the amount realized on the sale. What changes from country to country is everything around that line: which sales are taxed, which purchases are matched to a sale, what costs count, and what rate applies.
Crypto cost basis: what the coins cost you
Cost basis is the amount you paid to acquire the coins. The IRS says it includes the cash you paid plus what you paid for transaction services to make the purchase, such as fees and commissions.
Cost basis is simple for one purchase. It gets harder when you bought the same coin several times at different prices and then sold only part of it. The coins are identical, so a rule has to decide which ones you sold.
FIFO vs LIFO crypto, and average cost
Three methods are common.
- FIFO, first in, first out. The sold coins come from your oldest purchases first. If prices have risen over time, the oldest coins are usually the cheapest, so FIFO tends to show a larger gain.
- LIFO, last in, first out. The sold coins come from your newest purchases first. In a rising market these are usually the most expensive, so LIFO tends to show a smaller gain now.
- Average cost. Every coin carries the same cost: the total paid divided by the total coins. The gain falls between the other two.
FIFO cost = take coins from the oldest purchase, then the next LIFO cost = take coins from the newest purchase, then the one before average cost = coins sold × (total paid / total coins)
Which method you may use is not a free choice in most places. The tax rules where you live decide it. See the country notes below.
A worked example
All numbers below are examples. They are not a forecast and not current data. They are the calculator's default inputs.
- Purchase 1: 0.5 BTC at $42,000, cost $21,000
- Purchase 2: 0.5 BTC at $88,000, cost $44,000
- Sale: 0.6 BTC at $97,000, proceeds $58,200
- Tax rate entered: 20%
| Method | Cost of coins sold | Gain | Estimated tax at 20% | Cost of the 0.4 BTC left |
|---|---|---|---|---|
| FIFO | 0.5 × 42,000 + 0.1 × 88,000 = $29,800 | $28,400 | $5,680 | $35,200 |
| LIFO | 0.5 × 88,000 + 0.1 × 42,000 = $48,200 | $10,000 | $2,000 | $16,800 |
| Average cost | 0.6 × 65,000 = $39,000 | $19,200 | $3,840 | $26,000 |
The same sale shows a gain of $10,000 or $28,400 depending only on the method. The difference in estimated tax is $3,680.
Look at the last column too. The method that shows the smallest gain now leaves the cheapest coins for later. Suppose you later sell the remaining 0.4 BTC, also at $97,000 (example). The second gain would be $3,600 under FIFO, $22,000 under LIFO and $12,800 under average cost. The two sales together add up to $32,000 under every method, which is the total proceeds of $97,000 minus the total cost of $65,000.
So the method mostly moves gains between sales and tax years. It changes the total tax mainly when rates, allowances or holding periods differ between those sales.
Rules differ by country: two examples
These are short summaries of official guidance, checked on 17 November 2026. They are not complete, and rules change. Read the source pages or ask a tax professional.
United States
- The IRS says digital assets are treated as property, not currency.
- Selling, and exchanging one digital asset for another that differs materially, gives a capital gain or loss.
- A gain is short-term if you held the asset for one year or less, and long-term if you held it for more than one year.
- You can choose which units you sell if you identify them specifically. If you do not, the IRS treats the earliest-acquired units as sold first, which its older guidance calls FIFO.
- For transactions from 2025, the IRS FAQs apply that default within each wallet, or to the units held by a broker. A safe harbor, Revenue Procedure 2024-28, covered allocating unused basis to wallets as of 1 January 2025.
- Brokers report on Form 1099-DA: gross proceeds for transactions on or after 1 January 2025, and basis for certain transactions on or after 1 January 2026. Gains must be reported even without the form.
United Kingdom
HMRC's Cryptoassets Manual matches disposals in a fixed order:
- Same-day rule. Coins bought on the same day as a sale are matched with it first.
- 30-day rule. Coins of the same type bought within 30 days after a sale are matched with that sale next. HMRC's guidance for shares calls the same idea the "bed and breakfast" rule.
- Section 104 pool. Everything else sits in one pool per token type. A sale takes a share of the pool's total cost in proportion to the coins sold. In HMRC's own example, selling 50 of 150 pooled tokens uses 50/150 of the pool cost.
The pool works like the average cost method in the calculator. The same-day and 30-day matches, which come first, do not. HMRC also counts as a disposal exchanging one token for another, paying for goods or services, and giving tokens away, except to a spouse or civil partner.
How to use it in CryptoPith
- Open the crypto capital gains calculator.
- Enter your two purchases: the amount of BTC and the price for each.
- Enter the sale: the amount sold and the sale price.
- Choose FIFO, LIFO or Average, and enter your tax rate on gains.
- Read the gain, the proceeds, the cost of the coins sold, the estimated tax at your rate and the coins left.
- Compare the three methods for the same sale in the table below the result.
The calculator is free and needs no sign-up. It is arithmetic, not tax advice, and it does not decide which method applies to you. The free version takes two purchases and one sale. The Pro plan, $14 a month, adds importing all your trades from a CSV file, a yearly report and a file to download for your accountant. CryptoPith does not connect to wallets or exchanges. For the average price of many purchases, use the average buy price calculator, explained in average buy price.
Common mistakes and limits
- Choosing the method that gives the lowest number. The rules where you live decide the method. A smaller gain this year can mean a larger one later.
- Forgetting fees. The calculator uses the prices you enter. If your rules let you add fees to the cost or deduct them from the proceeds, include them in the prices.
- Ignoring holding periods. The calculator applies one rate. Some countries, including the US, tax short-term and long-term gains differently.
- Missing taxable events. In the US and the UK, swapping one coin for another can count as a disposal, not only selling for cash.
- Treating all wallets as one pile. For US transactions from 2025, the default order applies within each wallet or broker account.
- Selling more than you hold. If the amount sold is larger than your purchases, the calculator counts only the coins you hold and says so.
- Reading the tax line as the bill. Allowances, losses from other sales and income level can change what you owe.
FAQ
How is crypto tax calculated?
Take the proceeds of the sale and subtract the cost basis of the coins sold. The result is the gain or loss. Tax is then charged on the gain under your country's rules and rates.
Is FIFO or LIFO better for crypto?
Neither is better in general. In a rising market LIFO usually shows a smaller gain now, but it leaves cheaper coins, and so larger gains, for later sales. More importantly, your country's rules may require a specific method.
What is crypto cost basis?
It is what you paid to acquire the coins. Under IRS guidance, it includes the price plus fees and commissions paid to make the purchase.
What is average cost basis in crypto?
It is the total amount paid for a coin divided by the total coins bought. Every coin sold carries that same cost. The UK's section 104 pool works in a similar way for tokens not matched by the same-day or 30-day rules.
Does the IRS use FIFO for crypto?
If you do not specifically identify the units you sell, the IRS treats the earliest-acquired units as sold first, which is FIFO. For transactions from 2025, this applies within each wallet or broker account.
Is this a crypto tax calculator?
It is a calculator for the gain on one sale under three methods, with a tax estimate at the rate you type in. It does not file taxes or apply the full rules of any country.
Sources
- IRS: Digital assets — property treatment, short-term and long-term gains, Form 1099-DA dates (page reviewed 2 September 2026, checked 17 November 2026)
- IRS: Frequently asked questions on digital asset transactions — gain calculation (Q52), basis including fees (Q56), swaps (Q64), default order by wallet and broker (Q86, Q92), Rev. Proc. 2024-28 safe harbor (Q93) (checked 17 November 2026)
- IRS: Frequently asked questions on virtual currency transactions — specific identification and FIFO for transactions before 2025 (Q39–Q41)
- HMRC Cryptoassets Manual: CRYPTO22200, pooling — same-day rule, 30-day rule, section 104 pool (updated 28 November 2025)
- HMRC Cryptoassets Manual: CRYPTO22251, basic section 104 pool disposal — share of pool cost on a sale
- HMRC Cryptoassets Manual: CRYPTO22100, what counts as a disposal
- HMRC Capital Gains Manual: CG51560, the "same day" and "bed and breakfast" rules for shares
Related tools: Average buy price calculator, Crypto profit calculator and Crypto converter. Your first AI report in CryptoPith is free.
