hackerdb

Home / Free tools / Crypto cost-basis calculator (FIFO and LIFO)

Crypto cost-basis calculator: FIFO or LIFO lots in your browser

Enter your purchases as lots and your sales. The calculator applies FIFO or LIFO, shows which lots were used, what remains and the realised gain or loss in the same currency you used for costs. It is a working aid, not tax, accounting or legal advice.

How to use it

  1. List your purchases. One lot per line: date, quantity bought, total cost in one currency (fees included if you want them in the basis).
  2. List your sales. Date, quantity sold, total proceeds in the same currency.
  3. Choose FIFO or LIFO. FIFO uses the oldest remaining lot first; LIFO uses the newest. Use the method you actually apply in your records.
  4. Read remaining lots and realised gain. Then copy the figures into your own records. This page does not store them.

What cost basis is, in one paragraph

When you sell crypto, the taxable gain (in places that tax it) is usually proceeds minus cost basis: what those units cost you when you acquired them. Because coins are fungible, you need a rule for which purchase a sale comes from. FIFO (first in, first out) takes the oldest unsold lot first. LIFO (last in, first out) takes the newest. Some places allow or require specific identification of lots. This tool supports FIFO and LIFO only, and it treats every line as a buy or a sell in a single pool. It does not model transfers between your own wallets, which typically should not be sales.

How to avoid a misleading result

A spreadsheet that keeps lots per wallet is easier to maintain than a one-off paste. The Crypto Wallet Ledger & Cost-Basis Tracker is built for that: lots, days held, gains by term and a year-end checklist. Same publisher, paid in crypto, no account.

Worked example

This is what the tool produces for the sample input, so you can see the result without running it.

Input

2024-01-10, 1, 10000
2024-07-01, 1, 20000

Result

Method: FIFO. Realised gain or loss: 25,000.00 on 1.5000000 sold, proceeds 45,000.00. Remaining: 0.50000000 with unmatched cost 10,000.00 (average 20,000.00 each).

Sales

DateQty soldProceedsMatched costGain / lossLots used
2025-01-011.545,000.0020,000.0025,000.001.00000 @ 10,000.00 from 2024-01-10; 0.500000 @ 20,000.00 from 2024-07-01

Remaining lots

BoughtQuantity leftUnit costUnmatched cost
2024-07-010.520,000.0010,000.00

This is a calculator, not tax advice. Jurisdictions differ on method, transfers between wallets, income from staking or airdrops, fees, and the holding period that separates short-term from long-term gains. Check the rules that apply to you, or a qualified adviser, before filing.

Frequently asked questions

Is this tax advice?

No. It is a calculator that applies FIFO or LIFO to the numbers you enter. Tax treatment depends on where you live and the facts of each transaction.

Which method should I use?

Use the method required or chosen in your records and be consistent. This tool does not tell you which one is allowed.

Can I enter several wallets?

Not separately. It treats all lines as one pool. For per-wallet lots, use a ledger spreadsheet.

Is my history uploaded?

No. The calculation runs in your browser.

More free tools

All free tools