Real Historical Crypto Prices

Free Crypto Cost Basis Calculator

Calculate your cryptocurrency cost basis using FIFO, LIFO, or HIFO accounting methods. Enter your buy and sell transactions, fetch real historical prices, and get accurate cost basis calculations for tax reporting and portfolio analysis.

FIFO / LIFO / HIFO
Real Historical Prices
100% Free
Popular:
buy#1

Price data sourced from FinancialModelingPrep. Historical prices are end-of-day closing prices. Past performance is not indicative of future results.

What Is a Crypto Cost Basis Calculator?

A crypto cost basis calculator is a financial tool that helps cryptocurrency investors determine the original cost of their holdings for tax reporting and portfolio analysis. When you buy cryptocurrency at different prices over time — whether through dollar cost averaging, lump-sum purchases, or trading — your cost basis becomes the weighted average or lot-specific cost of the coins you still hold.

Our cryptocurrency cost basis calculator goes beyond simple average price calculations by supporting three industry-standard accounting methods: FIFO (First In, First Out), LIFO (Last In, First Out), and HIFO (Highest In, First Out). Each method produces different cost basis figures and therefore different capital gains or losses when you sell. The calculator also fetches real historical prices from the market, so you can verify your transaction records against actual closing prices.

How to Use This Crypto Cost Basis Calculator

  1. 1

    Select Your Cryptocurrency

    Search for the cryptocurrency by name or symbol (e.g., BTCUSD for Bitcoin, ETHUSD for Ethereum). You can also click one of the popular crypto quick-select buttons.

  2. 2

    Choose Your Accounting Method

    Select FIFO, LIFO, or HIFO. FIFO is the IRS default and sells your oldest coins first. HIFO typically minimizes your tax liability by selling the highest-cost coins first.

  3. 3

    Enter Your Transactions

    Add each buy and sell transaction with the date, quantity, and price per unit. Use the fetch button to automatically retrieve the historical closing price for any date.

  4. 4

    Calculate and Review

    Click "Calculate Cost Basis" to see your average cost per unit, total cost basis, unrealized and realized P&L, and a detailed breakdown of your remaining lots. Export the results to CSV for your records.

Understanding Crypto Cost Basis Methods

The cost basis method you choose determines which specific coins are considered "sold" when you dispose of cryptocurrency. This directly affects your capital gains calculation and tax liability.

FIFO

First In, First Out

Sells the oldest purchased coins first. This is the IRS default method. In a rising market, FIFO typically results in higher capital gains because your oldest (cheapest) coins are sold first.

LIFO

Last In, First Out

Sells the most recently purchased coins first. In a rising market, LIFO can result in lower capital gains because your newest (most expensive) coins are sold first, producing a higher cost basis.

HIFO

Highest In, First Out

Sells the highest-cost coins first regardless of purchase date. This method typically minimizes taxable gains by maximizing the cost basis of sold coins. Requires specific identification records.

How to Calculate Cost Basis for Crypto

The cost basis for cryptocurrency is calculated using these core formulas:

Cost Basis = Purchase Price × Quantity

Capital Gain = Sale Price − Cost Basis

Average Cost = Total Cost Basis ÷ Total Quantity Held

When you have multiple purchase lots at different prices, the accounting method (FIFO, LIFO, or HIFO) determines which lots are matched against each sale. For example, if you bought 1 BTC at $30,000 and later bought 1 BTC at $50,000, then sold 1 BTC at $45,000: under FIFO your gain is $15,000 (sold the $30,000 lot), under LIFO your loss is $5,000 (sold the $50,000 lot), and under HIFO your loss is also $5,000 (sold the highest-cost $50,000 lot).

Dollar Cost Averaging and Crypto Cost Basis

Dollar cost averaging (DCA) is one of the most popular cryptocurrency investment strategies. By investing a fixed dollar amount at regular intervals, you naturally accumulate coins at various price points. This creates multiple purchase lots, each with its own cost basis. Our calculator handles DCA portfolios seamlessly — simply add each periodic purchase as a separate buy transaction with its date and amount.

The average cost per unit displayed in the results represents your weighted average purchase price across all remaining lots. This is the break-even price — if the current market price is above your average cost, your position is profitable. If it is below, you are holding at an unrealized loss.

Crypto Cost Basis and Tax Implications

In the United States, the IRS treats cryptocurrency as property. Every time you sell, trade, or dispose of cryptocurrency, it is a taxable event. Your capital gain or loss is the difference between the sale price and your cost basis. Short-term gains (held less than one year) are taxed at ordinary income rates, while long-term gains (held more than one year) benefit from lower capital gains tax rates.

Accurate cost basis tracking is essential for proper tax reporting. The IRS requires taxpayers to report cryptocurrency transactions on Form 8949 and Schedule D. Using the wrong cost basis method or failing to track your purchase lots can lead to overpaying taxes or, worse, underpaying and facing penalties.

  • Keep detailed records — Record every purchase, sale, and transfer with dates, quantities, and prices.
  • Choose a consistent method — Once you select FIFO, LIFO, or HIFO, apply it consistently across your portfolio.
  • Account for all taxable events — Trading one crypto for another, paying with crypto, and receiving airdrops or staking rewards are all taxable events.
  • Consider tax-loss harvesting — Selling positions at a loss to offset gains can reduce your tax liability. Note that crypto is not currently subject to the wash sale rule in the US (as of 2024).

Frequently Asked Questions

What is a crypto cost basis calculator?

A crypto cost basis calculator helps you determine the original value of your cryptocurrency holdings for tax and profit/loss purposes. It tracks the price you paid for each unit of crypto, accounting for multiple purchases at different prices over time. This is essential for calculating capital gains or losses when you sell.

What is the difference between FIFO, LIFO, and HIFO?

FIFO (First In, First Out) assumes you sell the oldest coins first. LIFO (Last In, First Out) assumes you sell the most recently purchased coins first. HIFO (Highest In, First Out) assumes you sell the coins with the highest cost basis first, which typically minimizes taxable gains. The IRS allows specific identification methods, but FIFO is the default if no method is specified.

How do I calculate cost basis for cryptocurrency?

To calculate crypto cost basis: (1) Record every purchase with the date, quantity, and price per unit. (2) Choose an accounting method (FIFO, LIFO, or HIFO). (3) When you sell, match the sold coins to specific purchase lots based on your chosen method. (4) The cost basis is the original purchase price of the matched lots. Your gain or loss is the sale price minus the cost basis.

Does this calculator fetch real crypto prices?

Yes. When you enter a transaction date and cryptocurrency, the calculator can automatically fetch the historical closing price for that date from FinancialModelingPrep. It also fetches the current real-time price to calculate your unrealized profit or loss on remaining holdings.

Which cost basis method should I use for crypto taxes?

The IRS default method is FIFO if you do not specify otherwise. However, you can use specific identification (which includes LIFO and HIFO) if you adequately identify the specific units sold. HIFO often results in the lowest tax liability because it matches sales against the highest-cost purchases first. Consult a tax professional for advice specific to your situation.

What is dollar cost averaging in crypto?

Dollar cost averaging (DCA) is an investment strategy where you buy a fixed dollar amount of cryptocurrency at regular intervals, regardless of the price. This results in purchasing more units when prices are low and fewer when prices are high, lowering your average cost basis over time. Our calculator handles DCA transactions naturally — just add each purchase as a separate buy transaction.

How is unrealized P&L calculated?

Unrealized P&L (profit and loss) is calculated by comparing the current market value of your remaining holdings to their cost basis. The formula is: Unrealized P&L = (Current Price × Remaining Quantity) − Total Cost Basis of Remaining Lots. This represents the gain or loss you would realize if you sold all remaining holdings at the current price.

Is this crypto cost basis calculator free?

Yes, this calculator is completely free to use with no registration required. It uses real historical and real-time cryptocurrency price data to provide accurate cost basis calculations for any supported cryptocurrency.

Tracked Your Cost Basis? Automate Your Crypto Trading Strategy

Use Pineify's AI-powered Pine Script generator to build custom crypto indicators and automated trading strategies. Or let our AI Stock Picker identify the best opportunities across markets.