How to Calculate Crypto Gains: FIFO, Specific ID and ACB

A photo of Chris Herbst, Managing Director at global crypto tax reporting firm, CountDeFi & CH Consulting. CBAP (CIBA), GTP (SAIT).
By Chris Herbst
Managing Director at global crypto tax reporting firm, CountDeFi & CH Consulting
CBAP (CIBA), GTP (SAIT)
Category
Published On
Updated On
Update Due
IRS Crypto Tax
September 26, 2026
September 26, 2026
July 23, 2027
Proceeds minus cost is the easy part. Which purchase a sale is matched against decides the gain, and the US, Canada and the UK each set a different rule. Here is how each one works, with the same trades run through all of them.

Short answer: a realised crypto gain is what you received on a disposal minus the cost of the units disposed of. Your country decides which units count. The US uses units you specifically identify, otherwise first in, first out, per wallet. Canada uses average cost. The UK matches same-day, then 30-day, then the Section 104 pool.

The arithmetic of a crypto gain is simple: proceeds minus cost. The hard part is the cost. When you have bought the same coin several times at different prices, the gain on a sale depends on which of those purchases the sale is matched against, and that matching is not a free choice. The United States, Canada and the United Kingdom each set their own rule, and the same set of trades produces three different gains under them.

This guide works through each system with the tax authority's own guidance: US first in, first out (FIFO) and specific identification, Canada's adjusted cost base (ACB), and the UK's same-day, 30-day and Section 104 pooling rules. It then runs one set of trades through every method so you can see the difference, and ends with the places these calculations usually break. I am Chris Herbst, founder of CountDeFi. We are crypto tax accountants: we reconcile clients' full crypto histories and produce the reports their own accountant or CPA files from.

What Is a Realised Crypto Gain?

A gain is realised when you dispose of crypto. Until then, a rise in price is an unrealised gain and nothing is reported. Each of the three tax authorities treats crypto as property for this purpose, so the calculation follows the ordinary rules for property, with a few crypto-specific points.

What counts as a disposal of crypto?

Selling for dollars or pounds is the obvious case, but it is not the only one. The IRS lists disposals of digital assets for another digital asset, for currency, and in exchange for property, goods or services. Paying someone in crypto is a disposal too: the IRS says that if you pay for a service using virtual currency you hold as a capital asset, you have exchanged a capital asset for that service and will have a capital gain or loss. Canada and the UK take the same broad view: a crypto-to-crypto trade is a disposal of the coin you gave up.

What is cost basis, and what goes into it?

Cost basis (called adjusted cost base in Canada and allowable cost in the UK) is what the units cost you. In the US, your basis is the amount you spent to acquire the virtual currency, including fees, commissions and other acquisition costs in U.S. dollars. In Canada, the CRA describes the adjusted cost base as usually the cost of a crypto-asset, plus expenses to acquire it. For coins you received rather than bought, such as staking rewards, the value you reported as income at receipt generally becomes the cost.

Why does it matter which units a sale uses?

Because the same coin bought at different prices carries different costs. Sell one bitcoin out of two you bought at very different prices and the gain can differ by tens of thousands, depending on which purchase the sale is matched to. In the US it can also change whether the gain is short-term or long-term, because each lot has its own holding period. The matching rule is therefore the core of the calculation, not a detail.

What is the basic formula?

Gain equals proceeds of disposal minus the cost of the units disposed of, minus the costs of selling. The IRS puts it as the difference between your adjusted basis in the virtual currency and the amount you received in exchange. Everything that follows in this guide is about the middle term: the cost of the units disposed of.

How to Calculate Crypto Gains in the US: FIFO and Specific Identification

The US gives you a choice, within limits. You may pick the units you sell if you can identify them, and if you do not, the law picks for you. Since January 1, 2025, that choice also operates wallet by wallet.

What is the default method if I do not choose?

FIFO. The IRS says that if you do not identify specific units, the units are deemed to have been sold, exchanged, or otherwise disposed of in chronological order beginning with the earliest unit you acquired. In a rising market FIFO usually matches your sale against your cheapest, oldest coins, which gives a larger gain, though those oldest coins are also the most likely to qualify as long-term.

How does specific identification work for crypto?

You may choose which units are sold if you can specifically identify which unit or units of virtual currency are involved in the transaction and substantiate your basis in those units. The IRS says your records must show the date and time each unit was acquired, your basis and the fair market value at acquisition, the date and time each unit was disposed of, and the fair market value and amount received at disposal. The identification has to be made in time: in the regulation's own example, a note in the taxpayer's records on the date of sale, prior to the time of the sale is a valid specific identification, and the same sale without that note falls back to FIFO.

Is HIFO allowed for crypto in the US?

Highest in, first out is not a separate method in the IRS rules. It is a way of using specific identification: you identify the highest-cost units in the wallet as the ones sold. It is allowed on the same terms as any specific identification, so it only works if the identification is made at or before the sale and your records support it. Software that applies HIFO after the year has ended, with nothing recorded at the time of each sale, does not meet that standard on its own.

What changed on January 1, 2025?

Before 2025 many people pooled all their units of a coin across every wallet and exchange and picked from that one pool, an approach Rev. Proc. 2024-28 calls the universal or multi-wallet approach. The final regulations instead apply specific identification and FIFO to units held within a single wallet or account, and those rules apply to all acquisitions and dispositions of digital assets on or after January 1, 2025. A sale from your Coinbase account can now only be matched against units held in that account. Our guide to tracking cost basis across wallets and custodians covers the transition in detail.

What was the Rev. Proc. 2024-28 safe harbor?

It let taxpayers rely on any reasonable allocation of units of unused basis to a wallet or account holding the same number of units, based on their records, with the allocation made as of January 1, 2025. In practice it was the bridge from one pooled basis to separate wallet-level lots. If you never made an allocation, your wallet-level basis has to be rebuilt from the history of what moved into each wallet.

How do I identify units held on an exchange?

For units held with a broker, the identification is made to the broker. Rev. Proc. 2024-28 refers to a standing order or instruction communicated to the taxpayer's broker, and the regulation's broker example turns on the broker's own policy for identifying units. If you want an exchange to sell particular lots, check what identification the platform accepts and set it before you trade. Otherwise its default, usually FIFO within the account, is what applies.

Is my gain short-term or long-term?

That depends on the lot the sale is matched to. Generally, if you hold the asset for more than one year before you dispose of it, your capital gain or loss is long-term, and one year or less is short-term. Because each lot keeps its own acquisition date, the matching method decides the holding period as well as the gain. The disposals are then reported on Form 8949 and summarised on Schedule D; see our guide to Form 8949 and Schedule D for crypto.

How to Calculate Crypto Gains in Canada: Adjusted Cost Base

Canada does not ask you which coin you sold. It averages. Every purchase of the same crypto-asset is folded into one running average cost, and each disposal takes its share of that average.

How is ACB calculated for crypto?

The CRA describes the adjusted cost base of a crypto-asset as usually the weighted average cost of a crypto-asset. Its capital gains guide explains the mechanics for identical properties bought at different prices: you have to calculate the average cost of each property in the group at the time of each purchase to determine your ACB. The average is the total cost of the units, including acquisition expenses, divided by the number of units held. A purchase changes the average; a sale does not, because the guide notes that dispositions of identical properties do not affect the ACB.

Does Canada allow FIFO or specific identification for crypto?

No. For identical properties the average cost is the rule, so there is no lot to pick and no FIFO ordering. This is the main reason a US-style report cannot simply be reused for a Canadian return: the same trades give a different gain. Software set to FIFO for a Canadian taxpayer produces the wrong figure however clean the data is.

How much of a crypto capital gain is taxable in Canada?

If the disposal is on account of capital, the CRA says you must include half of your capital gains (known as taxable capital gains) in your income for the year. Capital losses work the same way in reverse: you may deduct half of them, but only against your taxable capital gain. If your activity amounts to a business, the profit is fully taxable instead. Our guide to crypto taxes in Canada covers that distinction and holding companies.

How are selling costs handled in Canada?

They reduce the gain. The CRA's test for a capital gain is whether the proceeds are more than your adjusted cost base and the outlays and expenses incurred to make the disposition. Trading fees on the way in go into the ACB; fees on the way out are deducted from the proceeds side.

How to Calculate Crypto Gains in the UK: Same-Day, 30-Day and Section 104

The UK uses a pool, like Canada, but first matches disposals against acquisitions made on the same day and in the following 30 days. Only what is left over touches the pool.

What is a Section 104 pool for crypto?

HMRC's Cryptoassets Manual says tokens dealt in without identifying particular units should be pooled, which is commonly referred to as a 'section 104 pool'. Each type of token will need its own pool: bitcoin, ether and litecoin make three pools, each with its own pooled allowable cost. Individuals must still keep a record of the amount spent on each type of token as well as the pool's cost.

How does the same-day rule work?

When you buy and sell the same token on the same day, all the tokens acquired shall be treated as acquired in a single transaction and all disposals as a single disposal, and the two are matched first. HMRC's example has Martyn selling 1,000 tokens in the morning, buying 1,600 in the afternoon and selling 500 in the evening: the two sales become a single disposal of 1,500 token B matched against the afternoon purchase, and the 100 unmatched tokens go into the pool.

How does the 30-day rule work?

If you dispose of tokens and buy the same type again within the next 30 days, the new tokens do not go into the pool; they are matched to the earlier disposal, earliest disposal first. The rule stops a sale and quick repurchase from crystallising a loss against the pool cost. HMRC's example shows purchases in late April and early May matched back to sales on 31 March and 20 April, with the remaining 200 token C going into the pool.

How is a gain calculated from the pool?

A disposal from the pool takes the same fraction of the pool cost as the fraction of tokens sold. In HMRC's example, Victoria holds 150 tokens with a pooled cost of 126,000 pounds and sells 50 for 300,000 pounds. Her allowable cost is £126,000 x (50 / 150), or 42,000 pounds, and Victoria will have a gain of £258,000. The pool then holds 100 tokens at 84,000 pounds.

Are NFTs pooled in the UK?

No. HMRC says NFTs are separately identifiable and so are not pooled, and no matching rules apply to them. Each NFT is its own asset with its own cost. For how the pool behaves when you move coins between platforms, see our piece on Section 104 pools and platform transfers, and for where the result goes, our SA108 box-by-box guide.

One Set of Trades Under Each Method

The clearest way to see the difference is to run the same trades through every method. The figures below are an illustration, not real prices, and they use one currency for all columns so the methods can be compared. All units are held in one wallet, and there are no other purchases within 30 days of the sale, so the UK same-day and 30-day rules do not apply.

Trades: bought 1 coin for 20,000 in January 2023; bought 1 coin for 60,000 in March 2024; sold 1 coin for 70,000 in June 2025.

MethodCost matched to the saleGainCost carried on the remaining coin
US FIFO (default)20,000 (January 2023 coin)50,00060,000
US specific identification of the higher-cost coin60,000 (March 2024 coin)10,00020,000
Canada ACB (average cost)40,000 (80,000 / 2)30,00040,000
UK Section 104 pool40,000 (80,000 x 1/2)30,00040,000

Why do the results differ so much?

Because each method assigns a different cost to the coin sold. The total gain over the life of both coins is the same once both are sold; what changes is the year in which it is recognised. Under US specific identification the lower gain now leaves a lower cost on the remaining coin, so more gain is recognised when that coin is sold later. In this example both US lots were held for more than one year at the sale, so the gain is long-term under either US method.

Why do the Canadian and UK figures match here?

With a single wallet, two purchases and no same-day or 30-day activity, averaging and pooling give the same cost. They diverge as soon as the UK matching rules bite: a repurchase within 30 days would be matched to the sale in the UK, while Canada would still use the average. Canada has its own rule for sales at a loss followed by a repurchase, the superficial loss rule, which works differently again.

Which method gives the lowest gain?

Only the US offers a choice, and only through specific identification made at the time of each sale. In Canada and the UK the method is set by law and cannot be chosen for a better result. In the US, the lowest current gain is not always the best outcome: matching against recent, high-cost lots can turn a long-term gain into a short-term one.

Fees, Transfers and Crypto-to-Crypto Trades

Most errors in a crypto gains calculation do not come from the method. They come from what feeds it: fees counted twice or not at all, transfers treated as sales, and swaps recorded on one side only.

Do transfers between my own wallets create a gain?

No. Moving coins between your own wallets is not a disposal. The IRS lists among the things that do not require a Yes on the digital asset question that you transferred digital assets from one wallet or account you own or control to another wallet or account you own or control, though a network fee paid in crypto is itself a digital asset transaction. In the UK the pool belongs to the person, not the platform: the beneficial owner of the tokens will have a single pooled asset. In the US since 2025 the transferred units carry their own basis and acquisition date into the receiving wallet, which is why a transfer that is not matched to its deposit breaks the lot history.

How is a crypto-to-crypto trade calculated?

As a disposal of the coin you gave up, at its fair market value at the time of the trade, and an acquisition of the new coin at that value. In the CRA's worked example, units bought for $15,000 are traded when worth $20,600, giving a $5,600 capital gain. The new coin's cost is that value, and it enters its own lot, average or pool.

How should fees be treated?

Buying fees add to cost in all three systems, and selling fees reduce the gain. A fee paid in crypto is a small disposal of that crypto in the US, which is why the IRS singles out paying a transfer fee with digital assets as a digital asset transaction. At volume these small disposals add up to many rows, and each one draws on the same lots or pool as a normal sale.

Choosing and Documenting Your Method

If you file in Canada or the UK, the method is chosen for you and the work is in applying it correctly. If you file in the US, the choice is real but has to be made properly and on time.

Can I switch between FIFO and specific identification?

In the US, specific identification is made sale by sale, so you are not locked into one method for life. What you cannot do is identify after the fact: the regulation's example treats a sale with no record made at or before the time of sale as a FIFO sale. For units at a broker, what counts is the identification the broker accepts, such as a standing instruction. Changing the method in your software at year end does not change what was identified at the time.

What records do I need to support my method?

For specific identification in the US, the IRS lists four things your records must show: acquisition date and time, basis and value at acquisition, disposal date and time, and value and amount received at disposal. In the UK, HMRC says individuals must still keep a record of the amount spent on each type of token as well as each pool's cost. In every system, keep the exchange exports, wallet addresses and the calculation itself.

Does crypto tax software pick the method for me?

It applies whatever method it is set to, across whatever data it was given. The setting has to match the jurisdiction and, for US years from 2025, the software has to track basis per wallet. The bigger risk is the data: software cannot match a transfer to a wallet it has never seen. Our article on reconciling crypto cost basis across exchanges shows where that goes wrong.

Where Crypto Gain Calculations Go Wrong

These are the failures we see most often when a client's existing report is rebuilt. None of them is a formula error.

What happens when cost basis is missing?

A sale with no purchase record behind it is calculated against a cost of zero, so the whole proceeds become gain. This usually means a source is missing: an old exchange, a wallet that was never imported, or a transfer in from somewhere unrecorded. The fix is to find the source, not to guess a cost. Our guide to missing cost basis in crypto covers how to rebuild it.

Why do unmatched transfers inflate gains?

A withdrawal that is not matched to its deposit looks like a sale at one end and a zero-cost purchase at the other. Under FIFO or per-wallet rules the zero-cost units then feed later sales in the receiving wallet. Under Canadian averaging or UK pooling they drag the whole average or pool cost down. Either way the gain is overstated on later sales, sometimes for years.

Why does the wrong method setting matter?

A Canadian or UK return calculated with FIFO, or a US return calculated with a single universal pool after 2025, produces a figure that the rules do not support. The difference is often large because it compounds across every later sale of the same asset.

Where does the calculated gain go on the return?

In the US, disposals go on Form 8949 and the totals on Schedule D. In Canada, capital gains are reported on Schedule 3. In the UK, gains go on the capital gains pages of the Self Assessment return. Each of these takes the output of the method above; none of them does the calculation for you.

Frequently Asked Questions

Can I switch crypto cost basis methods?

In the US, yes, sale by sale, because specific identification is made at each disposal and FIFO applies where you did not identify. In Canada and the UK the method is set by law and cannot be switched.

Is HIFO allowed for crypto in the US?

Yes, as a form of specific identification. The highest-cost units must be identified at or before each sale, and your records must support the basis of those units.

Does Canada allow FIFO for crypto?

No. Identical properties use the average cost, and the CRA describes the adjusted cost base of a crypto-asset as usually its weighted average cost.

How do UK Section 104 pools treat transfers between my own wallets?

A transfer between wallets you own is not a disposal. HMRC treats the owner as having a single pool per token type, so the pool does not change when coins move between your platforms.

What if the cost of some crypto is missing?

Look for the missing source first: an old exchange account, an unimported wallet or an unmatched transfer. A sale with no documented cost is calculated as if the cost were zero.

Does crypto tax software choose the method for me?

It applies the method it is set to. You or your accountant must set the one your country requires and make sure every wallet and exchange is in the data.

If your history spans several wallets or exchanges and the gains figure does not look right, our crypto tax accounting service reconciles the full history and calculates it under your country's rules. We are crypto tax accountants, not a CPA firm: we hand the finished reports to you or your own accountant or CPA, who files.

‍
Chris Herbst is the founder of CountDeFi, a crypto tax specialist whose qualifications span investment management, financial analysis, mathematical statistics and computer science. He holds the Chartered Business Accountant in Practice (CBAP) designation with the Chartered Institute for Business Accountants (CIBA) and the General Tax Practitioner (GTP) designation with the South African Institute of Taxation (SAIT). His combined background in investments, accounting and tax, mathematical statistics and computer science underpins his work in complex crypto tax reporting. This article is for educational purposes only and does not constitute tax, legal or investment advice. Consult a qualified tax professional for guidance specific to your situation. View our Editorial Policy.

Let's get your crypto taxes done.

Book a free, no-obligation exploratory call with us.