Gainly

The 30-day rule for shares and crypto

Buying an asset back soon after selling it can change the gain on the sale. The later purchase may supply the allowable cost before your existing Section 104 pool is used.

By Gainly · Reviewed

The matching order

For ordinary share disposals by a UK-resident individual in the same capacity, identify the same class of shares in the same company in this order. Fungible crypto tokens follow the corresponding identification rules. Special circumstances, including non-residence, can change the treatment.

  • Acquisitions on the same calendar day as the disposal.
  • Qualifying acquisitions in the next 30 calendar days, often called the bed and breakfast rule.
  • The Section 104 pool for units still unmatched.

Example: buying back some of the shares

You begin with 100 shares in a pool costing £1,000. On 1 June you sell 40 shares at £20, receiving £800. On 10 June you buy 15 of the same shares at £18. There are no fees, same-day buys or other acquisitions in the 30-day window.

30-day matched cost
15 × £18 = £270
Pool cost for the remaining 25
25 × £10 = £250
Total allowable cost
£270 + £250 = £520
Gain on the sale
£800 − £520 = £280
Pool after matching
75 shares costing £750

Why the pool does not simply lose 40 shares

The 15 repurchased shares are matched directly to the earlier disposal, rather than added to the pool. Only 25 of the shares sold take their cost from the pool. The resulting 75 pooled shares also agree with your physical balance: 100 − 40 + 15.

Using only the original £10 average for all 40 shares would have shown a £400 gain. Under the assumptions above, the later purchase changes that figure to £280. A working paper prepared before the repurchase would therefore need updating.

Same-day purchases have priority

In a separate example, you sell 10 shares for £200 and buy 10 of the same shares for £180 on that calendar day. With no fees or other trades, the same-day match gives a £20 gain. The existing pool does not supply the cost of those 10 shares, even if its average is different.

The 30 days can cross 6 April

Suppose you sell 10 shares on 28 March 2026 for £200 and buy 10 of the same shares on 10 April 2026 for £180. Assume there are no fees, same-day buys or competing matches. The purchase is 13 days after the sale, so it falls inside the window even though it is in a new tax year.

The £20 gain belongs to the disposal’s 2025–26 tax year. The purchase does not move the sale into 2026–27. Include the later purchase when preparing the earlier year’s figures.

Keep the window up to date

Import purchases through the end of the window before treating a disposal’s matching as settled. Overlapping sales and repurchases need matching in order, rather than treating each sale as an isolated example.

Gainly’s Gains page applies matching to recorded trades. Simulate is different: it models a sale using the current Section 104 average and does not rematch hypothetical same-day or 30-day purchases. Neither result is a tax bill.

Sources and scope

The guidance below was checked on 19 October 2026. Examples are simplified working papers for individuals, not personal tax advice. Gainly calculates gains from recorded trades; it does not calculate tax due or file returns.

Put your records to work

Import trades to review matched disposals and gains. Free to try in this browser.

Track my gains