Tracking a stock portfolio against a live market chart
PORTFOLIOTRACKR
Tax & Reporting

FIFO vs LIFO: Which Cost Basis Cuts Your Capital Gains Tax

By Daniel Hartley · August 6, 2026 · 9 min read

Your cost basis method decides how much capital gains tax you owe, and picking FIFO versus LIFO can shift your bill by hundreds or thousands of dollars on the same trades. This guide explains how each method works, which one your country actually allows (UK, US, Canada, and UAE), and how to generate tax-ready CSV exports straight from your portfolio.

What is cost basis and why does it decide your tax bill?

Cost basis is the original price you paid for an asset, including fees, and it determines your capital gain when you sell. Your gain equals the sale price minus your cost basis, so a higher basis means a smaller taxable gain.

The catch is that most investors buy the same asset multiple times at different prices. When you sell part of your position, tax rules need to decide which shares you sold, and that choice is your cost basis method.

The three common methods are:

PortfolioTrackr calculates all three automatically per lot, so you can see the tax impact before you file rather than after.

FIFO vs LIFO: which method cuts your capital gains tax?

In a rising market, FIFO usually produces a larger taxable gain and LIFO usually produces a smaller one. That is because your oldest shares typically have the lowest cost basis, so selling them first (FIFO) locks in the biggest gain.

A worked example with AAPL

Say you bought Apple (AAPL) in three lots and now sell 100 shares at $230:

Under FIFO, you sell Lot 1 and report a gain of $8,000 ($230 minus $150, times 100). Under LIFO, you sell Lot 3 and report just $1,000 ($230 minus $220, times 100). Same trade, an $7,000 difference in taxable gain.

But LIFO is not always the winner

LIFO can backfire on long-term holding periods. In the US, assets held over one year qualify for lower long-term capital gains rates, and your newest shares (LIFO) may still be short-term, taxed as ordinary income up to 37%.

Selling your oldest shares under FIFO can qualify those gains for the long-term rate of 0%, 15%, or 20%, which often beats the higher short-term rate on a smaller LIFO gain. Run both numbers before deciding.

Which cost basis methods does each country allow?

Your country decides which methods are legal, and most do not offer a free choice. The UK forces a pooled average, Canada forces average cost, and the US allows specific identification, which is the most flexible of all.

CountryRequired methodLong-term relief?CGT rate range
United StatesFIFO default, LIFO or specific ID allowedYes, over 12 months0 to 20% long-term
United KingdomSection 104 pool (average)No holding-period tiers18% or 24%
CanadaAdjusted cost base (average)No, but 50% inclusion~Half of marginal rate
UAENone neededN/A0% (no CGT)

United States: the most flexible rules

The US lets you choose FIFO, LIFO, or specific identification, but you must elect specific ID at the time of sale. FIFO is the default your broker uses if you say nothing. US stocks settle T+1 since May 2024, and your 1099-B reports the method your broker applied.

United Kingdom: the Section 104 pool

The UK does not allow FIFO or LIFO for most shares; you must use a Section 104 pool that averages your cost basis. The same-day rule and 30-day bed-and-breakfasting rule apply first, then everything else pools together. The annual CGT exemption dropped to just 3,000 pounds for 2024/25.

Canada: adjusted cost base

Canada requires the adjusted cost base (ACB), a weighted average across all identical shares. You cannot cherry-pick FIFO or LIFO. Only 50% of your capital gain is taxable at your marginal rate, which effectively halves the sting.

UAE: no capital gains tax at all

The UAE charges no personal capital gains tax, so FIFO versus LIFO is irrelevant for residents trading stocks or crypto. Gains on Abu Dhabi Securities Exchange (ADX) and Dubai Financial Market (DFM) listings like EMAAR.AE are tax-free for individuals. You still benefit from tracking cost basis for performance, just not for a tax return.

How do you calculate weighted average cost basis?

Weighted average cost basis divides your total money invested by your total number of shares. This is the method the UK and Canada mandate, and it is the simplest to compute by hand.

Using the AAPL example above, your total cost is $15,000 plus $19,000 plus $22,000, which is $56,000 across 300 shares. Your weighted average cost basis is $186.67 per share.

Selling 100 shares at $230 under average cost gives a gain of $4,333, which sits neatly between the FIFO and LIFO figures. PortfolioTrackr recalculates this instantly every time you add a buy, a sell, a dividend reinvestment, or a stock split.

How do you generate a tax-ready CSV export from a portfolio tracker?

A tax-ready CSV export lists every disposal with its date, proceeds, cost basis, and calculated gain or loss in the exact format your tax software or accountant needs. Doing this by hand across multiple brokers is where errors and missed lots creep in.

A clean capital gains export should include these columns:

  1. Asset and ticker (for example AAPL or BTC-USD)
  2. Acquisition date and disposal date
  3. Quantity sold
  4. Cost basis under your chosen method
  5. Proceeds after fees
  6. Realized gain or loss and holding period

If you hold assets at Interactive Brokers, Charles Schwab, Alpaca, and Binance at once, each platform reports differently. A tracker consolidates them into one file, which is exactly why many investors prefer a portfolio tracker over a manual spreadsheet at tax time.

Matching the export to your jurisdiction

Choose the method your country requires before you export, not after. A UK investor should export using pooled average cost, while a US investor can toggle between FIFO and specific ID to compare outcomes. PortfolioTrackr lets you switch methods and regenerate the CSV in seconds, and our full walkthrough on generating a capital gains tax report covers the export step in detail.

Does cost basis method matter for crypto too?

Yes, crypto uses the same cost basis rules as stocks in the US, UK, and Canada, though tracking is harder because of transfers between wallets. A single BTC-USD position bought across dozens of small purchases can create hundreds of tax lots.

Crypto tax reporting gets complicated because of:

If you hold both asset classes, reading how to track crypto and stocks in one portfolio will save you from reconciling two separate systems. Upcoming rules under the CLARITY Act and 2026 crypto tax reporting changes will also tighten what exchanges must report.

The bottom line

FIFO usually raises your taxable gain in a rising market, LIFO usually lowers it, but your country often removes the choice entirely. US investors have the most flexibility, while UK and Canadian investors are locked into averaging methods.

Before you sell, run all three calculations, factor in holding-period rates, and export a clean CSV matched to your jurisdiction. PortfolioTrackr does the math per lot across every broker so your tax report is accurate the first time.

Capital gains, worked out for you

Realised and unrealised gains with a country tax lens for 10 countries, exportable to CSV or PDF when your accountant asks.

See My Tax Position
Download on the App Store Get it on Google Play
See the live demo first →

Frequently asked questions

Is FIFO or LIFO better for capital gains tax?

FIFO usually produces a larger taxable gain in a rising market because it sells your oldest, lowest-cost shares first, while LIFO produces a smaller gain by selling newer shares. However, FIFO may qualify for lower long-term rates, so LIFO is not always cheaper overall. Run both figures before deciding.

Can I choose FIFO or LIFO in the UK?

No, the UK does not allow FIFO or LIFO for most shares. You must use the Section 104 pool, which averages your cost basis across identical holdings after applying the same-day and 30-day rules. The 2024/25 annual CGT exemption is 3,000 pounds.

Does the UAE charge capital gains tax on stocks or crypto?

No, the UAE charges no personal capital gains tax on stocks or crypto for individual residents. Gains on ADX and DFM listings like EMAAR.AE, plus international shares and crypto, are tax-free. You still track cost basis for performance, but not for a tax return.

How does a portfolio tracker generate a tax-ready CSV?

PortfolioTrackr consolidates every buy and sell across your brokers, applies your chosen cost basis method, and exports a CSV with acquisition date, disposal date, cost basis, proceeds, and realized gain. You can switch between FIFO, LIFO, and average cost, then regenerate the file to match your country's rules.

What cost basis method does Canada require?

Canada requires the adjusted cost base (ACB), a weighted average across all identical shares. You cannot use FIFO or LIFO. Only 50% of your capital gain is taxable at your marginal rate, which effectively halves the tax on your profits.

Daniel Hartley
Daniel Hartley writes about the fundamentals of portfolio tracking at PortfolioTrackr: profit and loss, position sizing, and turning a messy multi-broker setup into one clear picture for everyday investors.