Part of our Crypto Tax & Regulation Guide: everything on this topic in one place.
Last updated: December 5, 2026 · By the CryptoMaximal Team · General information, not tax advice
Crypto cost basis is what you paid to get a coin, including fees, and it decides how much of a sale is taxable gain. To calculate it, add the purchase price and acquisition fees for each lot, then match the units you sold to specific lots using FIFO or specific identification. Since January 1, 2025, the IRS requires you to do this separately for each wallet or exchange account, not across all your holdings at once.
This guide shows the formula, works through real examples, explains the wallet-by-wallet rule in plain English and includes a free calculator that compares FIFO and HIFO for the same sale.
In this guide
What is cost basis in crypto?
Cost basis is your total investment in a unit of crypto, measured in US dollars. For coins you bought, it is the price plus the fees you paid to buy them. For coins you received as income (staking, mining, airdrops, pay), it is the fair market value on the day you received them.
The IRS digital asset FAQs say that when you are paid in crypto for services, your basis is the fair market value in US dollars when received, as long as you included that value in income. That means the same coin can have very different basis depending on how you got it.
| How you got the crypto | Your cost basis |
|---|---|
| Bought with dollars | Purchase price + buying fees |
| Traded another coin for it | Fair market value of the new coin at the time of the trade |
| Staking, mining or airdrop | Fair market value when you gained control of it (already taxed as income) |
| Paid for work | Fair market value when received |
| Received as a gift | Usually the giver’s basis (special rules apply to losses) |
| Inherited | Generally the fair market value at the date of death |
The cost basis formula
The basic formula is simple: cost basis per unit = (purchase price + acquisition fees) ÷ units received. Your capital gain or loss is then sale proceeds − selling fees − cost basis of the units sold.
Here is a worked example. You bought 0.5 BTC for $30,000 and paid a $150 trading fee.
- Total basis: $30,000 + $150 = $30,150
- Basis per BTC: $30,150 ÷ 0.5 = $60,300
Later you sell 0.2 BTC for $19,000 and pay a $95 fee.
- Basis of units sold: 0.2 × $60,300 = $12,060
- Amount realized: $19,000 − $95 = $18,905
- Capital gain: $18,905 − $12,060 = $6,845
Whether that $6,845 is taxed at short-term or long-term rates depends on how long you held those specific units. Our crypto tax rates guide shows the current brackets.
FIFO, HIFO and specific identification
When you bought the same coin at different prices, you must decide which units you sold. The IRS allows two approaches: specific identification (you choose the exact units) and FIFO (first in, first out) as the default when you do not identify units.
The IRS virtual currency FAQs have long allowed either specific identification or FIFO, and tax professionals at EY describe the same two options. Methods like HIFO (highest in, first out) are really a form of specific identification: you are choosing the highest-cost units, so you need records that prove which units those were.
| Method | How it works | Usually results in | Records needed |
|---|---|---|---|
| FIFO | Oldest units are sold first | Larger gains in a rising market, more long-term holdings | Purchase dates and prices |
| Specific ID | You choose the exact units at or before the sale | Whatever you choose | Detailed proof of the units chosen |
| HIFO (a specific ID strategy) | Highest-cost units sold first | Smallest gain or largest loss | Same as specific ID |
| LIFO (a specific ID strategy) | Newest units sold first | Often short-term gains | Same as specific ID |
Choosing HIFO lowers this year’s tax, but it leaves cheaper coins behind, so future sales may produce bigger gains. It defers tax; it does not erase it.
Compare FIFO and HIFO for your sale
Enter up to three purchases of the same coin held in one wallet or account, then the amount you sold. The calculator shows your gain under FIFO and under HIFO so you can see the difference. Numbers stay in your browser.
FIFO vs HIFO cost basis calculator (one wallet or account)
| Lot | Date | Units | Total cost incl. fees ($) |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 |
With the default numbers, FIFO sells the cheap 2023 coins first and reports a much larger gain, while HIFO sells the expensive 2024 and 2025 coins and reports a smaller one. Note that HIFO may also turn a long-term gain into a short-term one, so check holding periods before choosing. For a full-year estimate, use our crypto tax calculator.
The wallet-by-wallet rule (since 2025)
Since January 1, 2025, you must track cost basis and apply FIFO or specific identification within each wallet or exchange account separately. You can no longer treat all your coins across Coinbase, Kraken and a hardware wallet as one big pool.
The rule comes from the 2024 final regulations under §1.1012-1(j), and the IRS issued Rev. Proc. 2024-28 as a one-time safe harbor to help people move from the old “universal” method. According to EY, taxpayers must apply FIFO or specific ID separately to the assets in each individual wallet or account for transactions on their 2025 return.
What this means in practice:
- Transfers carry basis with them. When you move 1 ETH from Coinbase to your Ledger, the original purchase date and cost move too. A transfer between your own wallets is not a sale (see why).
- FIFO looks only inside the wallet you sold from. If you sell ETH on Kraken, FIFO uses the oldest ETH in your Kraken account, not your oldest ETH anywhere.
- Brokers default to FIFO. If you do not identify units before a sale, your exchange applies FIFO to that account. Kraken, for example, says it calculated 2025 estimated gains using FIFO.
- The safe harbor window is limited. Rev. Proc. 2024-28 lets you allocate unused basis to wallets as of January 1, 2025 under specific conditions. If you have not done this, talk to a crypto tax professional soon.
Where to find your cost basis
Your exchange history, wallet transaction records and Form 1099-DA are the starting points, but none of them is complete on its own. Exchanges only know what happened inside their platform, so coins you transferred in often show “missing” or zero basis.
- Exchange CSV exports: download full trade, deposit and withdrawal history from every exchange you ever used. Guides: Coinbase tax documents, Kraken tax documents.
- Form 1099-DA: for 2025 sales, brokers report gross proceeds. Our Form 1099-DA guide explains which boxes may show basis and which may not.
- Self-custody wallets: use a block explorer for the wallet address and match each incoming transfer to the exchange withdrawal it came from.
- Crypto tax software: imports all of the above and rebuilds lots wallet by wallet. Compare options in our best crypto tax software review.
What if you don’t know your cost basis?
If you truly cannot document what you paid, the safest position is that your basis is zero, which makes the whole sale taxable. Before accepting that, rebuild it: old bank statements, exchange emails, archived account statements and blockchain records usually fill most gaps.
- List every exchange and wallet you have used, even closed ones.
- Download every available history file and bank statement showing transfers to exchanges.
- Use a block explorer to trace coins from the exchange that sold them to you.
- Price each unrecorded acquisition at its fair market value on that date, using a reputable price history.
- Keep a written note of how you rebuilt each lot. That note is part of your records.
Losses also need basis to claim. Our guide on reporting crypto losses explains why documenting basis pays off, and tax-loss harvesting shows how to use losses on purpose.
Reporting cost basis on your tax return
Each sale goes on Form 8949 with the date acquired, date sold, proceeds, cost basis and gain or loss, and the totals flow to Schedule D. Short-term and long-term sales are reported in separate sections.
Our step-by-step guide to reporting crypto on Form 8949 shows each column with examples. If your exchange’s 1099-DA basis does not match your own records, you report the correct basis and use the adjustment columns to explain the difference.
Frequently asked questions
Do crypto fees count toward cost basis?
Yes. Fees you pay to buy crypto are added to your cost basis, and fees you pay to sell reduce your amount realized. Both lower your taxable gain. Network fees for moving coins between your own wallets are treated differently, so keep them separate in your records.
Can I switch between FIFO and HIFO each year?
Specific identification is made sale by sale, so you can choose different units for each sale as long as you identify them at or before the sale and keep records. If you do not identify units, FIFO applies within that wallet or account.
Does the wallet-by-wallet rule apply to my hardware wallet?
Yes. Each wallet you control, including hardware and software wallets, is tracked separately. Moving coins between them does not create a sale, but the basis and purchase dates must move with the coins in your records.
What is the cost basis of crypto I earned from staking?
It is the fair market value in US dollars when you received the rewards, which you also report as ordinary income. See our guide to crypto staking rewards tax.
Is the cost basis on my 1099-DA always correct?
Not always. Exchanges only see activity on their platform, so coins transferred in from elsewhere may show missing basis. You are responsible for reporting the correct basis from your own records.
This article is general information, not tax or legal advice. Tax rules change and depend on your situation. Consult a qualified tax professional before making decisions.

No comments yet