BedrockCalculator
Verified Primary-Source Mathematics
Verified by Aapt Dubey, MBA (Marketing & Finance)Last verified August 21, 2026

Crypto Capital Gains & Loss Calculator (FIFO/HIFO/LIFO)

Quick Answer: The same crypto sale can produce a very different taxable gain depending on which purchase lot you treat as sold, and choosing HIFO instead of FIFO or LIFO usually minimizes the gain you owe tax on.

Adjust Inputs

units
$
months
units
$
months
units
$
months
units
$
$
Quick Prepayment Scenarios
Total Tax Owed on This Sale
$10,270.00

Exact interest reduction computed via penny-reconciled monthly amortization schedules.

Taxable Gain (Selected Method)
$10,000.00
Gain Under FIFO
$30,000.00
Gain Under LIFO
$20,000.00
Gain Under HIFO
$10,000.00
Short-Term Portion (Taxed at Ordinary Rates)
$0.00
Long-Term Portion (Taxed at Capital Gains Rates)
$10,000.00

> Quick Answer: The same crypto sale can produce a very different taxable gain depending on which purchase lot you treat as sold, and choosing HIFO instead of FIFO or LIFO usually minimizes the gain you owe tax on.

Overview

The IRS treats cryptocurrency as property, not currency, which means every sale, swap, or conversion to fiat is a taxable event governed by ordinary capital gains rules, the same framework that applies to stocks. That sounds simple until you remember that most crypto holders buy the same asset repeatedly over time, at different prices, on different dates. When you finally sell some of it, which purchase are you actually selling?

The IRS lets taxpayers choose, as long as they can substantiate the method and apply it consistently. First-In-First-Out (FIFO) treats your earliest purchases as the ones sold first. Last-In-First-Out (LIFO) does the opposite, treating your most recent purchases as sold first. Highest-In-First-Out (HIFO), a form of specific identification, treats your most expensive purchases as sold first, regardless of when you bought them. Because taxable gain is proceeds minus cost basis, and HIFO always picks the highest cost basis available, it mathematically produces the smallest possible taxable gain (or the largest deductible loss) of the three methods, for any given sale.

The method you choose does not just change the size of the gain. It can also change its character. Cryptocurrency held 12 months or more before sale qualifies for long-term capital gains rates, which top out at 20% federally. Cryptocurrency held less than 12 months is short-term and taxed at your full ordinary income tax rate, which can run as high as 37%. A method that happens to draw from a short-term lot, even if it produces a smaller dollar gain, can sometimes trigger more tax than a method that draws from a long-term lot with a larger gain.

This calculator lets you enter up to three purchase lots with their own cost basis and holding period, plus one sale, and compares the resulting gain under all three methods side by side. It then computes the actual federal tax owed under whichever method you select, correctly splitting the gain into its short-term and long-term components when a sale draws from lots with mixed holding periods.

How This Is Calculated

  1. Order the lots according to the selected method. FIFO keeps your lots in purchase-chronological order; LIFO reverses that order; HIFO sorts lots by cost basis per unit from highest to lowest, independent of purchase date.
  2. Consume lots in that order until the sale quantity is satisfied. The calculator walks down the ordered list, taking as many units as available from each lot before moving to the next, tracking exactly how much cost basis and how many units came from short-term (under 12 months) versus long-term (12 months or more) lots.
  3. Split the realized gain by holding period. Proceeds and cost basis are tracked separately for the short-term and long-term portions of the sale, since a single sale can legitimately contain both if it draws from lots with different holding periods.
  4. Tax the short-term portion as ordinary income. The short-term gain is added to your other taxable income and run through the standard federal bracket schedule, using this platform's shared progressiveTax primitive.
  5. Tax the long-term portion using capital gains "stacking." Long-term gains are treated as sitting on top of your ordinary taxable income for purposes of determining which capital gains bracket applies. The calculator computes this as the difference between the capital gains tax on (ordinary taxable income + long-term gain) and the capital gains tax on ordinary taxable income alone, which correctly captures how much of the long-term gain falls in each bracket.

Worked Example

Consider three purchase lots of the same asset: Lot 1, one unit bought for $10,000, held 24 months; Lot 2, one unit bought for $30,000, held 18 months; Lot 3, one unit bought for $20,000, held 6 months. The holder sells one unit for $40,000, with $80,000 of other taxable income, filing single.

Comparing the three methods: - FIFO consumes Lot 1 first: gain = $40,000 − $10,000 = $30,000, entirely long-term (Lot 1 was held 24 months) - LIFO consumes Lot 3 first: gain = $40,000 − $20,000 = $20,000, entirely short-term (Lot 3 was held only 6 months) - HIFO consumes Lot 2 first (the highest cost basis): gain = $40,000 − $30,000 = $10,000, entirely long-term (Lot 2 was held 18 months)

HIFO produces the smallest gain of the three, exactly as expected, since it always selects the highest available cost basis first.

Tax owed if HIFO is selected (the $10,000 gain is entirely long-term): - Ordinary tax on $80,000 other income (single, 2026 brackets, $16,100 standard deduction, taxable $63,900): $1,240 + $4,560 + $2,970 = $8,770 - Long-term capital gains stacking: tax on ($63,900 + $10,000 = $73,900) minus tax on $63,900, using the capital gains brackets, equals $3,667.50 − $2,167.50 = $1,500 (the entire $10,000 gain falls in the 15% bracket) - Total tax owed: $8,770 + $1,500 = $10,270

Tax owed if FIFO is selected instead (the $30,000 gain is entirely long-term): - Ordinary tax is unchanged at $8,770 - LTCG stacking: tax on $93,900 minus tax on $63,900 = $6,667.50 − $2,167.50 = $4,500 - Total tax owed: $8,770 + $4,500 = $13,270, three thousand dollars more than HIFO despite the underlying transaction being identical

Tax owed if LIFO is selected instead (the $20,000 gain is entirely short-term): - Ordinary tax on $100,000 ($80,000 other income plus the $20,000 short-term gain stacked as ordinary income): $1,240 + $4,560 + $7,370 = $13,170 - No long-term gain, so LTCG tax is $0 - Total tax owed: $13,170, the highest of the three, because ordinary rates apply to the entire gain

What This Does Not Account For

  • Wash sale rules. Unlike stocks, cryptocurrency is not currently subject to the wash sale rule, meaning you can sell at a loss and immediately repurchase the same asset without disallowing the loss. This calculator does not need to enforce a wash sale disallowance, but be aware that legislation could change this in the future.
  • Broker-reported cost basis and Form 1099-DA. Starting with the 2025 tax year, crypto brokers and exchanges are required to report cost basis information to the IRS on Form 1099-DA for many transactions, which can constrain which lot-selection method you can retroactively apply if you did not make a specific-identification election at the time of sale.
  • Mining, staking, and airdrop income. This calculator only models the capital gains side of a sale. Cryptocurrency received from mining, staking rewards, or airdrops is generally ordinary income at the fair market value on the date received, which then becomes the cost basis for a future sale.
  • Transaction fees and gas costs on the sale side. This calculator assumes the sale price entered is net of any selling fees. Real transactions often need fees added to cost basis or subtracted from proceeds separately.
  • More than three lots or fractional partial-lot sales across many transactions. Active traders often accumulate dozens of lots. This calculator handles the core mechanics with three representative lots; a full tax return typically requires software that tracks every individual lot.
  • State tax. This calculator computes federal tax only. Most states tax capital gains as ordinary income at the state level, on top of the federal calculation shown here.

Common Pitfalls

  • Assuming FIFO is mandatory. Many exchanges default to FIFO on their tax reports, leading users to assume it is required. The IRS permits specific identification methods like HIFO as long as you can substantiate the method with records and apply it consistently, and increasingly exchanges support this through their tax reporting tools.
  • Not tracking holding periods per lot. A sale drawing from multiple lots can straddle the short-term and long-term line, and it is easy to accidentally apply a single holding-period assumption to an entire sale when the reality is mixed.
  • Forgetting that specific identification requires contemporaneous records. To use HIFO or another specific-identification method, you generally need to identify which lot you are selling at or before the time of the transaction, not retroactively reconstruct it at tax time.
  • Ignoring that switching methods year to year can raise scrutiny. While the IRS does not mandate one method, consistency matters; switching methods opportunistically between years without adequate substantiation can be flagged during an audit.
  • Confusing realized and unrealized gains. Only actual sales, swaps, or conversions to fiat trigger a taxable event. Simply watching an unsold position appreciate creates no tax liability under current law.

Frequently Asked Questions

Which cost-basis method should I use?
HIFO generally minimizes your current-year taxable gain, which is why many active traders default to it when the exchange or tax software supports specific identification. However, the "best" method depends on your overall tax situation, including whether you would rather realize gains now at a lower rate or defer them, so there is no universally correct answer.
Can I switch between FIFO, LIFO, and HIFO between different sales?
The IRS generally requires you to use a consistent, substantiated method rather than cherry-picking a different one for every individual sale after the fact. Specific identification methods like HIFO require you to designate which lot you are selling at the time of the transaction, which is easier to do with exchange tools that support tax-lot selection than to reconstruct later.
Why does the same dollar amount of gain sometimes owe more tax than a larger gain?
Because short-term and long-term gains are taxed under completely different rate schedules. A smaller short-term gain taxed at your ordinary marginal rate, which can reach 37%, can easily owe more tax than a larger long-term gain taxed at the capped 15% or 20% long-term capital gains rate.
Do I owe tax if I swap one cryptocurrency for another, without ever converting to dollars?
Yes. The IRS treats a crypto-to-crypto swap as a sale of the first asset (a taxable event, calculated the same way as this calculator models) followed by a purchase of the second asset with a new cost basis, even though no fiat currency changed hands at any point.
What happens if I sell more units than exist in any single lot?
The sale draws sequentially from as many lots as needed under your selected ordering method until the full sale quantity is covered, and the resulting gain reflects a blend of cost bases and, potentially, a blend of short-term and long-term character across the lots consumed.

Sources

  • Internal Revenue Service, Notice 2014-21 (virtual currency treated as property for federal tax purposes). https://www.irs.gov/pub/irs-drop/n-14-21.pdf
  • Internal Revenue Service, Revenue Ruling 2019-24 (specific identification and lot-selection guidance for virtual currency). https://www.irs.gov/pub/irs-drop/rr-19-24.pdf
  • Internal Revenue Code §1221-§1222 (capital assets, holding period, short-term versus long-term gain).
  • Internal Revenue Service, "IRS releases tax inflation adjustments for tax year 2026, including amendments from the One, Big, Beautiful Bill," Revenue Procedure 2025-32 (2026 ordinary and long-term capital gains brackets). https://www.irs.gov/newsroom/irs-releases-tax-inflation-adjustments-for-tax-year-2026-including-amendments-from-the-one-big-beautiful-bill
  • Internal Revenue Service, Digital Assets guidance hub. https://www.irs.gov/filing/digital-assets

Related calculators in this suite

Complementary financial planning tools