FIFO / LIFO Crypto Cost Basis Calculator

Calculate cryptocurrency cost basis using FIFO or LIFO accounting. Enter buys and sales with dates and USD amounts, see which lots fund each disposal, days held per slice, remaining inventory, and compare net realized gain between methods before using our country tax calculators.

Cost basis method

FIFO (first-in, first-out) sells the oldest lots first — default in the US and many countries. LIFO (last-in, first-out) sells the newest lots first — allowed in some jurisdictions. Compare both to see how method changes realized gain.

Buys and sales

Enter each acquisition and disposal with date, quantity, and total USD. On buys, amount is what you paid including fees. On sales, amount is what you received after fees. Swaps count as a sell plus a buy.

Realized gain summary

Net realized gain
$15,000.00
Total proceeds
$35,000.00
Total cost basis used
$20,000.00

How each sale was matched

  • 0.5 BTC · 2025-09-10+$15,000.00

    $35,000.00 proceeds · $20,000.00 basis

    • 0.5 from 2025-01-15 · cost $20,000.00 · held 238 days

Remaining inventory

  • 0.5 BTC acquired 2025-06-01 · cost $32,000.00

Educational cost-basis math for planning and record-keeping — not tax advice. Your country may require FIFO, specific lot ID, HMRC pooling, or other rules. Use our geo tax calculators for estimates after you know your basis.

What FIFO and LIFO mean for crypto cost basis

When you sell cryptocurrency, tax systems ask for gain or loss: proceeds minus cost basis. If you bought the same coin at different prices and dates, you must decide which purchase “funds” the sale. FIFO (first-in, first-out) uses your oldest unsold lots first — the default for many US taxpayers and a common method worldwide. LIFO (last-in, first-out) uses the newest lots first, which can lower or raise realized gain when prices rose over time. Some countries mandate one method; others let you choose within rules. This calculator does not file anything — it shows transparent lot-by-lot matching, holding period in days for each slice, inventory left on hand, and a side-by-side FIFO vs LIFO comparison so you can export numbers into our US, UK, Germany, or other tax calculators.

How we match lots (FIFO and LIFO)

Transactions are sorted by date; on the same day, buys are processed before sales. Each buy creates a lot with quantity and total USD cost (fees included in the amount you enter). Each sale walks your open lots: FIFO consumes from the earliest lot until the sell quantity is filled; LIFO consumes from the latest lot. Cost assigned to the sale = sum of (lot cost × quantity taken ÷ lot quantity) for each slice. Proceeds for matched quantity = sale proceeds × (matched qty ÷ sale qty). Realized gain = matched proceeds − matched cost. Unmatched sale quantity (no inventory) is flagged with $0 basis. Remaining lots after all trades are your open inventory. Compare mode runs the full ledger twice and shows the difference in net realized gain.

FIFO vs LIFO worked examples

  1. Rising market — one partial BTC sale

    Buy 0.5 BTC for $20,000 on 15 Jan. Buy 0.5 BTC for $32,000 on 1 Jun. Sell 0.5 BTC for $35,000 on 10 Sep.

    FIFO matches the January lot: basis $20,000, gain $15,000. LIFO matches the June lot: basis $32,000, gain $3,000.

    Same trade, $12,000 difference in reported gain — method matters for tax planning when lots have different costs.

  2. ETH compare preset in the tool

    Two 10 ETH buys at $25,000 and $30,000 total; sell 10 ETH for $40,000.

    FIFO uses $25,000 basis (gain $15,000). LIFO uses $30,000 basis (gain $10,000).

    Load the “ETH FIFO vs LIFO” preset to see match lines and holding days.

  3. Multiple assets stay separate

    BTC buys and sells mixed with ETH buys — each ticker has its own lot pool.

    FIFO/LIFO never crosses assets. Each symbol has its own inventory stack.

    Enter the correct asset code on every row so matching stays accurate.

  4. Swaps and spending

    You swap USDC for SOL or pay a merchant in BTC.

    Treat the outgoing coin as a sale at fair market value and the incoming coin as a new buy. Enter both legs if you model a swap.

    This tool matches the disposal leg you enter; pair with a second buy row for the acquired coin.

Crypto cost basis FAQ

Should I use FIFO or LIFO for crypto?
It depends on your country and facts. The United States often defaults to FIFO unless you identify specific lots. Germany commonly references FIFO for private investors. The UK uses different share-pooling and matching rules, not plain FIFO/LIFO. Use Compare mode here, then confirm with local rules or a tax professional.
What is specific identification (HIFO)?
Some US taxpayers identify the exact lots sold (including highest-in-first-out strategies) when exchanges support it. This calculator focuses on FIFO and LIFO — the two most searched accounting methods — plus a direct comparison.
Does FIFO affect how long I held the asset?
Yes. Each matched slice shows acquire date and holding days. US long-term vs short-term treatment depends on those dates. Geo tax calculators on CoinToolHub use holding period where relevant.
What if I sell more than I bought in the table?
Unmatched quantity is reported with $0 cost basis in the results, which inflates gain. Add missing buys or fix quantities so inventory covers each sale.
Are fees included in cost basis?
Include purchase fees in the buy amount and net selling fees from the sell amount you enter. The tool uses your totals; it does not add a separate fee percent.
Can I use euros or pounds?
Amounts are labeled USD for consistency with our US-focused tools. You can enter any fiat as long as all rows use the same unit — results are only as accurate as your consistent valuation.
How is this different from the UK tax calculator?
Our UK calculator applies HMRC same-day, 30-day, and Section 104 pool rules. This page is for classic FIFO/LIFO lot stacks used in the US and taught globally for crypto accounting basics.
Is this tax advice?
No. It is educational matching math for record-keeping and planning. For filing estimates, use our country tax calculators and qualified advisers.

Related crypto tax tools

How it works

  • Choose FIFO, LIFO, or Compare to run both methods on the same ledger.
  • Add each buy and sell with asset, date, quantity, and total USD (fees in the amount).
  • Review matched lots, holding days, net realized gain, open inventory, and any FIFO vs LIFO difference.

For education only — not financial advice. Past performance does not guarantee future results.