BitcoinDatabase.com
All posts
Data guides

How to Calculate Cost Basis for Bitcoin (FIFO, LIFO, HIFO)

Bitcoin cost basis is what you paid to acquire a coin, including fees. How to calculate it, which accounting method to use, the 2025 per-wallet rule, and how to reconstruct basis when your records are missing.

By the BitcoinDatabase team

July 2026 · 9 min read

Query Console
btc
try:

Hit Run to query the Bitcoin blockchain.

Live from the chain for .

BTC

Balance trail

informational on-chain data · not financial advice

REST API · SQL · dashboards, one indexed dataset. Reading the chain ...

The short answer

Bitcoin cost basis is the total US-dollar amount you paid to acquire a coin, including any transaction and exchange fees. To calculate a gain or loss, subtract the cost basis from the proceeds when you sell, spend or swap. When you hold coins bought at different prices, you pick an accounting method (FIFO, LIFO, HIFO or specific identification) to decide which lot you disposed of.

Cost basis is the number every crypto tax calculation turns on, and it is also the number people get wrong most often. Get it right and your capital gains fall out of simple subtraction. Get it wrong, usually by forgetting fees, losing early records, or pooling coins the IRS now wants tracked separately, and you either overpay or file a return that will not reconcile under review. This guide walks through how basis actually works for Bitcoin, which method to choose, what changed in 2025, and how to rebuild basis when your history is incomplete. It is informational, not tax advice; a professional should sign off on your actual filing.

What is cost basis for Bitcoin?

Cost basis is what it cost you to acquire an asset, expressed in US dollars at the time you got it. For Bitcoin bought on an exchange, basis is the purchase price plus the trading fee. For Bitcoin received as payment, income or a reward, basis is its fair market value in dollars on the day you received it, which is also the amount you report as income. When you later dispose of that coin, the difference between your proceeds and your basis is a capital gain or loss.

How do you calculate cost basis for Bitcoin?

Take the amount you paid in dollars, add the fees tied to the acquisition, and that total is your basis for that lot. If you bought 0.5 BTC for 20,000 dollars and paid a 50 dollar fee, your basis is 20,050 dollars. Sell that 0.5 BTC later for 26,000 dollars after a 40 dollar fee, and your proceeds are 25,960 dollars, so your gain is 25,960 minus 20,050, or 5,910 dollars. Fees reduce the gain on both ends: they raise basis when you buy and lower proceeds when you sell, so leaving them out inflates your taxable gain.

The complication is that most people do not buy in one lump. You accumulate coins across dozens of purchases at different prices, then sell part of the stack. Because one bitcoin is indistinguishable from another, you need a rule for which lot you sold. That rule is your accounting method.

What cost basis method should you use for crypto?

There are four common methods, and they can produce very different tax bills for the same trades. FIFO assumes you sold your oldest coins first. LIFO assumes the newest first. HIFO sells your highest-cost coins first, which minimizes the current gain. Specific identification lets you name the exact lot, giving you the most control if your records support it.

Method Which lot is sold first Typical effect on a rising market
FIFO Oldest coins first Largest gain, but more likely long-term
LIFO Newest coins first Smaller gain, often short-term
HIFO Highest-cost coins first Smallest current gain
Specific ID The exact lot you choose Most control, needs clean records

FIFO is the IRS default when you have not made and documented a specific-identification choice before the sale.

HIFO and specific identification are not separate legal categories so much as ways of exercising specific identification: to use them you must be able to identify the exact units and have documented the choice at or before the time of sale. If you cannot, the IRS treats your disposals as FIFO. That is why the method question is really a records question.

What changed for crypto cost basis in 2025?

Two things. First, under Revenue Procedure 2024-28, from January 1, 2025 the IRS eliminated the universal method that let taxpayers pool identical coins across every wallet and exchange into one basis pool. Basis must now be tracked on a per-wallet or per-account basis, so a coin's history is tied to where it actually sits. Second, exchanges began issuing Form 1099-DA, reporting gross proceeds for 2025 transactions, with broker cost-basis reporting phasing in for transactions on or after January 1, 2026. In that first window brokers often report proceeds without basis, especially for coins that moved between wallets, so the burden of proving basis stays with you.

The practical effect of the per-wallet rule is that you can no longer treat your holdings as one big bucket. You need each wallet's acquisition history intact, which makes complete on-chain records more valuable than they used to be.

How do you find the cost basis of Bitcoin when records are missing?

Start from the chain, because the movements themselves are permanent even when your exchange statements are not. Every receive into an address has a date and a block, and the market price on that date sets the fair market value you can use for basis. Pull the full transaction history for an address or an extended public key, attach the price that applied at each receive, taken from a daily series out of a Bitcoin OHLC API, and you have a defensible reconstruction. This is exactly what a crypto tax API is built to return: the transaction history and the block-time price in one query, so you are not stitching a price feed to a separate blockchain source by hand.

For a whole wallet at once, an xpub balance API expands the extended public key into every derived address and their receives, which is how you rebuild a complete acquisition record rather than a partial one. Where genuine records simply do not exist, the conservative fallback the IRS accepts is a zero basis, which maximizes the reported gain, so any reconstruction that establishes a real, documented basis usually works in your favor. Keeping the underlying receipts and statements organized alongside the on-chain data, the way an system that reads receipts and categorizes every expense keeps business spending audit-ready, is what turns a reconstruction into something that survives questions.

Is transferring Bitcoin between your own wallets taxable?

No. Moving Bitcoin from one wallet you control to another is not a disposal, so it is not a taxable event and it does not change your basis. Your original acquisition cost simply carries over to the new wallet. The trap is that an exchange or a naive tool can see coins leaving and read the transfer as a sale, or lose the basis on the way. Under the per-wallet rules this matters more than ever, so a tax workflow has to distinguish self-transfers from real disposals, which means tracing where coins actually went on-chain rather than guessing from a single exchange's view.

Do exchange and network fees count toward cost basis?

Yes. Fees paid to acquire a coin add to its basis, and fees paid to dispose of it reduce your proceeds. A trading fee on a buy, and the network fee you pay to move coins as part of an acquisition, both belong in basis. Consistently including fees is one of the simplest ways to avoid overstating gains, and because network fees are recorded on-chain, they can be pulled straight from the transaction data rather than reconstructed from memory.

How do you report Bitcoin cost basis to the IRS?

Capital gains and losses from disposing of Bitcoin are reported on Form 8949 and summarized on Schedule D, with each disposal showing the proceeds, the cost basis and the resulting gain or loss, split between short-term (held a year or less) and long-term. Bitcoin received as income is reported as ordinary income at its fair market value on receipt, and that value becomes its basis. Because the reporting is per disposal and now per wallet, the quality of your basis records drives the quality of your return. None of this is tax advice, and the accounting method and final figures should be confirmed with a qualified professional.

Building basis on complete data

Cost basis is only as trustworthy as the history behind it, and for Bitcoin that history is public and permanent even when your own paperwork is not. BitcoinDatabase serves address history back to 2009 over REST, so you can pull an address or wallet's full acquisition and disposal history and attach the market price at each block time, then work the rows in SQL or dashboards over the indexed chain, which grows with every new block. If you are building tax reporting, start with the crypto tax API and the historical data API, and see what a UTXO is for why coins carry their own acquisition history. This is informational on-chain and market data, not tax, accounting or legal advice.

Query the Bitcoin blockchain yourself

Pull balances, UTXOs, transactions, on-chain metrics and fund flows from the Bitcoin blockchain by REST API, SQL and dashboards. Address history since 2009, new blocks within seconds, no node to run.

Keep reading

More from the BitcoinDatabase blog

Buyer guides

Best Bitcoin API for Crypto Tax Software and Cost Basis

Crypto tax software needs the USD value of every transaction at the moment it confirmed, and the Bitcoin chain does not contain it. On 8 September 2026 we asked four public Bitcoin transaction APIs for the same confirmed transaction. All four returned HTTP 200 and not one carried a USD amount, a price, or any fiat field. Cost basis is a join, not a lookup. We cover where that join belongs, the block timestamp traps that corrupt it silently, what wallet-by-wallet tracking under Rev. Proc. 2024-28 means for your data model, and the five questions to ask a Bitcoin data vendor before you sign.

Read
Buyer guides

1099-DA Reconciliation Software for Bitcoin CPAs

1099-DA reconciliation for bitcoin turns on the transferred-in lots the broker leaves without basis. On 28 September 2026, 1,709 deposits swept into one exchange wallet had sat a median 2.2 hours, and only 0.21% of the value behind them was over a year old one step back, so the holding period lives in the client's own wallet history.

Read
Buyer guides

Crypto Date of Death Valuation Tools for Estates

A crypto date of death valuation needs the balance at the last block before death and a stated price method. On 1 September 2026 the Eastern-day high and low were $2,829.20 apart, $28,292 on 10 BTC, and death at 3:00 pm fell 52 seconds before block 965,072.

Read
Data guides

BigQuery Bitcoin Dataset Queries and What They Cost

Google publishes the Bitcoin chain as four raw tables in BigQuery, free to access and billed per terabyte scanned. What is in the dataset, why balances and entity labels are not, the SQL that reconstructs a balance, and the four reasons a Bitcoin query gets expensive.

Read

Query the whole Bitcoin blockchain

BitcoinDatabase indexes the public Bitcoin blockchain block by block and returns balances, UTXOs, transactions, on-chain metrics and fund flows by REST API, SQL and dashboards, with no node to run.

REST + SQL + dashboards · address history since 2009 · new blocks within seconds

Informational on-chain data only · not financial, investment or legal advice · AML features are compliance tooling to support your own review.