How to Calculate Crypto Cost Basis: FIFO, HIFO, and Records

To calculate your crypto cost basis, add the U.S. dollar price you paid for a digital asset to any fees you paid to acquire it, then track that number for each lot separately in each wallet or account until you sell or trade the asset. Your basis is what you subtract from your sale proceeds to figure your capital gain or loss, so an accurate number is the foundation of every crypto tax calculation you’ll do.1Internal Revenue Service. Frequently Asked Questions on Digital Asset Transactions

What Counts as Cost Basis

The IRS treats digital assets as property, so the basis rules that apply to stocks or real estate apply to crypto too.2Internal Revenue Service. Digital Assets Basis starts with the U.S. dollar price at the moment you bought. To that, add any fees tied directly to the acquisition: exchange commissions, network transaction fees (often called gas fees), and other costs required to complete the purchase.1Internal Revenue Service. Frequently Asked Questions on Digital Asset Transactions

If you swapped one crypto for another instead of buying with dollars, your basis in the new asset is the fair market value of what you received at the time of the trade. That figure serves as your purchase price even though no cash moved. The same logic applies when you spend crypto on goods or services: the fair market value at the moment of the transaction sets the basis for the coin you received (or the disposal price for the coin you spent).

Records You Need Before You Calculate

For every acquisition, you need four data points: the type of asset, the date and time you acquired it, the number of units, and the fair market value in U.S. dollars at that moment.2Internal Revenue Service. Digital Assets For every disposal, you need the same four for the sale side.

Exchange trade history is the easiest starting point. Most centralized exchanges let you download CSV files covering every buy, sell, and trade on your account. For self-custody wallet activity, pull transaction hashes and timestamps from a blockchain explorer. Gas fees on networks like Ethereum can run from pennies to well over a hundred dollars depending on congestion, and each one belongs in your basis calculation.

One missing transaction throws off everything downstream. If you bought an asset across five separate purchases and forgot to log one, whatever identification method you use later will assign the wrong basis to a sale. Keep a running ledger through the year rather than trying to reconstruct twelve months of activity at filing time.

Which Lot Did You Sell?

When you own multiple lots of the same asset bought at different times and prices, you need a rule for deciding which lot leaves your wallet when you sell. The IRS recognizes two approaches: First-In, First-Out (FIFO) and Specific Identification.

FIFO Is the Default

If you don’t specifically identify which units you’re selling, the IRS treats your oldest units as sold first.3Internal Revenue Service. Frequently Asked Questions on Virtual Currency Transactions In a market that has generally risen, FIFO tends to produce the largest taxable gain because your oldest lots usually carry the lowest basis. The tradeoff is simplicity: you don’t have to track which specific unit left your wallet.

Specific Identification (Including HIFO and LIFO)

Specific Identification lets you pick the exact lot you’re selling, giving you control over the size of the gain or loss on each transaction. To use it, you must document the date and time each unit was acquired, the basis and fair market value at acquisition, and the same details at the time of sale.3Internal Revenue Service. Frequently Asked Questions on Virtual Currency Transactions You must also designate which units are being sold before or at the time of the transaction. Cherry-picking after the fact isn’t allowed.

Two common strategies within Specific Identification are Highest-In, First-Out (HIFO), which sells the lot with the highest purchase price to minimize your gain, and Last-In, First-Out (LIFO), which sells the most recently acquired lot first. Both require the same granular records as any other Specific Identification approach. Without those records, the IRS can disqualify your identification and recalculate using FIFO, which usually means a higher tax bill when your oldest lots carry a much lower basis than recent ones.3Internal Revenue Service. Frequently Asked Questions on Virtual Currency Transactions

Track Each Wallet and Account Separately

Since January 1, 2025, the IRS requires you to track cost basis on a wallet-by-wallet and account-by-account basis. Before that date, some taxpayers used a “universal” or “multi-wallet” approach, pooling all their holdings of the same asset across every wallet and exchange into a single bucket. That’s no longer allowed.1Internal Revenue Service. Frequently Asked Questions on Digital Asset Transactions

If you hold Bitcoin on Coinbase and also in a hardware wallet, those are two separate pools for identification purposes. A sale from the exchange account applies FIFO (or your Specific Identification choices) to the lots inside that exchange account only. If you had used the universal approach before 2025, Revenue Procedure 2024-28 provides a safe harbor that lets you reasonably allocate your pre-2025 basis across your wallets and accounts. That allocation had to be made as of January 1, 2025, though the IRS allows some flexibility on when you formally document it.

Doing the Math

Once your records are in order, the calculation itself is short. For every disposal:

  • Net proceeds: the amount you received from the sale, minus any fees paid to execute the sale.
  • Adjusted basis: the original purchase price, plus any fees paid to acquire the asset.
  • Gain or loss: net proceeds minus adjusted basis. A positive number is a capital gain; a negative number is a capital loss.

Say you sold an asset for $1,000 and paid a $10 trading fee. Your net proceeds are $990. You originally bought that asset for $500 with a $5 fee, giving you an adjusted basis of $505. Your taxable gain is $485. You repeat this for every disposal during the year, including every sale, every crypto-to-crypto trade, and every purchase of goods or services with crypto.

Each transaction gets its own line on Form 8949, where you record the date acquired, the date sold, the proceeds, and the basis.4Internal Revenue Service. 2025 Instructions for Form 8949 The totals from Form 8949 flow to Schedule D of your Form 1040, where your net gain or loss for the year is calculated.5Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets

Basis When You Didn’t Buy With Cash

Digital assets you didn’t buy with dollars follow different rules for setting a basis. The common thread: assets received as compensation or as rewards are ordinary income when you gain control of them, and that income amount becomes your basis going forward.

Mining and Staking Rewards

When you mine crypto or earn staking rewards, the fair market value of the tokens at the moment you gain control counts as ordinary income.6Internal Revenue Service. Rev. Rul. 2023-14 That same fair market value becomes your basis. If you mine 0.01 BTC when Bitcoin is trading at $60,000, you have $600 in ordinary income and a $600 basis in that 0.01 BTC. If you later sell it for $800, your capital gain is $200. Your holding period starts the day you received the rewards.

Airdrops and Hard Forks

If you receive new tokens from an airdrop following a hard fork, you have ordinary income equal to the fair market value of those tokens, but only once you can actually sell, trade, or transfer them. If a fork creates a new coin that lands in your exchange wallet but the exchange doesn’t support it, you don’t have income yet. Once you gain the ability to dispose of the asset, the fair market value at that moment becomes both your income and your basis. If a hard fork produces a new coin but you never receive any units, there’s no income to report and no basis to track.7Internal Revenue Service. Rev. Rul. 2019-24

Crypto Received as a Gift

When someone gives you cryptocurrency, your basis is generally the donor’s original basis, adjusted for any fees they paid.8Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust There’s a wrinkle when the asset’s fair market value at the time of the gift is lower than the donor’s basis. In that scenario, you use two different bases: the donor’s basis for calculating a gain, and the lower fair market value at the time of the gift for calculating a loss.9Internal Revenue Service. Property (Basis, Sale of Home, Etc.) If the donor paid gift tax, you may add a portion of that tax to your basis. The practical challenge is that you need to know what the donor originally paid, and many people never think to ask when receiving a crypto gift.

Inherited Crypto

Crypto you inherit gets a stepped-up basis to the fair market value on the date of the decedent’s death.10Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent What the deceased originally paid doesn’t matter. If they bought Bitcoin at $200 and it was worth $60,000 when they died, your basis is $60,000. The estate executor may also elect an alternate valuation date six months after death if the asset’s value declined during that period.

What Form 1099-DA Does and Doesn’t Cover

Starting with sales in 2025, crypto brokers must report gross proceeds from digital asset transactions to the IRS on Form 1099-DA. For the 2026 tax year, the reporting obligations expand: brokers must also report cost basis for any digital asset that qualifies as a “covered security.”11Internal Revenue Service. 2026 Instructions for Form 1099-DA Digital Asset Proceeds From Broker Transactions

A digital asset is a covered security if you acquired it after 2025 in a custodial account at the broker where it was held until you sold it. Anything you acquired before 2026, transferred in from an outside wallet, or held in a non-custodial wallet is a “noncovered security,” and brokers don’t have to report basis for those assets.11Internal Revenue Service. 2026 Instructions for Form 1099-DA Digital Asset Proceeds From Broker Transactions In practice, most crypto you already owned as of early 2026 is noncovered, so you’re still on the hook for tracking and reporting the basis yourself.

Even when a broker does report your basis on Form 1099-DA, verify the numbers against your own records before you file. Brokers may not account for fees paid outside their platform, and transfers between wallets can leave gaps in their data. Treat the 1099-DA as a starting point, not the final word.