Bitcoin Cost Basis Calculator

Calculate your BTC cost basis using FIFO, LIFO, and HIFO accounting methods. Enter up to three buy lots and a sell transaction to compare capital gains across methods and find which one minimizes your tax bill.

Ad Space

How Bitcoin Cost Basis Works

When you sell Bitcoin, you owe taxes on the capital gain — the difference between what you sold it for and what you originally paid. That original purchase price is called your cost basis. If you bought 1 BTC at $30,000 and sell it at $65,000, your capital gain is $35,000. Simple enough when you only bought once, but most investors make multiple purchases at different prices over time. That is where cost basis accounting methods become critical.

The method you choose to identify which coins were "sold" directly affects how much tax you owe. Three primary methods exist: FIFO (First In, First Out), LIFO (Last In, First Out), and HIFO (Highest In, First Out). Each method can produce dramatically different tax outcomes from the same set of transactions.

Capital Gain Formula

Capital Gain = (Sell Price × Amount Sold) − Cost Basis

Where Cost Basis = sum of (purchase price × amount) for each lot sold under the chosen method

FIFO — First In, First Out

FIFO assumes you sell the coins you acquired first. This is the default method used by most exchanges and the IRS if you do not specify otherwise. In a market that has generally risen over time, FIFO typically produces the highest capital gains because your earliest (cheapest) coins are sold first. However, FIFO is the simplest to track and the most widely accepted by tax authorities worldwide.

LIFO — Last In, First Out

LIFO sells the most recently purchased coins first. If you bought Bitcoin recently at a higher price and the market has not moved much, LIFO can result in smaller gains (or even losses). LIFO is particularly useful during bear markets or when your most recent purchases were at higher prices than earlier ones.

HIFO — Highest In, First Out

HIFO always sells the lot with the highest cost basis first, regardless of when it was purchased. This method is specifically designed to minimize capital gains and therefore minimize taxes. HIFO requires specific identification of each lot, meaning you must be able to prove exactly which coins were sold. Many crypto tax platforms support HIFO tracking.

Example

Three Buy Lots, Selling 0.5 BTC at $65,000

  • Lot 1: 0.3 BTC at $20,000/BTC (cost: $6,000)
  • Lot 2: 0.5 BTC at $40,000/BTC (cost: $20,000)
  • Lot 3: 0.2 BTC at $60,000/BTC (cost: $12,000)
  • Sale: 0.5 BTC at $65,000/BTC = $32,500 proceeds
  • FIFO: Sells Lot 1 (0.3 BTC) + 0.2 from Lot 2 — Cost basis $14,000 — Gain: $18,500
  • LIFO: Sells Lot 3 (0.2 BTC) + 0.3 from Lot 2 — Cost basis $24,000 — Gain: $8,500
  • HIFO: Sells Lot 3 (0.2 at $60K) + 0.3 from Lot 2 (at $40K) — Cost basis $24,000 — Gain: $8,500

Why Cost Basis Matters for Tax Reporting

The IRS treats cryptocurrency as property, meaning every sale, trade, or exchange is a taxable event. Failing to track your cost basis accurately can lead to overpaying taxes or, worse, underpaying and facing penalties. With Bitcoin's price history spanning from under $1 to over $100,000, the difference between accounting methods can mean thousands of dollars in tax savings.

Crypto investors who dollar-cost average into Bitcoin often have dozens or hundreds of buy lots at different prices. Choosing the right accounting method — and being consistent with it — is one of the most impactful tax optimization strategies available. This calculator helps you compare all three methods side by side so you can make an informed decision before filing.

Important Disclaimers

This calculator provides estimates for educational purposes only. Tax laws vary by jurisdiction and change frequently. Always consult a qualified tax professional for advice specific to your situation. The IRS requires that you maintain records of all cryptocurrency transactions, including dates, amounts, and fair market values at the time of each transaction.