HisabCalc

Crypto Cost Basis HIFO Calculator

Work out the cost basis of a crypto sale under the highest in first out method and what is left in your holdings.

Enter your numbers

Example: 2

Example: 31500

Example: 1.5

Example: 42750

Example: 2.5

Result
Share on WhatsApp

Figures are computed on your device; nothing is sent anywhere.

Formula

sort lots by unit price descending; consume the highest priced lots first up to sellQty; costBasis = sum of consumed qty * price; averageCostPerUnit = costBasis / sellQty; remainingQty = totalQty - sellQty; remainingCostBasis = totalCost - costBasis

How the calculation works

The calculator ranks your buy lots from the most expensive unit price down to the cheapest.

It sells from the top of that list until the quantity sold is covered, so the dearest units leave first.

It reports the cost basis that leaves with those units and the basis that stays behind in your remaining holdings.

Common mistakes

When to use it

Worked example

With 2 units at 31,500 and 1.5 units at 42,750, selling 2.5 units gives a HIFO cost basis of 95,625, an average cost of 38,250 per unit, 1 unit remaining worth 31,500 of basis.

Cost basis 95,625.00
Average cost per unit 38,250.00
Remaining quantity 1.00
Remaining cost basis 31,500.00

Common questions

Why use HIFO instead of average cost?

HIFO sells your most expensive units first, which raises the recorded cost basis and lowers the taxable gain on that sale.

Last updated: 2026-10-04