Answers · UK 2025/26
How do the share matching rules work for Capital Gains Tax?
When you sell shares of the same company or fund bought at different times, HMRC's share matching rules determine which specific purchase cost is used to calculate your gain, in a strict order: first, shares bought on the SAME DAY as the sale; second, shares bought in the following 30 days (the "bed and breakfast" rule); and finally, any remaining shares from a pooled "Section 104 holding" using the average cost of all other shares held.
Full answer
Because most investors buy shares in the same company or fund at different times and different prices, HMRC needs a defined set of rules to determine exactly which "batch" of shares is treated as sold when you make a disposal, and getting this wrong is a common source of Capital Gains Tax calculation errors. **Why matching rules are needed** If you'd bought 100 shares in a company in 2018 at £5 each, another 100 in 2021 at £8 each, and then sell 100 shares today, the taxable gain depends entirely on which purchase price is treated as the "cost" of the shares sold -- the matching rules remove any ambiguity or choice, applying a strict, mandatory order. **Rule 1 -- same-day acquisitions** Shares sold are first matched against any shares of the SAME class in the SAME company bought on the SAME DAY as the sale -- this rule primarily catches situations where you buy and sell shares in the same company within a single trading day. **Rule 2 -- the 30-day "bed and breakfast" rule** After same-day matching, any remaining shares sold are next matched against shares of the same class bought in the FOLLOWING 30 days (i.e., shares bought after the sale, within the next month) -- this is the rule that prevents "bed and breakfasting" (selling to crystallise a loss or manage your CGT position, then quickly buying back the same shares to keep your holding, while claiming the tax benefit of the disposal). If you rebuy within 30 days, the sale is matched against this new purchase rather than your original, older holding, often significantly changing the calculated gain or loss compared with what you might have expected. **Rule 3 -- the Section 104 pool** Any shares still remaining after the first two rules are matched against your "Section 104 holding" -- a single pooled record combining the cost of ALL your other shares of that class in that company, averaged together. Every time you buy more shares (outside the same-day/30-day windows), they're added to this pool, and the pool's average cost per share updates accordingly; every time you sell (outside those windows), the disposal is treated as coming proportionately from this averaged pool, using the average cost per share at that time, not the specific price of any individual original purchase. **Why this matters for calculating gains** Because of the pooling in Rule 3, you generally cannot simply pick and choose to "sell your highest-cost shares first" to minimise your reported gain (as you might be able to with some other assets) -- for shares held in a standard pool, the average cost across the whole pool is what's used, removing that flexibility, though the 30-day rule can be deliberately used (bed and ISA, or bed and SIPP) to reset your effective cost basis by selling and repurchasing in a different tax wrapper. **Different share classes and companies are pooled separately** Each separate share class within each separate company (or fund) has its own distinct Section 104 pool -- ordinary shares and preference shares in the same company, for example, are pooled and matched separately from one another, and shares in different companies are never mixed together in the same pool. **Fund and unit trust holdings work similarly** The same broad matching principles apply to holdings in funds, unit trusts, and OEICs, with units/shares acquired at different times generally pooled together in a similar way, subject to the same same-day and 30-day rules first. **Practical tip** If you're planning to sell shares to realise a gain or loss for tax planning purposes, avoid buying more shares of the same company within 30 days before or after the sale (other than within a different tax wrapper such as an ISA or SIPP), since doing so within the SAME account will trigger the 30-day matching rule and likely produce a very different calculated gain or loss than you intended.
Try the calculator
More answers
This answer is informational only and does not constitute financial, tax or legal advice. Figures are for the 2025/26 UK tax year. See our methodology and sources.