The "Matching Rules" Hierarchy
When you sell shares, HMRC decides which specific shares you sold using a strict order of priority. You cannot choose.
- Same Day Rule: Shares bought on the same day as the sale.
- The 30-Day Rule: Shares bought in the next 30 days after the sale.
- The Section 104 Pool: The average cost of all remaining shares you own (this is usually what you want to match against).
The Trap In Action
Scenario: You bought 100 shares of TechCorp years ago for £1,000. They are now worth £4,000.
The Plan: You sell them to lock in the £3,000 gain (tax-free). You buy them back 2 weeks later for £4,050.
The Result: Because you bought them back within 30 days, HMRC matches the sale (£4,000) against the new purchase (£4,050). You have actually created a loss of £50, and your original low-cost pool remains untouched.
Valid Workarounds (Bed & ISA)
You do not have to leave the market entirely. There are legal ways to harvest your capital gains allowance without waiting 30 days. The wider mechanics of how share gains are pooled and taxed are in our CGT on shares guide.
Option 1: Bed & ISA
- Sell your shares (outside an ISA).
- Move the cash into your Stocks & Shares ISA.
- Buy the shares back inside the ISA immediately.
Why it works: ISA purchases are exempt from the matching rules.
Option 2: Bed & Spouse
- Sell your shares.
- Your spouse/civil partner buys the shares in their own name immediately.
Why it works: You are separate individuals for Capital Gains Tax purposes.
Section 104 Pool: The "Average" Cost
If the Same Day or 30-Day rules do not apply, you use the "Section 104 Pool." This aggregates the cost of all the shares you own in a specific company to create an average purchase price.
Calculation: (Total Cost of All Shares) ÷ (Total Number of Shares).
Impact: This smooths out your gains over time.
Frequently Asked Questions
Does this apply to funds and ETFs?
How do I count the 30 days?
What about crypto assets?
Don't just guess. Use our free tool to get precise numbers based on these rules.
Calculate Your True Gain →