Quick Answer: The same crypto sale can produce a very different taxable gain depending on which purchase lot you treat as sold. In the default example, selling one unit at $40,000 with $80,000 of other taxable income, HIFO realizes a $10,000 long-term gain that adds $1,500.00 of federal tax, against $4,500.00 under FIFO and $4,400.00 under LIFO.
What does this calculator do?
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 federal tax under whichever method you select, splitting the gain into its short-term and long-term components when a sale draws from lots with mixed holding periods. The headline is the tax the sale itself adds: your federal income tax with the sale minus the tax on your other income alone. The total including your other income is shown separately.
How is this calculated?
- 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.
- 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.
- 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.
- Net gains and losses, then tax the short-term portion as ordinary income. A loss in one holding period offsets a gain in the other. If the sale nets to a loss, up to $3,000 of it reduces ordinary taxable income and the rest is carried forward. A net short-term gain is added to your other taxable income, which is taken as already net of your standard or itemized deduction, and run through the 2026 federal bracket schedule using this platform's shared
progressiveTaxprimitive. - 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.
- Isolate the tax caused by the sale. The same two steps are run on your other taxable income alone. The headline is the difference: federal income tax with the sale minus federal income tax without it. A net loss produces a negative figure, the tax the loss saves.
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 without the sale. The $80,000 is taxable income after deductions, so no deduction is taken again. Single 2026 brackets: 10% of $12,400 = $1,240, plus 12% of $38,000 = $4,560, plus 22% of ($80,000 − $50,400) = $6,512, for $12,312.
Tax caused by the sale if HIFO is selected (the $10,000 gain is entirely long-term): - Ordinary tax is unchanged at $12,312, because no short-term gain is added - Long-term capital gains stacking: tax on ($80,000 + $10,000 = $90,000) minus tax on $80,000, using the capital gains brackets, equals $6,082.50 − $4,582.50 = $1,500 (the whole gain sits above the $49,450 top of the 0% band, so all of it is taxed at 15%) - Tax caused by the sale: $1,500.00. Total federal income tax including other income: $12,312 + $1,500 = $13,812
If FIFO is selected instead (the $30,000 gain is entirely long-term): - LTCG stacking: tax on $110,000 minus tax on $80,000 = $9,082.50 − $4,582.50 = $4,500 - Tax caused by the sale: $4,500.00, three thousand dollars more than HIFO for the same transaction. Total including other income: $16,812
If LIFO is selected instead (the $20,000 gain is entirely short-term): - Ordinary tax on $100,000 ($80,000 plus the $20,000 short-term gain): $1,240 + $4,560 + 22% of $49,600 = $10,912, for $16,712 - Tax caused by the sale: $16,712 − $12,312 = $4,400.00, all at the 22% ordinary rate
Here LIFO's $20,000 short-term gain costs $100 less than FIFO's $30,000 long-term gain, because 22% of $20,000 is just under 15% of $30,000. At a higher ordinary bracket the order flips: in the 32% bracket the same short-term gain would cost $6,400.
What does this calculator 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.
- Net Investment Income Tax. The 3.8% NIIT on investment income above $200,000 of modified AGI ($250,000 joint) is not added. The capital gains tax calculator includes it.
- The deduction is not computed here. Enter taxable income after your standard or itemized deduction. Entering gross income overstates the tax caused by the sale whenever it pushes the gain into a higher bracket.
- Prior-year loss carryforwards. Losses carried in from earlier years are not an input, so they do not offset this sale's gain.
- 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.
What mistakes do people make with this?
- 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?
Can I switch between FIFO, LIFO, and HIFO between different sales?
Why does the same dollar amount of gain sometimes owe more tax than a larger gain?
Do I owe tax if I swap one cryptocurrency for another, without ever converting to dollars?
Why is the headline smaller than my total tax bill?
What happens if the sale is at a loss?
What happens if I sell more units than exist in any single lot?
Sources
- Internal Revenue Service, Notice 2014-21 (virtual currency treated as property for federal tax purposes). 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). irs.gov/pub/irs-drop/rr-19-24.pdf
- Internal Revenue Code §1221-§1222 (capital assets, holding period, short-term versus long-term gain). law.cornell.edu/uscode/text/26/1221
- Internal Revenue Code §1211(b) ($3,000 annual limit on net capital losses against ordinary income). law.cornell.edu/uscode/text/26/1211
- 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). 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. irs.gov/filing/digital-assets