Key takeaways
- HMRC fixes the order. A disposal matches shares bought on the same day first, then shares bought in the 30 days after it, then the section 104 pool.
- In HMRC's own example, a £6,850 sale matched a £6,790 repurchase 22 days later, so the gain was £60 rather than the £3,890 the pool would have produced.
- The pool is one average. 2,500 shares costing £3,700 works out at £1.48 each, so selling 2,200 uses £3,256 of cost and leaves 300 shares at £444.
- In the 2026 to 2027 tax year the exempt amount is £3,000 and the rates are 18% and 24%, so a £4,444 gain costs £259.92 or £346.56.
- That exempt amount fell from £12,300 in the 2022 to 2023 tax year to £3,000, which is why matching now decides whether a disposal is taxable at all.
You don't choose which shares you sold — a fixed order does
You bought the same shares three times at three different prices. You've just sold some of them. Which ones did you sell?
You don't get to pick, and the answer isn't first-in-first-out. Section 106A of the Taxation of Chargeable Gains Act 1992 sets a fixed order, and HMRC's Capital Gains Manual restates it. A disposal is matched, in this sequence: first with shares of the same class acquired on the same day; then with shares acquired in the 30 days after the disposal; then with the section 104 holding, the pool that carries everything else at one average cost. HMRC's manual adds a fourth step for anything still unmatched — later acquisitions, "taking the earliest acquisition first".
That order is not a formality. Run HMRC's own worked example and the second rule turns what would have been a £3,890 gain into a £60 one, while quietly moving £459.60 of cost into a future disposal. Here's the sequence, rule by rule, with the arithmetic shown.
Rule one nets everything you bought and sold on the same day
Section 105 treats all shares of the same class bought by the same person on the same day, in the same capacity, as a single acquisition. It does the same for everything sold that day. Then it matches the two: "all the securities so acquired shall, so far as their quantity does not exceed that of the securities so disposed of, be identified with those securities".
Time of day is irrelevant. HMRC's manual is blunt: "If there is an acquisition and a disposal on the same day the disposal is identified first against the acquisition on the same day." A morning purchase is matched against an afternoon sale, and the other way round.
Two things follow. Sell more than you buy that day and "the excess shares will be identified in the normal way", which means on to rule two. Buy more than you sell and "the surplus is added to the Section 104 holding". Shares caught by rule one never enter the pool at all — the statute says so directly, at section 105(3).
One oddity: HMRC's share identification pages carry no numbered example of the same-day rule for individuals. The manual page that introduces it gives three worked examples and all three are 30-day cases. That's a gap in the guidance, not in the law.
Rule two looks forward only, and 31 days is a different answer
The 30-day rule matches a disposal with shares acquired "by the same person in the same capacity, and acquired within the 30 days after the disposal". It "has priority over all other identification rules except the `same day' rule". The window runs forward. A purchase made 30 days before a sale is simply part of the pool.
HMRC's boundary example is the one worth remembering. Mrs C holds 10,000 shares, sells 2,000 on 28 February 2009, and buys 3,000 on 31 March 2009. That's 31 days. HMRC's verdict: "Mrs C's acquisition is not within the 30 days after the disposal." The sale comes out of the pool instead. A single day decided which cost figure applied.
Contrast Mr B, who sells 1,700 shares on 27 March 2012 and buys 500 on 30 March 2012. Three days. HMRC: "The later acquisition of 500 shares does not become part of the Section 104 holding." Those 500 are matched to the sale, and "the remaining 1,200 shares sold are identified with part of the Section 104 holding". One sale, two separate calculations, on two different cost bases.
Rule three treats the pool as a single asset with one average cost
Everything not caught by the first two rules sits in the section 104 holding. HMRC describes the shares in it as "indistinguishable parts of a single asset which grows or shrinks as shares are acquired or disposed of". The pool holds what you paid plus "the costs of acquisition" — dealing fees and stamp duty, not just the ticket price.
On a part disposal the strict statutory apportionment is by value, but HMRC accepts the simple version: "in practice the apportionment may be made by reference to the number of shares sold". So the cost you deduct is the pool cost multiplied by shares sold, divided by shares held.
There's no way to nominate your highest-cost lot. If you've met FIFO, LIFO or HIFO cost basis in a US context, none of them survives the crossing for ordinary UK shares. The answer is one average, recalculated every time the pool changes. That's oddly freeing: the urge to choose a lot — realising winners, holding losers — is one of the best-documented habits in the behavioural literature, and our piece on the disposition effect puts a cost on it. UK share matching takes the choice away.
HMRC's worked example, priced out at every step
The manual's first example follows Ms Davy. She buys 1,000 shares for £1,300, then 1,000 more for £1,450, then 500 for £950 — a section 104 holding of 2,500 shares at a total cost of £3,700. Then she sells 2,000 for £6,850 on 16 March 2010, buys 2,000 for £6,790 on 7 April 2010, and sells 2,200 for £7,700 that December.
The first disposal. The 7 April purchase lands 22 days after the sale, inside the window, so rule two takes it before the pool gets a look. HMRC: "A gain £60 (£6,850 - £6,790) arises. Because the shares bought on 7 April are identified under the `bed and breakfast' rule, they do not enter the pool." Gain: £60. The pool is untouched.
The second disposal. Now rule three. The pool is still 2,500 shares at £3,700, which is £1.48 a share. She sells 2,200 of them, so the allowable cost is £3,700 × 2,200 ÷ 2,500 = £3,256. HMRC: "Her chargeable gain is therefore £7,700 - £3,256 = £4,444." What's left is "300 shares at a cost of £444" — the same £1.48 each.
Two disposals, £4,504 of gain between them, and the two halves computed on completely different bases.
What rule two really did: £3,890 became £60, and £459.60 moved into the future
Now run the same trades with the repurchase falling outside the window — say 31 days later rather than 22. Every figure below is ours, computed from HMRC's.
- The first sale would come out of the pool: 2,000 shares × £1.48 = £2,960 of cost. Gain: £6,850 − £2,960 = £3,890, against £60.
- The pool would drop to 500 shares at £740. The £6,790 repurchase would then join it, rebuilding it to 2,500 shares at £7,530.
- December's sale of 2,200 would carry £6,626.40 of cost. Gain: £7,700 − £6,626.40 = £1,073.60, against £4,444.
- The leftover 300 shares would carry £903.60 of cost instead of £444.
Add the two disposals up and the counterfactual gives £4,963.60 of gain against £4,504. The £459.60 gap is exactly the extra cost sitting in those 300 shares. Nothing was forgiven. The 30-day rule moved cost from one disposal to another, and left less of it behind for later.
Whether that helps depends entirely on the year. In the 2026 to 2027 tax year the annual exempt amount is £3,000 and gains are taxed at 18% within the basic rate band and 24% above it, with the £37,700 band deciding which. A £4,444 gain leaves £1,444 taxable: £259.92 at 18%, £346.56 at 24%. A £60 gain is inside the allowance and costs nothing at all. A £3,890 gain is not.
One sale can produce a loss and a gain at the same moment
HMRC's shares helpsheet, updated 6 April 2026 and covering the 2025 to 2026 tax year, has the cleanest illustration of a split disposal. Mr Schneider holds 9,500 shares, sells 4,000 on 30 August 2025, and buys 500 back on 11 September 2025 — 12 days later. Rule two claims 500 of them; the other 3,500 come from the pool.
On the matched leg, proceeds are apportioned: 500 ÷ 4,000 × £6,000 = £750. The cost is the £850 he actually paid on 11 September. That leg is a £100 loss. He sold at an average £1.50 a share and bought back at £1.70, and the rule holds him to the repurchase price. The other 3,500 shares are computed off the pool average and may well show a gain.
This is the part that trips people up in practice. A monthly investing plan buys on a set date. Sell on the 5th, and the direct debit that lands later the same month is matched against that sale whether you intended it or not. The rule doesn't ask about intention.
Bed and breakfasting stopped working in 1998, and it wasn't banned
HMRC defines the trade plainly: "arrangements in which a person sells an asset only to buy it back again a short time later", done "to trigger a gain that qualifies for some form of relief or to trigger a loss even though the intention is to hold the asset in the longer term". The point was to use up an allowance, or bank a loss, without changing what you owned.
The 30-day rule "was introduced in 1998 to counter" exactly that. Notice what it does and doesn't do. It doesn't prohibit the trade. It changes the arithmetic, and HMRC says so: "Where the 30 day identification rule applies it will normally have the effect of reducing or eliminating the gain or loss which would have arisen if the disposal had been identified with shares already held." You can still do it. It just stops producing the number you wanted. There's also a backstop for manufactured losses on any asset, the targeted anti-avoidance rule at section 16A.
Bed-and-ISA and bed-and-spouse break a different condition each
Both variants work on the rule's own wording, and they break different limbs of it.
The ISA route. Sell outside a wrapper, subscribe the proceeds to a stocks and shares ISA, repurchase inside it. HMRC's guidance for ISA managers is unambiguous about what happens next: "Nor do they pay any tax on capital gains arising on ISA investments. However, losses on ISA investments cannot be allowed for Capital Gains Tax purposes against capital gains outside an ISA." Regulation 22 of the ISA Regulations is the source of that exemption. Future gains leave the system; so do future losses, which is the part people forget.
The 30-day question is where you have to read closely. The rule needs three things: same class, same person, same capacity. The statute puts the capacity limb this way — where someone "disposes of securities in one capacity, they shall not be identified" with securities held "only in some other capacity". HMRC illustrates that limb once, with a trust: "a disposal by an individual in a personal capacity followed by an acquisition as trustee of a trust would not be subject to the rule." It publishes no equivalent example for a repurchase inside an ISA. The whole trade rests on that unwritten point, because if the ISA purchase were matched, the gain would be measured against a price struck days later and the disposal would crystallise almost nothing.
The size of the move is capped in any case. The ISA subscription limit for the 2026 to 2027 tax year is £20,000, and buying UK shares carries stamp duty reserve tax at 0.5% — £100 on a full £20,000 repurchase, before the spread and any dealing charge. Those frictions compound with everything else you already pay, which is the subject of our piece on FX charges, platform fees and withholding tax.
The spouse route. A repurchase by a husband, wife or civil partner fails a different condition: it isn't the same person. What happens to the shares afterwards is governed by section 58, under which a transfer between spouses living together takes place "for such consideration as will give neither a gain nor a loss to the transferor". GOV.UK puts the consequence in one line: "Their gain will be calculated on the difference in value between when you first owned the asset and when they disposed of it. If this was before April 1982, your spouse or civil partner should work out their gain using the market value on 31 March 1982 instead."
So the gain isn't erased. Your base cost travels with the shares. What changes is whose exempt amount and whose rate band the eventual gain meets — two people have £6,000 of allowance between them in the 2026 to 2027 tax year, and one of them may sit in the basic rate band while the other doesn't.
The honest objection: for most holdings, only rule three ever fires
There's a serious case that none of this deserves your attention. Buy and hold, never repurchase within a month, and rule three is the only rule that ever applies. Your platform computes the pool. The 30-day rule, when it does fire, usually helps: matching a sale to a repurchase at a similar price shrinks the gain, which is HMRC's own description of its effect.
That objection is mostly right, and it has one hole. The rule is symmetric. It shrinks losses as readily as gains, so a disposal made deliberately to bank a loss is undone by a repurchase you make for entirely unrelated reasons — a rebalancing trade, a fund switch, a dividend reinvestment. Anyone running tight rebalancing bands trades often enough for that to happen by accident, as the trade counts in our piece on crypto rebalancing bands show. And because matching changes the gain but not the proceeds, the reporting obligation is unaffected: if you file a return, disposals count where "the total amount you sold the assets for was more than £50,000", even when the matched gain is nil.
Tracking a pool is bookkeeping rather than judgement — one cost figure per holding, adjusted on every purchase and every sale, carried for years. LedgerTouch keeps that figure current as transactions land; a spreadsheet does the same job if you never miss an entry.
The limitations: what the three-rule story leaves out
HMRC's helpsheet says it "explains the basic rules which apply in simple cases", and the exceptions are not exotic.
- Some securities never enter a pool at all. Qualifying corporate bonds, accrued-income-scheme securities and non-reporting fund interests are matched "with acquisitions within the 30 days following the disposal on a first-in, first-out basis", and only after that with earlier acquisitions, last in first out.
- Employee shares carrying disposal restrictions sit in "a separate Section 104 holding" until the restrictions lift.
- A rights or bonus issue after a sale isn't an acquisition, so section 127 keeps it outside the 30-day rule.
- Shares held on 31 March 1982 come in at their value that day, not at cost.
- The 30-day rule doesn't apply where the person wasn't UK resident at the time of the acquisition.
And the tax figures are a snapshot, not a constant. The annual exempt amount for individuals was £12,300 in the 2022 to 2023 tax year, £6,000 in 2023 to 2024, and £3,000 in each of the three years since. The chart above tracks that fall. Every rate and threshold quoted here is for the 2026 to 2027 tax year, and the recent record says they move.
What would change the conclusion
If the annual exempt amount went back toward £12,300, most of this arithmetic stops mattering for an ordinary holding, because a £4,444 gain would sit inside the shelter and matching would decide nothing. The reason these three rules are worth an afternoon in 2026 is that the shelter shrank to £3,000, not that the rules changed. HMRC's own summary of the regime is that “Share pooling was reintroduced for disposals on or after 6 April 2008”, and the pooling order has applied ever since.
If HMRC published a worked example of a repurchase inside an ISA, the one genuinely uncertain paragraph above would resolve in a sentence. It hasn't, in a manual it updated in July 2026.
The date to watch isn't 5 April. It's the 30 days after every sale you make — a window you open without deciding to, and close without noticing.
