We use cookies

We use essential cookies to run the site, and optional cookies for analytics. We never sell your data. Cookie Policy · Privacy Policy

Crypto cost basis: how to calculate it with FIFO, LIFO and HIFO

Crypto cost basis explained. Cost basis is what you paid for a crypto asset — including fees — and it decides how big your gain or loss is when you sell. Getting it right is the single most important part of an accurate crypto tax report. This guide covers the mechanics, a worked example, the records you need, and how CryptaTax handles it automatically.

Start your crypto tax report

General information, not tax advice. Crypto tax rules differ by country and change over time — verify against your country's guidance or a qualified advisor.

Crypto cost basis: how to calculate it with FIFO, LIFO and HIFO

What “cost basis” means

Your cost basis in a coin is what it cost you to acquire it: the purchase price plus any fees. When you later sell, swap or spend that coin, your capital gain or loss is the difference between what you receive and that basis. So a low basis means a bigger taxable gain, and a high basis means a smaller one. Every disposal in your report leans on this number, which is why a wrong basis quietly corrupts everything downstream.

Basis also applies to coins you did not buy. If you received crypto as income — from staking, mining, a salary or an airdrop — your basis is usually its fair market value when you received it, the same value you reported as income. That prevents you from being taxed twice on the same amount.

Why the accounting method matters

If you bought the same coin several times at different prices, which purchase are you selling when you sell some? You cannot tell the individual satoshis apart, so tax rules use an accounting method to decide. The method you use changes which basis is matched to each sale, and therefore the size of your gain — sometimes dramatically.

FIFO — first in, first out

FIFO assumes the first coins you bought are the first ones you sell. It is the most common default and is accepted in most countries. In a rising market it tends to produce larger gains, because the oldest (cheapest) coins are sold first.

LIFO — last in, first out

LIFO assumes the most recently bought coins are sold first. Where it is allowed, it can reduce a gain in a rising market by matching sales against higher, more recent bases — but it is not permitted everywhere.

HIFO — highest in, first out

HIFO sells the highest-cost coins first, which minimises the gain on each sale. It can be powerful for managing a tax bill but demands rigorous records, and not every jurisdiction accepts it. Always confirm which methods your country allows before relying on one.

A worked example

Suppose you buy 1 coin for 100, then later another for 300, and afterwards sell 1 coin for 400. Under FIFO you sell the first coin (basis 100) for a gain of 300. Under HIFO you sell the second coin (basis 300) for a gain of 100. Same sale, same money received — very different taxable gain, purely because of the method. The figures here are illustrative, not tax advice.

Records you need to keep

  • the date and value of every acquisition, including income receipts;
  • the fees paid on each buy, sell and transfer;
  • transfers between your own wallets, so basis follows the coins;
  • the method you chose, applied consistently across the year.

Specific identification

Some jurisdictions let you use specific identification: instead of a formula, you nominate exactly which units you are selling, provided you can document them. Done well, this gives the most control over your gain — you might choose to sell the highest-basis lots to minimise a gain, or specific lots to manage holding periods. The catch is the evidence burden: you must be able to show, per disposal, which acquisition it came from. Software that keeps a per-lot ledger makes this practical; a spreadsheet rarely does.

Average cost and pooling

Other systems require averaging. The UK, for instance, uses a pooled “section 104” approach where units of the same token share a single averaged basis, with special rules for coins bought close to a sale. An average-cost method smooths out the buy-price differences and removes the choice of which lot to sell, which is simpler but gives you less room to optimise. Which model applies is not yours to pick — it is set by your country, so the first question is always what your jurisdiction mandates.

Wallet-by-wallet vs universal tracking

A subtle but important question is whether basis is tracked per wallet or across your whole portfolio. Under universal tracking, a coin's basis is the same wherever it sits; under wallet-by-wallet, each wallet keeps its own pool, which can change which basis is matched to a sale and even whether a transfer needs careful handling. Some jurisdictions have moved toward requiring per-wallet tracking, so this is worth checking for your country and tax year — getting it wrong can quietly shift your gains.

How fees affect your basis

Fees are part of the picture, not a rounding error. The fee you pay to acquire a coin generally adds to its cost basis, raising it and shrinking a future gain; the fee to dispose of it generally reduces your proceeds, with the same effect. Network (gas) fees on transfers can be trickier and are treated differently across countries. Over hundreds of transactions, fees handled correctly can meaningfully reduce your taxable gain — and ignored, they inflate it.

Gifts, inherited crypto and airdrops

Not every coin has a purchase price. If you were gifted crypto, your basis often carries over from the giver or is set at the value when you received it, depending on the country. Inherited crypto frequently takes its value at the date of inheritance. Coins received from an airdrop or as income usually take their fair-market value on receipt as basis. The common thread is that basis still exists — it just is not a number you paid, so it has to be recorded deliberately or a later sale will look like pure profit.

How jurisdiction changes the answer

Allowed methods, fee treatment and whether you must track each wallet separately all vary by country. Some require a single pooled average; others let you choose. Check your country's rules — start with our country guides, for example US crypto tax →, UK crypto tax → or Germany crypto tax →.

Why basis errors compound

Cost basis is the number everything else leans on, so a small mistake here is unusually expensive. If an early purchase carries the wrong basis, every later disposal that draws on it inherits the error, and the gap widens with each trade. Unlike a single missed transaction you can slot in later, a broken basis chain quietly distorts a whole year — sometimes several. That is why rebuilding basis accurately from your complete history, rather than estimating, is the foundation of a report you can defend if it is ever questioned.

Spreadsheets vs software for cost basis

For a few trades on one exchange, a spreadsheet can track basis. Add a second exchange, a wallet, transfers between them, fees and a few hundred transactions, and manual tracking breaks down — with errors that stay invisible until they compound. Dedicated software keeps a per-lot ledger, applies one method consistently, carries basis across transfers, and re-runs the whole calculation deterministically. For most active investors that is the line between a number they can stand behind and one they merely hope is close.

How cost basis links to the rest of your taxes

Because basis underpins every disposal, it ties into the rest of your tax picture: it sets the gain you bank in tax-loss harvesting, it interacts with wash sale timing when you rebuy, and it drives the income-then-gain treatment of staking and rewards. Get basis right once, applied consistently, and the rest of your report falls into place.

Keeping records that hold up

Whatever the topic, the difference between a clean return and a stressful one is records. Tax authorities expect you to be able to show how you arrived at a number, and crypto's volume makes that hard by hand. Keep, at minimum:

  • the date, amount and value of every acquisition and disposal, in your home currency;
  • the fees on each trade, transfer and on-chain transaction;
  • transfers between your own wallets and exchanges, so cost basis follows the coins;
  • the cost-basis method you used, applied consistently through the year;
  • income receipts — staking, mining, airdrops — valued on the day you received them.

Good records are not just defensive. They are what lets you claim every loss and allowance you are entitled to, instead of rounding up out of caution because the paper trail is missing.

How your country changes the answer

Crypto tax is not one global rulebook. Tax rates, allowances, holding-period rules, which events are taxable and which methods are allowed all vary by country — and they change. The general principles on this page hold widely, but the specific numbers and edge cases are jurisdiction-dependent, so always check your own country's current guidance. Our country guides are a practical starting point: crypto tax by country →, including the US, the UK and Germany.

Common mistakes to avoid

  • Treating self-transfers as sales — moving your own coins is not a disposal; matching the two legs is essential.
  • Forgetting income events — staking, rewards and airdrops are usually taxable on receipt, not only when sold.
  • Using a partial history — cost basis depends on your full record, not just the current year.
  • Ignoring fees — they change your gain and are easy to leave out.
  • Waiting until the deadline — reconciling a year of activity under pressure is where errors happen.

When and how you report it

Most countries fold crypto into your normal annual tax return rather than a separate crypto form, usually under capital gains for disposals and ordinary income for receipts like staking or mining. You typically report the totals for the tax year — proceeds, cost basis and the resulting gain or loss — and keep the transaction-level detail in case you are asked for it. The exact boxes, schedules and deadlines depend on where you live, and a few jurisdictions expect more granular per-disposal reporting. The practical takeaway is the same everywhere: the figures you file are only as good as the reconciled records behind them, so the work is in getting the numbers right, not in the form itself.

Putting it together

The recurring theme across every part of this topic is the same: the tax outcome follows the facts, and the facts live in your transaction history. Get the underlying record right — every acquisition, disposal, fee, transfer and income receipt, valued correctly and tracked consistently — and the reporting is almost mechanical. Get it wrong, and no amount of clever treatment at the end can rescue the numbers. The reason crypto tax feels hard is rarely the rules themselves; it is the volume and the reconciliation. That is precisely the part worth automating, so your attention goes to the decisions that actually need judgement rather than to stitching exports together by hand. Treat the guidance here as the general shape of the topic, confirm the specifics for your own country and tax year, and lean on accurate records for everything else — that combination is what turns a stressful filing season into a routine one.

How CryptaTax automates this

CryptaTax imports your activity from every wallet and exchange, applies your cost-basis method consistently, and produces a capital-gains and income report with each figure traceable to its source. The concepts on this page are handled for you, so you spend your time deciding rather than reconciling spreadsheets. Try the crypto tax calculator →

Start your crypto tax report

FAQ

What is cost basis in crypto?

It is what you paid to acquire a coin, including fees. Your capital gain or loss when you sell is the difference between the proceeds and this basis.

Which cost-basis method should I use?

Use a method your country allows, applied consistently. FIFO is the most widely accepted default; LIFO and HIFO can lower gains where permitted but need stricter records.

What is my basis for crypto I received as income?

Usually its fair market value when you received it — the same amount you reported as income — so you are not taxed twice on it.

Can I change cost-basis method each year?

Rules vary by country; some lock you into a method or require consistency. Check your local guidance before switching.

Related guides

Country-specific rules