1. Home
  2. UK tax report
  3. Capital gains tax calculator for shares

Capital Gains Tax Calculator for UK Shares

Enter your buys and sells of one stock or fund. Every sale is matched the way HMRC requires: same-day purchases first, then the next 30 days, then your Section 104 pool. You get the gain, the allowance used and the tax.

Your trades in one stock or fund

£

In 2025-26 your sales made a net gain of £6,547.79. After the £3,000 annual exempt amount, £3,547.79 is taxable: about £638.60 if it all fits in your basic rate band, £851.47 as a higher rate taxpayer.

How each sale was matched

  • Same day
  • Next 30 days (bed and breakfast)
  • Section 104 pool

Estimated tax

Your Section 104 pool

DateShares in poolPool costAverage cost
Amounts in pounds.

The three share matching rules

When you sell shares in a company you bought at different times, HMRC decides which purchase you sold. You don't get to pick, and it isn't first in, first out. Each sale is matched in this order:

  1. Same day. Shares of the same company bought on the day of the sale are matched first.
  2. The next 30 days. Then shares bought in the 30 days after the sale, earliest first. This is the bed and breakfast rule, so the gain or loss on those shares uses what you paid to buy them back.
  3. The Section 104 pool. Whatever is left comes out of the pool of everything else you bought, at its average cost.

In the example loaded above, you sell 3,500 shares on 2 June 2025 for £18,900.00. Here is how they are matched:

  • 1,000 shares, Same day. Bought the same day, so they cost £5,361.95 with their dealing costs.
  • 1,500 shares, 30-day rule. Bought back on 20 June 2025, inside 30 days, for £7,586.95. These count as the shares you sold even though you bought them later.
  • 1,000 shares, Section 104 pool. Taken from the pool, which held 7,500 shares at an average of £4.2699, so they cost £4,269.85.

The allowable cost is £17,230.70, the shares plus your dealing costs on the sale, and the gain is £1,669.30. The pool only shrinks by the 1,000 shares it supplied, and its average cost per share stays the same.

How the Section 104 pool works

Every share you buy that isn't matched by the same-day or 30-day rule goes into one pool per company, or per fund share class. The pool keeps two numbers: how many shares it holds and what they cost in total, dealing costs included. Buying adds to both. Selling from the pool takes out a slice of the cost in proportion to the shares sold, so the average cost per share only moves when you buy.

The pool runs for as long as you hold the shares, across tax years. That is why a sale this year can depend on a purchase from ten years ago, and why the full trade history matters.

The allowance and the rates

Add up the gains and losses on all your sales in the tax year, which runs from 6 April to 5 April. The first £3,000 of net gains is covered by the annual exempt amount, the figure for 2024-25 to 2026-27. This estimate includes losses for the selected tax year only.

What remains is taxed at 18% where it fits inside your unused basic rate band and 24% above it, for sales from 30 October 2024. Before that date the rates were 10% and 20%, and the calculator applies the right ones by sale date. The basic rate band is £37,700. Your gains sit on top of your taxable income. Enter it to see an estimated split between the two rates.

Reporting it to HMRC

Listed shares and funds go on the capital gains pages of Self Assessment, form SA108: the number of disposals, the proceeds, the allowable costs, the gains and the losses. You have to report when your gains are over the annual exempt amount, and also when you are registered for Self Assessment and your sale proceeds for the year are over £50,000.

Gains inside an ISA or a pension are tax free and stay off the return. A spouse or civil partner has their own pool and their own allowance.

Every broker, every sale, ready for SA108

Import your broker trades into AllInvestView to prepare your SA108 figures and review the matching behind them.

  • SA108 boxes 23 to 27 and box 45, with the matching rule on every disposal
  • A Section 104 pool ledger for each holding, and ISAs kept out
  • Foreign trades converted to pounds at the rate for each date, plus PDF, Excel and CSV exports
Start your free trial

14-day trial with the filing pack included. No card required.

Open the UK filing pack

AllInvestViewUK filing pack
UK filing pack with SA108 boxes 23 to 27 and box 45, the annual exempt amount, the taxable gain and the per-disposal matching detail UK filing pack with SA108 boxes 23 to 27 and box 45, the annual exempt amount, the taxable gain and the per-disposal matching detail
SA108 boxes and the matching detail in the UK pack. Sample filer, invented figures.View full sizeView full size

Questions about capital gains tax on shares

How is capital gains tax on shares calculated in the UK?

Each sale is matched to the shares you bought on the same day first, then to any you buy in the next 30 days, and only then to your Section 104 pool at its average cost. The gain is what you sold for less that cost and your dealing costs. Add up the gains and losses for the tax year, take off the annual exempt amount, and tax the rest at the rates in force on each sale date.

What is the bed and breakfast rule?

If you sell shares and buy the same shares back within 30 days, the sale is matched to the shares you bought back, not to your pool. The gain or loss on those shares uses the repurchase cost.

What is a Section 104 holding?

It is one pool for each company or fund, holding every share you bought that was not matched by the same-day or 30-day rule. The pool keeps a running number of shares and their total cost, so the cost per share is an average across all your purchases.

How much is the capital gains tax allowance?

The annual exempt amount is £3,000 for 2024-25, 2025-26 and 2026-27. Only the part of your net gains above it is taxed, and an unused allowance does not carry forward.

Do shares in an ISA count?

No. Gains inside an ISA or a pension are free of capital gains tax, so leave those trades out. Enter only shares held in an ordinary dealing account.

Do I have to report my gains to HMRC?

You report on the capital gains pages of Self Assessment, form SA108, when your gains are above the annual exempt amount. You also report when your total sale proceeds are over £50,000 and you are already registered for Self Assessment, even if no tax is due.

Keep going

An estimate for listed shares and funds held in an ordinary dealing account, from the trades you enter. It is not tax advice.
Sources: HMRC helpsheet HS284, Shares and Capital Gains Tax; HMRC Capital Gains Manual CG51550; Taxation of Chargeable Gains Act 1992 sections 1K, 104, 105 and 106A; changes to the rates of Capital Gains Tax.