Cost basis is the original value you paid for a cryptocurrency, including fees. The IRS requires you to calculate cost basis for every disposal — sale, swap, or spend — to determine your capital gain or loss. Most traders use FIFO (first in, first out) by default, but choosing HIFO (highest in, first out) or specific identification can legally reduce your tax bill by hundreds or thousands of dollars per year.
In This Article
- What Is Cost Basis and Why Does the IRS Require It?
- How Do the Different Cost Basis Methods Compare?
- How Do You Calculate Cost Basis Step by Step?
- Do Gas Fees and Transaction Fees Count Toward Cost Basis?
- What Records Do You Need for Cost Basis Tracking?
- How Does Cost Basis Work for Staking Rewards and Airdrops?
- Frequently Asked Questions
- Sources
What Is Cost Basis and Why Does the IRS Require It?
Cost basis equals the purchase price of your cryptocurrency plus any directly attributable costs like transaction fees and gas fees. When you sell or swap crypto, the IRS treats the difference between your sale price and your cost basis as a capital gain or loss. According to IRS FAQ on Virtual Currency Transactions, every taxable disposition requires accurate cost basis reporting.
Getting this wrong results in either overpaying taxes or underreporting — both are problems. Overpaying is money lost. Underreporting triggers penalties. The calculation itself is straightforward math, but the complexity comes from tracking hundreds or thousands of transactions across multiple wallets and exchanges.
For a complete overview of how the IRS treats cryptocurrency, see our IRS cryptocurrency tax guide. To understand how staking rewards factor into your basis, read taxes on crypto staking rewards.
How Do the Different Cost Basis Methods Compare?
The IRS allows several accounting methods for calculating cost basis. Each produces a different taxable gain for the same set of transactions. Your choice of method directly affects how much tax you owe.

| Method | How It Works | Best When | Tax Impact | IRS Accepted |
|---|---|---|---|---|
| FIFO (First In, First Out) | Sells the oldest units first | Prices have risen steadily | Often highest gains (highest tax) | Yes — default if no method chosen |
| LIFO (Last In, First Out) | Sells the most recent units first | Recent purchases at higher prices | Lower short-term gains possible | Yes |
| HIFO (Highest In, First Out) | Sells the highest-cost units first | Want to minimize current tax | Lowest gains (lowest tax now) | Yes, with specific ID records |
| Specific Identification | You choose which exact units to sell | Maximum control over tax outcome | Optimized per transaction | Yes — requires detailed records |
| Average Cost | Averages the cost of all units | Simplicity with many small buys | Middle-ground tax outcome | Yes, for certain assets |
My opinion: HIFO with specific identification is the best method for active traders. It legally minimizes your current tax liability while giving you full control. The record-keeping burden is real, but tax software like CoinTracker, Koinly, and CoinLedger handle the tracking automatically.
How Do You Calculate Cost Basis Step by Step?
Here is a worked example using a common scenario: buying Bitcoin at different prices and selling a portion.
Example transactions
Purchase 1: Buy 0.5 BTC at $40,000 per BTC. Total cost: $20,000. Exchange fee: $25. Cost basis per unit: $40,050 ($20,025 / 0.5 BTC).
Purchase 2: Buy 0.3 BTC at $55,000 per BTC. Total cost: $16,500. Exchange fee: $20. Cost basis per unit: $55,066.67 ($16,520 / 0.3 BTC).
Sale: Sell 0.4 BTC at $60,000 per BTC. Proceeds: $24,000. Exchange fee: $30. Net proceeds: $23,970.
FIFO calculation
FIFO sells the oldest units first. The 0.4 BTC sold comes from Purchase 1 (0.4 of the 0.5 BTC bought at $40,050 per unit).
Cost basis: 0.4 x $40,050 = $16,020. Net proceeds: $23,970. Capital gain: $7,950.
HIFO calculation
HIFO sells the highest-cost units first. The 0.3 BTC from Purchase 2 ($55,066.67 per unit) goes first, then 0.1 BTC from Purchase 1.
Cost basis: (0.3 x $55,066.67) + (0.1 x $40,050) = $16,520 + $4,005 = $20,525. Net proceeds: $23,970. Capital gain: $3,445.
The difference: $7,950 vs. $3,445 in taxable gains — a $4,505 reduction by choosing HIFO. At a 15% long-term capital gains rate, that saves $675.75 in taxes on a single trade.
Do Gas Fees and Transaction Fees Count Toward Cost Basis?
Yes. The IRS treats transaction costs as part of your cost basis. This includes exchange trading fees, network gas fees paid in ETH or other native tokens, and bridge fees for cross-chain transfers. According to IRS Publication 544, the cost of acquiring property includes commissions and similar expenses.
Gas fees add up. Active DeFi users on Ethereum can spend hundreds of dollars per month on gas. Every one of those fees either increases your cost basis (reducing future gains) or constitutes a separate taxable event if it involves disposing of a token.
For details on whether DEX swaps trigger a taxable event, see our guide on DEX swap tax treatment.
What Records Do You Need for Cost Basis Tracking?
The IRS does not prescribe a specific format, but you need enough detail to substantiate every calculation. At minimum, keep records of the date and time of each transaction, the amount of cryptocurrency, the fair market value at the time, the fees paid, and the wallet or exchange used.
Exchange CSV exports provide most of this data for centralized platform trades. DeFi transactions require pulling data from blockchain explorers like Etherscan or Solscan. Do not rely on memory — export records quarterly at minimum.
Tax software automates this. CoinTracker connects to exchanges via API and reads on-chain transactions directly. Koinly supports over 400 integrations. Both generate IRS Form 8949 automatically. Read our research methodology for how we evaluate these tools.
How Does Cost Basis Work for Staking Rewards and Airdrops?
According to Revenue Ruling 2023-14, staking rewards are taxable as ordinary income at fair market value when you gain dominion and control. That fair market value becomes the cost basis for the new tokens. When you later sell those staked tokens, your gain or loss is calculated against that income-recognized basis.
Airdrops follow the same logic. The fair market value at receipt is both your taxable income and your cost basis. If you receive 100 tokens via airdrop worth $2 each, you report $200 income and carry a $200 cost basis.
Frequently Asked Questions
- Can I change my cost basis method after filing?
- You can change methods for future tax years, but you cannot retroactively change the method used on a filed return without amending. Once you use specific identification for a transaction, that election is permanent for those units. Consult a tax professional before switching methods mid-year.
- What if I lost my transaction records from an old exchange?
- Check whether the exchange still provides historical exports. If the exchange shut down (like FTX), look for blockchain records of your deposits and withdrawals. As a last resort, the IRS allows reasonable estimation, but you must document your methodology. A zero cost basis — treating the full sale as gain — is the safest conservative approach.
- Does transferring crypto between my own wallets trigger a taxable event?
- No. Wallet-to-wallet transfers you control are not dispositions. Your cost basis carries over to the new wallet. However, the gas fee paid for the transfer may itself be a taxable event if paid in a token that has appreciated.
- Is HIFO always the best method for reducing taxes?
- Not always. If you have short-term losses at lower cost basis lots, FIFO might generate a deductible loss sooner. The optimal method depends on your specific transaction history, holding periods, and current-year income. Tax software can model multiple methods and show which produces the lowest liability.
Sources
- IRS — FAQ on Virtual Currency Transactions (accessed when I last checked)
- IRS Publication 544 — Sales and Other Dispositions of Assets (accessed when I last checked)
- Revenue Ruling 2023-14 — Staking Rewards (accessed when I last checked)
- IRS Form 8949 Instructions (accessed when I last checked)
This article is for informational and educational purposes only. It does not constitute tax, legal, or financial advice. Consult a qualified tax professional for guidance specific to your situation.