Skip links

UK Capital Gains Tax on Shares: Share Matching and the 30-Day Rule Explained

If you buy shares in the same company at different prices, how do you calculate your profit when you sell some of them?

You might assume you can choose the most expensive shares to reduce your taxable gain or simply use the cost of the shares you bought first. For UK Capital Gains Tax, you generally cannot choose. Share matching rules determine which purchase costs you must use.

This guide explains the rules for individuals, with two practical examples. Companies have different rules.

Which shares are matched together?

The rules apply to shares of the same class in the same company, held in the same capacity. For example, your personally owned ordinary shares in one company would normally be considered together.

HMRC applies the following order when matching a sale to purchases:

PriorityShares matched to the sale
1. Same dayShares bought on the day of the sale
2. Following 30 daysShares bought within the next 30 days
3. Share poolShares in your existing pooled holding

For the usual investor selling shares they already own, these are the three steps to check.

What is a Section 104 share pool?

A Section 104 pool is a running record of your shares and their total allowable cost.

Instead of keeping each purchase separate for tax purposes, you normally combine the purchases into one holding. Each share in the pool then has the same average cost.

When you sell part of the holding, you deduct the corresponding proportion of the pool’s cost. For example, selling 60% of the pool uses 60% of its cost. The remaining shares and cost stay in the pool for future sales.

Example 1: Selling shares from the pool

Daniel bought shares in Oakfield plc over several years:

Purchase dateShares boughtCost
November 20041,000£2,000
July 20093,000£9,000
October 20132,000£8,000
November 20184,000£20,000
Total10,000£39,000

On 18 August 2025, he sells 6,000 shares for £36,000.

He buys no shares on the sale date or during the following 30 days, so the whole sale is matched against his pool.

Daniel has sold 60% of his shares. He therefore deducts 60% of the pooled cost:

£39,000 × 60% = £23,400

CalculationAmount
Sale proceeds£36,000
Less: allowable purchase cost(£23,400)
Capital gain£12,600

His remaining pool contains 4,000 shares with a cost of £15,600.

How does the 30-day rule work?

Buying back shares shortly after selling them can change your Capital Gains Tax calculation.

Shares purchased within the 30 days after a sale are matched to that sale before using the existing pool. This is sometimes called the “bed and breakfasting” rule.

The rule applies where you are UK resident for tax purposes when you make the later purchase. Shares matched this way do not enter the pool.

Example 2: Buying shares back within 30 days

Rachel has 60,000 shares in Brookdale plc, with a pooled cost of £90,000.

On 16 March 2026, she sells 20,000 shares for £75,000.

On 30 March 2026, she buys 10,000 shares in the same company and class for £40,000. Assume she is UK resident and makes no other relevant purchases.

Because the new purchase falls within 30 days:

  • 10,000 shares sold are matched to the new purchase.
  • The remaining 10,000 shares sold are matched to her existing pool.

Half the sale proceeds—£37,500—are allocated to each part.

CalculationNew purchaseExisting pool
Shares matched10,00010,000
Sale proceeds£37,500£37,500
Allowable cost(£40,000)(£15,000)
Gain/(loss)(£2,500)£22,500

The pool cost used is:

£90,000 × 10,000 ÷ 60,000 = £15,000

Rachel’s overall capital gain is therefore:

£22,500 − £2,500 = £20,000

Her remaining pool contains 50,000 shares costing £75,000. The £40,000 repurchase cost is used directly against the sale, so it never enters the pool.

Both examples ignore transaction fees and show gains before any available losses or annual tax-free allowance.

Does the 30-day rule cross the tax year end?

Yes. The 30-day period does not stop on 5 April.

For Rachel’s sale on 16 March 2026, the period runs from 17 March to 15 April 2026. A relevant purchase in early April could therefore affect her gain for 2025/26, even if the purchase falls in the next tax year.

Before finalising a year-end share gain, check purchases made during the full 30 days after the sale.

What records should you keep?

Keep purchase and sale dates, share quantities, costs, proceeds and transaction fees, together with a running balance of your share pool.

Understanding these rules helps you calculate the right gain, keep accurate records and avoid surprises when buying shares back after a sale.

Need help calculating your share gains or completing your Self-Assessment return? Book a call with FKGB Accounting.

Further guidance: HMRC’s shares and Capital Gains Tax helpsheet.

Information correct as of 11 November 2026. This article provides general guidance for individuals and does not constitute personal tax advice. Tax rules and allowances can change, and the treatment will depend on your circumstances.

.