How to Calculate Crypto Gains and Losses
Every crypto sale triggers a gain or loss calculation. The formula is simple — sale price minus cost basis — but tracking it across hundreds of transactions, multiple wallets, and token swaps gets complicated fast.
Estimate your crypto tax bill with the Crypto Tax Calculator.
The Basic Formula
Capital Gain (or Loss) = Sale Price − Cost Basis − Fees
| Term | Meaning |
|---|---|
| Sale price | What you received (in USD at time of sale) |
| Cost basis | What you originally paid (in USD at time of purchase) + fees |
| Fees | Trading fees, gas fees, network fees on both buy and sell |
Example:
- Bought 0.5 BTC for $25,000 (+ $50 exchange fee)
- Cost basis: $25,050
- Sold 0.5 BTC for $45,000 (− $50 exchange fee)
- Net proceeds: $44,950
- Capital gain: $44,950 − $25,050 = $19,900
Short-Term vs. Long-Term
The holding period determines your tax rate:
| Holding Period | Classification | Tax Rate |
|---|---|---|
| 1 year or less | Short-term | Ordinary income rate (10-37%) |
| More than 1 year | Long-term | Preferential rate (0%, 15%, or 20%) |
The difference matters. On a $20,000 gain at the 24% bracket:
- Short-term: $20,000 × 24% = $4,800 tax
- Long-term: $20,000 × 15% = $3,000 tax
- Saving: $1,800 by holding one extra day past 12 months
The holding period starts the day after acquisition. Buy on January 15, 2025 → long-term starts January 16, 2026.
Calculating Gains on Crypto-to-Crypto Trades
Swapping one crypto for another is treated as selling the first and buying the second.
Example — ETH to SOL swap:
| Step | Amount |
|---|---|
| Bought 10 ETH at $2,000 each | Cost basis: $20,000 |
| Traded 10 ETH for 400 SOL when ETH = $3,500 | Sale price: $35,000 |
| Gain on ETH | $15,000 |
| Cost basis of 400 SOL | $35,000 (fair market value at swap time) |
You owe tax on the $15,000 ETH gain even though you never received cash. The SOL starts with a $35,000 cost basis for future calculations.
Handling Multiple Purchases
Most people buy crypto at different times and prices. When you sell, which purchase's cost basis do you use?
Cost basis methods:
| Method | How It Works | Best For |
|---|---|---|
| FIFO (First In, First Out) | Sells oldest coins first | Default method; simple |
| LIFO (Last In, First Out) | Sells newest coins first | Lower gains in rising markets |
| Specific ID | You choose which lot to sell | Maximum tax optimization |
| HIFO (Highest In, First Out) | Sells highest-cost coins first | Minimizes gains |
FIFO example:
| Purchase | Amount | Price Each | Cost Basis |
|---|---|---|---|
| Jan 2025 | 1 BTC | $40,000 | $40,000 |
| Jun 2025 | 1 BTC | $60,000 | $60,000 |
| Dec 2025 | 1 BTC | $80,000 | $80,000 |
You sell 1 BTC for $90,000. Under FIFO, you sell the January lot first:
- Gain: $90,000 − $40,000 = $50,000 (long-term)
Under Specific ID, you could sell the December lot:
- Gain: $90,000 − $80,000 = $10,000 (short-term)
Which is better depends on your income bracket. See cost basis methods compared for detailed analysis.
Losses and Tax Benefits
Crypto losses are just as important as gains — they reduce your tax bill.
Capital loss rules:
- Losses first offset same-type gains (short-term offsets short-term)
- Remaining losses offset the other type
- Up to $3,000 of net losses can offset ordinary income
- Excess losses carry forward to future years (indefinitely)
Example:
| Transaction | Gain/Loss |
|---|---|
| Sold BTC | +$20,000 gain |
| Sold ETH | −$8,000 loss |
| Sold DOGE | −$5,000 loss |
| Net gain | $7,000 |
Without the losses, you'd owe tax on $20,000. With netting, you only owe on $7,000.
If your net result is a loss (say, −$10,000):
- Deduct $3,000 against ordinary income this year
- Carry the remaining $7,000 loss forward to next year
Don't Forget These Taxable Events
| Event | How to Calculate Gain |
|---|---|
| Spending crypto | FMV at spending − cost basis |
| Receiving as payment | Taxed as income at FMV; that becomes your cost basis |
| Mining rewards | Income at FMV when received; becomes cost basis |
| Staking rewards | Income at FMV when received; becomes cost basis |
| Airdrops | Income at FMV when received |
Every taxable event needs tracking. Manual spreadsheets work for a few trades, but if you have dozens or hundreds, crypto tax software (Koinly, CoinTracker, TaxBit) automates the calculations.
See how gains fit into your overall taxes with the Federal Tax Calculator.
Share this article