Learn · 9 min · Reviewed December 3, 2026

How to calculate crypto cost basis

Your gain is what you got minus what you paid. Cost basis is the second number, and it is the one most people cannot find when it is time to file.

We may earn a commission when you buy through links on this page. Learn more.

What counts as basis

General US federal rules. Confirm against IRS guidance for your situation.
How you got the coinYour cost basis
Bought with dollarsWhat you paid, plus fees and commissions
Traded another coin for itThe dollar value of the new coin when you got it, which is generally the value of what you gave up
Earned it (staking, mining, airdrop, pay)The dollar value when you gained control of it. That same amount was income
Received as a giftGenerally the giver's basis, in most cases. Special rules apply to losses
InheritedGenerally the value on the date of death. Ask a preparer

Fees you pay to acquire a coin add to basis. Fees you pay to sell reduce the proceeds. The IRS treats digital assets as property, so the same general rules for property apply. See the IRS digital assets page.

The formula

Gain or loss = proceeds − cost basis of the units sold. If you held them more than one year, the result is long-term. Otherwise it is short-term. That split matters for the rate. See our crypto tax calculator to try numbers.

Which units did you sell?

When you bought the same coin more than once at different prices, you need a rule for which units a sale used up.

Common methods. Which ones you can use depends on how well you can identify the units and what your broker supports.
MethodHow it worksTends to produce
FIFO (first in, first out)The oldest units are sold first. The default if you cannot identify what you soldLower basis and larger gains when prices have risen
Specific identificationYou pick the exact units, using records that show which onesThe most control, and the most paperwork
HIFO (highest in, first out)A form of specific identification: sell the units that cost the mostHigher basis and smaller gains, often short-term lots
LIFO (last in, first out)The newest units are sold firstDepends on the price path

Specific identification works only if you can document it. At a broker, you generally identify the units at or before the sale using the method the broker offers. In a wallet you control, keep a written record of which purchase you meant to sell.

Wallet by wallet since 2025

Before 2025, many people tracked all their coins of one type as a single pool. Under the final IRS regulations and Revenue Procedure 2024-28, basis is now tracked separately for each wallet or account that holds the coin, starting January 1, 2025. Rev. Proc. 2024-28 gave a safe harbor for allocating unused basis among your wallets as of that date. If you did not set that allocation up, ask a preparer how it applies to you. See Rev. Proc. 2024-28.

A worked example

Made-up numbers, not a forecast. You bought 0.5 bitcoin at $40,000 and paid $50 in fees. Later you bought 0.5 bitcoin at $90,000 and paid $50 in fees. You sell 0.5 bitcoin at $100,000 per coin, so proceeds are $50,000.

The same sale under two methods.
MethodUnits soldCost basisGain
FIFOThe $40,000 purchase$20,050$29,950
HIFOThe $90,000 purchase$45,050$4,950

The sale is the same. The gain is not. The holding period can also differ, because the two purchases were on different dates. That is why the choice and the record of it matter.

Records that protect your basis

  • Exchange CSV exports and account statements, saved yearly, because platforms close.
  • Bank or card records for the purchase, with the date.
  • Wallet addresses you own and the transfers between them.
  • The date, time, and dollar value for any income you received in coins.

From 2026, brokers report basis on the Form 1099-DA for covered coins, those bought and held at that broker. Anything transferred in is noncovered, and you supply the basis. See the Coinbase 1099-DA guide, then how to fix missing cost basis when the number is blank.

Software does the arithmetic, not the finding

Tax software applies the method you choose across every wallet, matches transfers between your own accounts, and flags missing basis. KoinlyPartner (opens in a new tab) lets you set a cost-basis method and imports from a long list of platforms. CoinLedgerPartner (opens in a new tab) lists FIFO, LIFO, HIFO, and adjusted cost. Neither can invent a purchase you never recorded.

Try Koinly freePartner (opens in a new tab)

Our Koinly and CoinLedger links are affiliate links. If you buy through one, we may earn a commission, and you do not pay more. Related: Form 8949 for crypto, how to report crypto on your taxes, and Crypto taxes, a US guide.

Also: how gifted bitcoin keeps your basis.

Common questions

What is cost basis in crypto?

It is what you paid for the coin in dollars, including fees. For coins you earned, it is the dollar value when you received them. Your gain or loss is the sale proceeds minus the basis of the units you sold.

Which cost basis method is best?

There is no single best method. FIFO is the default when you cannot identify the units. HIFO or other specific identification can lower a gain, but only if you can document which units you sold. Ask a preparer for your situation.

Can I still use one pool for all my bitcoin?

Not starting January 1, 2025. Basis is now tracked wallet by wallet or account by account. Rev. Proc. 2024-28 provided a safe harbor for allocating unused basis as of that date.

Do fees count in cost basis?

Fees you pay to acquire a coin add to basis. Fees you pay when you sell reduce your proceeds.

What if I do not know my cost basis?

Look for exchange exports, bank records, and emails first. If it is truly lost, talk to a preparer, because you carry the burden of supporting the number. Our missing cost basis guide lists where to look.