The 30-day rule for shares ("bed and breakfasting")

2 minute readChecked on 11 Nov 2026

The short answer

If you sell shares and buy the same shares back within 30 days, HMRC matches the sale with the new purchase, not with your older shares. So selling and quickly buying back doesn't let you lock in a gain or a loss.

The order HMRC uses

HMRC's helpsheet HS284 says shares you sell are matched in this order:

  1. shares bought on the same day as the sale;
  2. shares bought in the 30 days after the sale (the "bed and breakfasting" rule), if you were UK resident when you bought them;
  3. shares in your Section 104 holding (the average cost of the rest).

HMRC's example (HS284 Example 2)

Mr Schneider held 9,500 shares for years. He sold 4,000 on 30 Aug 2025 for £6,000, and bought 500 more on 11 Sep 2025 for £850.

The 500 shares matched under the 30-day rule £
Their share of the sale: 500 ÷ 4,000 × £6,000 £750
Cost: the 500 bought on 11 Sep £850
Loss on these 500 £100

The 3,500 from the holding use the holding's average cost (HMRC doesn't give his cost, so we stop there; see Section 104 pool example for a full pool example).

Why it matters

Working it out with Get My Gains

Get My Gains works out Capital Gains Tax on your shares in your browser, with nothing uploaded, using these same HMRC rules. It reads Trading 212, Freetrade, Interactive Brokers and Hargreaves Lansdown files (other brokers' files can be matched column by column), and leaves out ISA and pension accounts. It's free to check your gains and estimated tax.

Work out your shares tax See an example report

Official guidance

This guide is general information, not tax advice or investment advice. It covers individuals who are UK residents. It is not connected to or endorsed by HMRC. Check HMRC's guidance or ask an accountant before you file.

Checked against HMRC helpsheet HS284 (2026, updated 6 Apr 2026) on 11 Nov 2026.

More guides: shares guides · all guides · Section 104 pool example · CGT on shares, explained