Cost basis, lots and FIFO for crypto and shares
What cost basis, lots and FIFO mean for coins and shares, worked through one year of buys and a sale, with the three ways to count the gain side by side.
The Allmoni team ·
You bought some bitcoin in January, a little more in April and again in July. In October you sold part of it. What was your gain? It sounds like one subtraction, but it isn’t. The answer depends on which of your coins you say you sold, and the same sale can show a gain of €470 or of €1,970 depending on how you count.
This guide explains the three words behind that question (cost basis, lots and FIFO), then works through one made-up year of buys and a sale, counted three ways. It is not tax advice: which method you must use depends on where you pay tax, and we link the rules of two countries below so you can see how they differ.
What is cost basis?
Cost basis is what you paid to get a holding, in your own currency, fees included. If you paid €4,000 for 0.1 BTC and the exchange charged €10, your cost basis for that 0.1 BTC is €4,010.
When you sell, your gain is what you got for it (after the selling fee) minus the cost basis of what you sold. A gain you have locked in by selling is realised; a gain on what you still hold is unrealised, and moves with the price.
Two details trip people up:
- Fees count. A buying fee adds to your cost; a selling fee comes off what you got. Leaving them out makes every gain look bigger than it was.
- Your currency, on the day. If you bought shares in dollars and you count in euros, the cost basis is the dollars converted at that day’s rate, not today’s. A change in the dollar can make a gain or a loss on its own.
What is a lot?
A lot is one purchase: how much you bought, on which day, and what it cost. Three buys of bitcoin are three lots, even though the exchange shows you one balance. Each lot keeps its own date and its own cost per coin, and that is what makes the next question possible.
Which coins did you sell?
Coins and shares of the same kind are interchangeable, so when you sell part of a holding, you have to say which lots the sale came from. There are three common ways:
- FIFO, first in, first out: a sale takes your oldest lots first. It is the usual default, and the easiest to check.
- Specific identification: you pick the lots yourself, for example the ones that cost the most.
- Average cost: all your lots are pooled, and every coin costs the average of the pool.
None of these changes how much money you made in total. They change how much of it counts as gain in which year, and how long each sold coin counts as held.
One worked year
Here is one made-up year in euros. Prices are round to keep the sums easy to follow.
| Date | What happened | Money |
|---|---|---|
| 10 Jan | Buy 0.10 BTC (lot A) | €4,000 + €10 fee: cost €4,010 |
| 15 Apr | Buy 0.10 BTC (lot B) | €6,000 + €10 fee: cost €6,010 |
| 20 Jul | Buy 0.05 BTC (lot C) | €2,500 + €5 fee: cost €2,505 |
| 1 Oct | Sell 0.15 BTC | €9,000 − €15 fee: got €8,985 |
| 31 Dec | 0.10 BTC left at €70,000 | worth €7,000 |
In total you paid €12,525 for 0.25 BTC. At the end of the year you have €8,985 from the sale and 0.10 BTC worth €7,000: €15,985 in all, so you are €3,460 ahead. Every method below arrives at that same €3,460. They only split it differently.
FIFO: oldest lots first
The sale of 0.15 BTC takes all of lot A (0.10 BTC, €4,010) and half of lot B (0.05 BTC, €3,005).
- Cost of what you sold: €4,010 + €3,005 = €7,015
- Realised gain this year: €8,985 − €7,015 = €1,970
- What is left: half of lot B (€3,005) and all of lot C (€2,505), €5,510 in all
- Unrealised gain: €7,000 − €5,510 = €1,490
Specific identification: you choose the dearest lots
You say the sale came from lot B (0.10 BTC, €6,010) and lot C (0.05 BTC, €2,505).
- Cost of what you sold: €8,515
- Realised gain this year: €8,985 − €8,515 = €470
- What is left: lot A, 0.10 BTC that cost €4,010
- Unrealised gain: €7,000 − €4,010 = €2,990
Average cost: one pool
The pool holds 0.25 BTC for €12,525, so every coin costs €50,100 per BTC.
- Cost of what you sold: 0.15 × €50,100 = €7,515
- Realised gain this year: €8,985 − €7,515 = €1,470
- What is left: 0.10 BTC at €50,100, €5,010
- Unrealised gain: €7,000 − €5,010 = €1,990
Side by side
| Method | Realised this year | Unrealised at year end | Total |
|---|---|---|---|
| FIFO | €1,970 | €1,490 | €3,460 |
| Specific identification | €470 | €2,990 | €3,460 |
| Average cost | €1,470 | €1,990 | €3,460 |
The total never moves. What moves is the realised part, which is usually what a tax return asks about, and the dates of the coins you sold. Under FIFO the coins sold in October were bought in January and April; under specific identification they were bought in April and July. Where a long holding is taxed differently from a short one, that difference can matter as much as the amount.
Which method do you have to use?
That is for your country’s tax rules, and they differ. Two examples:
- United States: for crypto, the IRS lets you choose which units you sold if you can identify them, and otherwise treats them as sold in the order you got them, which is FIFO (IRS: Frequently asked questions on virtual currency transactions, questions 39 to 41). For shares you cannot identify, the shares sold are the ones you bought first (IRS Publication 550, “Identification not possible”).
- United Kingdom: HMRC pools tokens of the same kind in one “section 104 pool” at their average cost, with separate rules for coins bought on the same day as a sale or within the 30 days after it (HMRC Cryptoassets Manual: pooling). Shares in one company are counted at their average cost the same way (GOV.UK: Selling shares in the same company).
Other countries have their own rules, and some change them. Check your tax office’s own guidance, or ask an adviser, before you file. Whatever the rule, it can only be applied if you kept every lot: the date, the quantity and what you paid.
Keeping lots without a spreadsheet
You can keep lots in a spreadsheet: one row per buy, one per sale, and a formula that walks the oldest rows first. It works until the first transfer between two exchanges, a fee paid in a coin, or a buy in dollars when you count in euros. Then the formulas grow and the errors hide.
Allmoni keeps the lots for you, from the transactions it already has:
- Every buy is a lot with its date, quantity and cost in your base currency, fees included. A holding’s lots are listed oldest first, with what is left of each.
- Sales use FIFO within each pocket, so a sale on one exchange takes the oldest coins held there. For each year you see every sale, what it brought, what its lots cost and the gain or loss.
- Moving coins between your own pockets keeps each lot’s date and cost. A transfer from an exchange to your wallet is not a sale.
- What you held before you started comes in as a pocket’s balance, and a lot whose cost is unknown is left out of the gains until you add what you paid, rather than counted as free.
Allmoni counts by FIFO. It does not work out a pooled average cost, so if your country uses one, the lots Allmoni keeps are where that sum starts, not the sum itself.
Your lots come from the transactions you bring in, from statement files of exchanges and brokers such as Binance and Interactive Brokers. Live connections to exchanges and brokers are coming. Coming
What you hold is valued with prices from CoinGecko for coins, every hour, and with each night’s close for shares and funds listed in the US. The gain beside it compares that value with what you paid.
A short checklist
- Keep every buy as a lot: date, quantity, price, fee.
- Count cost in your own currency at the rate of the day you bought.
- Add the buying fee to the cost; take the selling fee off what you got.
- Know which method your country uses before the year ends, not when you file.
- Treat moves between your own accounts as moves, not sales.
- For holdings from before your records start, find the old statements once and write the lots down.
Questions
Is FIFO or average cost better?
Neither makes you more money in total. FIFO often shows a bigger gain sooner when prices have risen, because the oldest coins were the cheapest; average cost spreads the gain across sales. The method you may use is set by your tax rules, not by which one gives the smaller number.
Does moving crypto to my own wallet count as selling it?
Moving coins between accounts you own changes where they are, not who owns them, so in most places it is not a sale. Keep each lot’s date and cost when it moves, so that a later sale from the wallet finds them.
What if I don’t know what I paid?
Look for the old statement or the exchange’s history export first. If there is nothing, don’t count the coins as free: a cost of zero makes the whole sale a gain. Mark the cost as unknown, and keep it out of your gains until you find it.
Do stablecoins have a cost basis?
Yes. A stablecoin is a holding like any other, and its price moves a little against your own currency. Buying USDT with euros and selling it back later can make a small gain or loss, as the sales in the picture above show.
Allmoni is open to everyone, and every account starts on the free plan. Net worth across cash, shares and crypto shows what it does today, investments included.
See where it all is
Every account, card, wallet and cash pile, in every currency, in one place.
Open the web app