How to Calculate Capital Gains Tax on Shares in the UK

    A step-by-step worked example of calculating CGT on share disposals.

    Updated 9 February 20268 min read

    Calculating capital gains tax (CGT) on shares in the UK follows a specific process set out in the Taxation of Chargeable Gains Act 1992 (TCGA 1992). You cannot simply subtract the price you bought a share for from the price you sold it at. Instead, HMRC requires you to apply a set of share matching rules - detailed in HMRC's Capital Gains Manual (CG51560) - to determine which shares you are disposing of and at what cost. This guide walks you through the full calculation process with worked examples.

    Important

    You must apply HMRC's share matching rules in the correct priority order for every disposal. Simply using the purchase price shown on your broker statement is not sufficient.

    The CGT calculation process - overview

    For each disposal (sale) of shares, you need to follow these steps:

    1. Identify the disposal - the date, number of shares sold, and proceeds received.
    2. Match the shares sold against acquisitions using the HMRC share matching rules, in priority order:
      1. Same-day rule - match against shares bought on the same day as the sale.
      2. 30-day rule - match against shares bought in the 30 days following the sale.
      3. Section 104 pool - match against the average-cost pool of remaining shares.
    3. Calculate the gain or loss on each matched portion.
    4. Deduct allowable costs (dealing fees, stamp duty, etc.).
    5. Aggregate all gains and losses for the tax year.
    6. Deduct any capital losses brought forward (only to the extent that gains exceed the annual exempt amount).
    7. Deduct the annual exempt amount (£3,000 for 2024/25 and 2025/26).
    8. Apply the appropriate CGT rate to the remaining chargeable gain.

    Example 1 - Simple disposal from the Section 104 pool

    Sarah holds shares in XYZ plc. Over the years she has built up a Section 104 pool through three purchases:

    DateShares boughtPrice per shareTotal cost
    10 Mar 2021200£5.00£1,000
    15 Sep 2022300£6.00£1,800
    22 Jan 2024500£7.00£3,500

    Her Section 104 pool now contains 1,000 shares at a total cost of £6,300, giving an average cost of £6.30 per share.

    On 5 November 2024, Sarah sells 400 shares at £9.00 each. She did not buy any shares on the same day or in the following 30 days. The calculation is:

    • Disposal proceeds: 400 x £9.00 = £3,600
    • Allowable cost (from pool): 400 x £6.30 = £2,520
    • Gain: £3,600 - £2,520 = £1,080

    After the disposal, her Section 104 pool holds 600 shares at a cost of £3,780 (600 x £6.30).

    Example 2 - Same-day rule triggered

    James owns 800 shares in ABC plc via his Section 104 pool, which has an average cost of £4.00 per share (total cost £3,200). On 12 January 2025:

    • He sells 300 shares at £8.00 each (proceeds: £2,400).
    • Later the same day, he buys 100 shares at £7.80 each (cost: £780).

    The same-day rule takes priority. Of the 300 shares sold, 100 are matched against the 100 bought on the same day. The remaining 200 are matched against the Section 104 pool.

    Same-day portion (100 shares):

    • Proceeds: 100 x £8.00 = £800
    • Cost: 100 x £7.80 = £780
    • Gain: £800 - £780 = £20

    Section 104 portion (200 shares):

    • Proceeds: 200 x £8.00 = £1,600
    • Cost: 200 x £4.00 = £800
    • Gain: £1,600 - £800 = £800

    Same-day rule impact

    James's total gain on this disposal is £20 + £800 = £820. The same-day rule prevents James from claiming a larger gain at the pool's lower average cost for those 100 shares - the rule ensures the actual same-day purchase price is used.

    Example 3 - 30-day rule triggered

    Maria holds 1,000 shares in DEF plc via her Section 104 pool at an average cost of £3.00 per share. On 1 March 2025, she sells 500 shares at £2.50 each, intending to crystallise a loss. On 20 March 2025 - within 30 days of the sale - she buys 300 shares at £2.60 each.

    The 30-day rule takes priority over the Section 104 pool. Of the 500 shares sold, 300 are matched against the repurchase on 20 March. The remaining 200 are matched against the Section 104 pool.

    30-day portion (300 shares):

    • Proceeds: 300 x £2.50 = £750
    • Cost: 300 x £2.60 = £780
    • Loss: £750 - £780 = -£30

    Section 104 portion (200 shares):

    • Proceeds: 200 x £2.50 = £500
    • Cost: 200 x £3.00 = £600
    • Loss: £500 - £600 = -£100

    30-day rule impact

    Maria's total loss on this disposal is -£30 + -£100 = -£130. Without the 30-day rule, the Section 104 pool cost would have applied to all 500 shares, giving a loss of £250. The rule reduces her allowable loss because the repurchased shares are matched at the higher buy-back price rather than the lower pool cost.

    Step 4 - Applying losses and the annual exempt amount

    Once you have calculated all gains and losses for the tax year, you aggregate them. Suppose in 2024/25 you have the following:

    • Total gains: £8,000
    • Total in-year losses: £1,500
    • Losses brought forward from previous years: £2,000

    First, offset in-year losses against gains:

    • £8,000 - £1,500 = £6,500

    Next, apply losses brought forward. You are only required to use enough brought-forward losses to reduce the net gains to the annual exempt amount (£3,000 for 2024/25):

    • £6,500 - £3,500 = £3,000 (only £3,500 of the £2,000 would be needed, but you only have £2,000)
    • Since you only have £2,000 of brought-forward losses: £6,500 - £2,000 = £4,500

    Finally, deduct the annual exempt amount:

    • £4,500 - £3,000 = £1,500 taxable gain

    If you are a basic-rate taxpayer with sufficient remaining basic-rate band, you pay CGT at 18% (for disposals after 30 October 2024): £1,500 x 18% = £270. If you are a higher-rate taxpayer, the rate is 24%: £1,500 x 24% = £360.

    How FiscalFox automates this

    The process above can be time-consuming, particularly if you have multiple disposals across different holdings in a tax year. FiscalFox applies the same-day rule, 30-day rule, and Section 104 pooling automatically when you upload your broker transaction history. It generates a detailed computation for every disposal and produces an HMRC-ready summary that maps directly to the SA108 capital gains form.

    Key points to remember

    • Always apply the share matching rules in order: same-day, then 30-day, then Section 104 pool.
    • Dealing fees and stamp duty are allowable costs - add them to acquisition cost or deduct from proceeds.
    • In-year losses must be fully offset against gains, even if this reduces gains below the annual exempt amount.
    • Brought-forward losses only need to reduce gains to the level of the annual exempt amount.
    • The annual exempt amount cannot be carried forward - use it or lose it.
    • For disposals after 30 October 2024 in the 2024/25 tax year, the CGT rates are 18% (basic rate) and 24% (higher rate) for shares.

    Ready to calculate your capital gains?

    Upload your broker CSV files and get HMRC-ready reports in minutes. Start free - no credit card required.