PennyCompass

Crypto Cost Basis Calculator

Free crypto cost basis calculator. Compare FIFO, LIFO, and HIFO accounting methods on the same set of buys and sells to see which minimizes your tax.

Published

Enter up to 5 buy lots and a sale. See realized gain under FIFO, LIFO, and HIFO methods.

Buy lots

Date (newer = lower #)
Units
Price per unit ($)

Sale

FIFO gain

LIFO gain

HIFO gain (lowest tax)

Same coins sold, three very different tax bills

When you sell crypto you bought across several purchases, the gain you report depends entirely on which coins you decide you sold. The proceeds are fixed by the market, but the cost basis you subtract is a choice among accounting methods. FIFO, first in first out, sells your oldest coins first. LIFO, last in first out, sells your newest. HIFO, highest in first out, sells your most expensive coins first to shrink the gain. This tool runs all three on the same set of buy lots and one sale so you can see, in dollars, how much the method choice is worth.

The engine sorts your lots by the chosen rule, then fills the units you sold from the front of that sorted list until the quantity is covered, adding up the cost as it goes. Gain is simply proceeds minus that matched cost. Because the methods pick different coins to "sell," they assign different costs to the same transaction. HIFO almost always produces the smallest taxable gain, which is why it sits in the highlighted box.

Selling 2 BTC from three uneven lots

Suppose you hold three Bitcoin, each bought separately: the oldest at $45,000, the next at $20,000, and the newest at $40,000. You sell 2 units at $60,000 each, for $120,000 of proceeds. Watch how the methods diverge. FIFO takes the two oldest lots, the $45,000 and the $20,000 coin, for a basis of $65,000 and a gain of $55,000. LIFO takes the two newest, the $40,000 and the $20,000 coin, for a basis of $60,000 and a gain of $60,000, the worst result here. HIFO takes the two priciest, the $45,000 and the $40,000 coin, for a basis of $85,000 and a gain of just $35,000. The spread between the best and worst method is $25,000 of taxable gain on one sale.

Method Lots sold Basis Taxable gain
FIFO$45k + $20k$65,000$55,000
LIFO$40k + $20k$60,000$60,000
HIFO$45k + $40k$85,000$35,000
$55,000 FIFO $60,000 LIFO $35,000 HIFO
HIFO reports the smallest gain; LIFO happens to be worse than FIFO here.

The documentation rule that makes HIFO legal

Before you celebrate the HIFO number, understand the rule behind it. The IRS treats virtual currency as property, and the default method when you cannot identify which units you sold is FIFO. To use HIFO or any specific lot, you must use Specific Identification, which means you can show records identifying the exact units sold, with their acquisition date, basis, and the date and value at sale, documented at or before the time of the trade. Reconstructing it after the fact does not satisfy the standard. Reputable crypto tax software handles this lot-level tracking, and your gains ultimately flow onto Form 8949 and Schedule D. A starting point worth knowing: beginning in 2025, brokers moved to per-account basis tracking and Form 1099-DA reporting, which makes clean per-wallet records more important than ever.

When the lowest gain is not the smartest move

Minimizing the gain is not always the goal. If you have capital losses to use up, or you are in a year with little other income and could realize gains in the 0% long-term bracket, you might deliberately pick a higher-gain method. Holding period matters too: this tool computes the gain amount but not whether each lot is short-term or long-term. Selling a coin held more than a year qualifies for lower long-term rates, so the method that minimizes the dollar gain is not always the one that minimizes the tax. Layer holding period on top of the basis math before you decide. This calculator is for active traders and anyone with multiple buys facing a sale who wants to see the lot-selection decision in concrete numbers, not for a single-purchase holder whose basis is unambiguous.

Does the wash-sale rule apply to crypto?

As things stand, the wash-sale rule generally does not apply to crypto, because that rule is written for stocks and securities and the IRS treats virtual currency as property. That has let some investors sell at a loss and rebuy immediately to harvest the loss. Be cautious, though: lawmakers have repeatedly proposed closing this gap, so treat it as a current opening rather than a permanent feature, and watch for changes.

Does the method change whether my gain is short-term or long-term?

It can, because the method picks which lots you sold, and each lot carries its own purchase date. A lot held more than a year gets the lower long-term rate; under a year is taxed as ordinary income. So HIFO might minimize the dollar gain yet pull in a short-term lot, while FIFO might surface a long-term lot taxed more gently. Check the holding period of the specific lots a method selects before assuming the smallest gain wins.

Frequently asked questions

Which method should I use?
HIFO (highest in, first out) usually minimizes tax. But the IRS requires Specific Identification documented at time of trade for non-FIFO methods. FIFO is the safe default if you didn't pre-identify.
Can I switch methods year to year?
No, once you pick a method for a tax year, stay with it for all coins of that type. You can use different methods for different cryptocurrencies but consistency within each is required.

Related calculators

Embed this calculator on your site (free)

Paste this code into your page. The calculator stays up to date automatically and links back to PennyCompass.

Calculator by PennyCompass