Home Guides & News About Us Contact
Guide

How to Calculate CGT on Shares: Worked Example

Work out capital gains tax on shares step by step for 2026/27: Section 104 average cost, the 30-day matching rule, and how the 18% and 24% rates split.

The Order HMRC Works In

Most guides give you one formula: sale price minus purchase price, minus the allowance, taxed at 18% or 24%. That works if you bought your shares once and sold the lot. Buy the same share more than once, or buy again shortly after selling, and the calculation runs in a fixed order where each step feeds the next. HMRC works through four:

  1. Match the shares you sold against shares you acquired, in a set priority order.
  2. Work out the gain using the allowable cost of whatever those shares matched to.
  3. Deduct losses and the The Capital Gains Tax allowance: the slice of gains you can realise each tax year before any CGT is due. It is £3,000 for 2026/27 and cannot be carried forward if unused. to get the taxable gain.
  4. Apply the rate, which splits across 18% and 24% depending on your income.

Step one is the one people skip; step four is the one they get wrong.


Steps 1 and 2: Pool the Cost, Then Work Out the Gain

Shares of the same class in the same company are treated as identical, so you cannot nominate which ones you sold. Every purchase goes into a HMRC's method for valuing shares of the same class bought at different times. All purchases are averaged into one pooled cost per share, used to work out the gain when you sell.: one running total of shares, one running total of cost. The allowable cost of a share you sell is the pool's cost divided by its quantity - a weighted average, not the price you paid on any one day.

Worked example - Sarah's pool. Sarah buys 1,000 shares in one company for £4,000 (£4.00 each), then later buys 500 more for £3,500 (£7.00 each). Her Section 104 pool now holds 1,500 shares at a total cost of £7,500, so the pooled cost is £7,500 ÷ 1,500 = £5.00 a share.

In 2026/27 she sells 1,000 of them for £18,000. The allowable cost is 1,000 × £5.00 = £5,000, so her gain is £13,000. Less the £3,000 annual exempt amount, her taxable gain is £10,000. The pool carries on with 500 shares and £2,500 of cost.

Note what the pool did to the answer. Averaging Sarah's two purchases lifted her cost per share from £4.00 to £5.00, which took £1,000 off the gain on this disposal alone.

Your broker's contract notes give the price and dealing costs for each purchase. What platforms generally do not do is maintain the pool across accounts - it follows you and the share, so one company held with two brokers is still one pool.


Step 4: Your Rate Is Not One Number

This is the step the consensus routinely glosses over. "18% or 24%" is written as though you pick the one matching your tax band. You do not. Your taxable gain is added on top of your taxable income: only the slice that still fits inside the basic-rate band is charged at 18%, and everything above it at 24%. One disposal, one taxpayer, both rates.

A single share gain taxed at both 18% and 24%A bar representing a £10,000 taxable gain made by someone with £45,000 of income in 2026/27. The gain stacks on top of income, so the first £5,270 fills the unused basic-rate band up to the £50,270 higher-rate threshold and is taxed at 18%, giving £948.60. The remaining £4,730 sits above the threshold and is taxed at 24%, giving £1,135.20. Total Capital Gains Tax is £2,083.80 from one disposal.One gain, two CGT ratesYour gain stacks on your income: £45,000 income + £10,000 taxable gain crosses £50,27018% on £5,270£948.6024% on £4,730£1,135.20higher-rate threshold £50,270the last of your basic-rate bandeverything above the thresholdOne disposal, two rates: total CGT £2,083.80Source: gov.uk CGT rates 2026/27 - CGT bands are UK-wide, incl. Scotlandukfinancetools.co.uk
Sarah's £10,000 taxable gain sits on £45,000 of income, straddling the £50,270 threshold - so it is taxed at both rates.

Worked example continued. Sarah earns £45,000. The higher-rate threshold is £50,270, so she has £50,270 - £45,000 = £5,270 of basic-rate band left. The first £5,270 of her £10,000 taxable gain is taxed at 18% = £948.60. The remaining £4,730 is taxed at 24% = £1,135.20. Her total Capital Gains Tax bill is £2,083.80, an effective rate of about 16% on the full £13,000 gain.

GOV.UK frames the same sum differently: take your taxable income - after the £12,570 Personal Allowance - and measure it against the £37,700 basic-rate band. Sarah's taxable income is £32,430, leaving the same £5,270. Use HMRC's version if your Personal Allowance is tapered by income over £100,000.

Scottish taxpayers use the UK threshold, not their own. Capital Gains Tax is not devolved. Scottish Income Tax rates apply to your salary, where the higher rate starts at £43,663 in 2026/27 - but the CGT split still uses the UK-wide £50,270. Someone in Scotland on £45,000 is a higher-rate taxpayer on their salary and still has £5,270 of 18% band for gains.


When a Repurchase Overrides the Pool

Before the pool is touched, HMRC matches your disposal against two other things. The order, set out in TCGA 1992 and HMRC's helpsheet HS284, is: shares bought on the same day as the sale, then shares bought in the 30 days following it (the Selling shares to use your CGT allowance then quickly rebuying them. HMRC blocks it - shares rebought within 30 days match to the sale, not the cheaper pool, so no gain is crystallised. rule), and only then the Section 104 pool. Shares matched under the first two rules never enter the pool.

That rule is usually filed under "tax loss harvesting" and left there. It is worth seeing it change a live number.

Worked example - Tom rebuys within a month. Tom holds 1,000 shares with a pooled cost of £5.00 each. On 10 May 2026 he sells 500 at £18.00 (£9,000). On 20 May he changes his mind and buys 200 back at £17.00. Because the repurchase falls inside 30 days, 200 of the shares he sold are matched to it: gain = 200 × (£18 - £17) = £200. The other 300 match the pool: gain = 300 × (£18 - £5) = £3,900. Total gain £4,100, against £6,500 if he had used the pooled cost for all 500. His pool drops to 700 shares, not 500 - the 200 he rebought never joined it.

One practical note: our shares CGT calculator applies this matching for you. Switch to full transaction history mode, enter or import every buy and sell, and it matches each disposal in this order automatically - same day, then 30 days, then the pool.

The rule bites regardless of why you rebought, so an ordinary change of mind is caught exactly as a deliberate harvest would be, and it applies only if you were UK resident at the time of the acquisition. For the ways around it, see the 30-day matching rule, bed and ISA, and bed and spouse.


Losses Have an Order That Can Cost You Your Allowance

Current-year and brought-forward losses are treated differently, and the difference is money. A loss made in the same tax year is set against your gains before the annual exempt amount is applied, and you have no choice about it.

Worked example - the same loss, two years apart. You make a £5,000 gain and a £4,000 loss in the same year. The loss comes off first, leaving £1,000 - which the allowance covers, so you pay nothing. But the whole £4,000 loss is used up and £2,000 of your £3,000 allowance did no work. Had that same loss been brought forward from an earlier year, you would deduct only £2,000 of it - enough to bring the gain down to the allowance - and carry the other £2,000 forward to use again.

That is the asymmetry: a brought-forward loss is rationed to what you need, a current-year loss is not - so realising a loss in a year with no gains usually leaves more of it intact, provided you later have gains above the allowance to use it against.

A loss only exists once you claim it - on your Self Assessment return, or by writing to HMRC if you are not registered, within four years of the end of the tax year of the disposal. Once claimed, it carries forward indefinitely.


What You Can Deduct, and When You Must Report

The allowable cost is more than the share price. Add the dealing commission on both the purchase and the sale, and the Stamp Duty Reserve Tax charged at 0.5% on electronic share purchases (on a paper stock transfer form, Stamp Duty applies at 0.5% above £1,000). You cannot deduct interest on money borrowed to buy the shares, research costs, or your own time.

Share gains go on your Self Assessment return in the tax year after the disposal, and the 60-day deadline you may have read about applies to UK residential property, not shares. Finally, this is a per-year, per-person exercise: the £3,000 allowance cannot be carried forward, so an unused one is gone on 5 April, and each spouse has their own. For the traps this guide does not cover - accumulation units, employee shares, foreign-currency purchases - see the CGT on shares overview.

Sources: HMRC helpsheet HS284 (share identification and pooling); HMRC CG51560 (same-day and bed-and-breakfast rules); GOV.UK Capital Gains Tax rates; GOV.UK losses; GOV.UK Tax when you buy shares.

Frequently Asked Questions

Do I pay 18% or 24% CGT on shares?

Potentially both, on the same disposal. Your taxable gain is added on top of your taxable income: the part that still fits inside the basic-rate band is taxed at 18% and anything above it at 24%. Someone earning £45,000 with a £10,000 taxable gain pays 18% on £5,270 and 24% on £4,730.

How do I work out the cost of shares I bought at different prices?

You use the pooled average, not any individual purchase price. Add up the total cost of every purchase of that share and divide by the total number of shares held. Buying 1,000 at £4.00 and 500 at £7.00 gives 1,500 shares costing £7,500, so £5.00 a share.

Does the 30-day rule change how much tax I pay?

Yes. It normally reduces the gain or loss measured on the disposal, which is exactly why it also blocks a deliberate loss harvest. Shares you buy back within 30 days of a sale are matched to that sale instead of your pool, so the gain is measured against the repurchase price rather than the pooled cost. Those shares never enter the pool.

What can I deduct from my capital gain on shares?

The purchase cost, dealing commission on both the buy and the sell, and the 0.5% Stamp Duty Reserve Tax on electronic purchases. You cannot deduct interest on money borrowed to buy the shares, subscription or research costs, or your own time.

Do I have to report a share gain below the £3,000 allowance?

Usually not, if your total gains for the year are within the annual exempt amount and you are not otherwise completing a return. One catch: if you are registered for Self Assessment you must still report the disposals where the total you sold assets for exceeded £50,000, even with no tax to pay. Losses are the other exception worth acting on - a loss only exists once you claim it, and you can claim up to four years after the end of the tax year of the disposal.

Don't just guess. Use our free tool to get precise numbers based on these rules.

Work Out Your Own Number →