{"id":102,"date":"2026-03-23T08:39:17","date_gmt":"2026-03-23T08:39:17","guid":{"rendered":"https:\/\/taxbull.co.uk\/blog\/hmrc-share-matching-rules-explained\/"},"modified":"2026-03-23T08:39:17","modified_gmt":"2026-03-23T08:39:17","slug":"hmrc-share-matching-rules-explained","status":"publish","type":"post","link":"https:\/\/taxbull.co.uk\/blog\/hmrc-share-matching-rules-explained\/","title":{"rendered":"HMRC Share Matching Rules Explained \u2014 Same-Day, 30-Day, and Section 104 Pool"},"content":{"rendered":"<p>When you sell shares, HMRC doesn&#8217;t let you choose which ones you&#8217;ve sold. There&#8217;s a strict matching order that determines the cost basis of the shares you disposed of \u2014 and getting it wrong means your tax calculation is wrong.<\/p>\n<p>These rules trip up more people than any other aspect of UK Capital Gains Tax. Let&#8217;s go through each one properly, with examples that actually make sense.<\/p>\n<h2>Why matching rules exist<\/h2>\n<p>Imagine you bought 100 shares at \u00a32 in 2020 and another 100 at \u00a38 in 2024. You sell 100 today at \u00a310. Which 100 did you sell?<\/p>\n<p>If you could pick the \u00a38 shares, your gain would be \u00a3200. If you&#8217;re forced to sell the \u00a32 shares, your gain is \u00a3800. That&#8217;s a fourfold difference in tax \u2014 so obviously, HMRC doesn&#8217;t let you choose.<\/p>\n<p>Before 1998, investors exploited this by &#8220;bed and breakfasting&#8221; \u2014 selling shares on Friday to crystallise a loss, then buying them back on Monday. Parliament put a stop to that, and the current matching rules are the result.<\/p>\n<h2>Rule 1: Same-day matching<\/h2>\n<p>If you buy and sell shares in the same company on the same day, the buy and sell are matched together before anything else.<\/p>\n<p>There&#8217;s a subtle detail here that even many accountants miss: <strong>same-day compositing<\/strong>. If you make multiple buys or multiple sells on the same day, HMRC treats them as a single composited transaction. All same-day buys merge into one weighted-average buy. All same-day sells merge into one composited sell. Then the composited buy and sell are matched.<\/p>\n<p><strong>Example \u2014 multiple same-day trades:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Time<\/th>\n<th>Action<\/th>\n<th>Shares<\/th>\n<th>Price<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10:15<\/td>\n<td>Buy<\/td>\n<td>1,000<\/td>\n<td>\u00a31.24<\/td>\n<\/tr>\n<tr>\n<td>11:30<\/td>\n<td>Sell<\/td>\n<td>500<\/td>\n<td>\u00a31.25<\/td>\n<\/tr>\n<tr>\n<td>14:00<\/td>\n<td>Buy<\/td>\n<td>500<\/td>\n<td>\u00a31.23<\/td>\n<\/tr>\n<tr>\n<td>15:20<\/td>\n<td>Sell<\/td>\n<td>200<\/td>\n<td>\u00a31.30<\/td>\n<\/tr>\n<tr>\n<td>15:45<\/td>\n<td>Sell<\/td>\n<td>200<\/td>\n<td>\u00a31.35<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>First, composite the buys: 1,500 shares at weighted average cost.<\/p>\n<p>Total cost = (1,000 \u00d7 \u00a31.24) + (500 \u00d7 \u00a31.23) = \u00a31,240 + \u00a3615 = \u00a31,855<\/p>\n<p>Average cost = \u00a31,855 \u00f7 1,500 = \u00a31.2367 per share<\/p>\n<p>Composite the sells: 900 shares at weighted average proceeds.<\/p>\n<p>Total proceeds = (500 \u00d7 \u00a31.25) + (200 \u00d7 \u00a31.30) + (200 \u00d7 \u00a31.35) = \u00a3625 + \u00a3260 + \u00a3270 = \u00a31,155<\/p>\n<p>Match 900 sold against 900 of the 1,500 bought:<\/p>\n<p>Cost for 900 shares = 900 \u00d7 \u00a31.2367 = \u00a31,113.00<\/p>\n<p>Gain = \u00a31,155 \u2212 \u00a31,113 = <strong>\u00a342.00<\/strong><\/p>\n<p>The remaining 600 unmatched shares (1,500 \u2212 900) go into the Section 104 pool at their proportional cost.<\/p>\n<p>Without compositing \u2014 if you matched each sell individually against each buy \u2014 you&#8217;d get a slightly different answer. HMRC&#8217;s method avoids that ambiguity.<\/p>\n<h2>Rule 2: The 30-day rule (bed and breakfast)<\/h2>\n<p>After same-day matching, HMRC looks at whether you bought the same shares within the <strong>30 days after<\/strong> the sale. If you did, those newer purchases are matched to the sale instead of the pool.<\/p>\n<p>Key details that people get wrong:<\/p>\n<p>It&#8217;s 30 days <strong>after<\/strong> the sale, not before. Shares bought before the sale (other than on the same day) are already in your pool \u2014 they&#8217;re not affected.<\/p>\n<p>The window is exactly 30 calendar days. A purchase on day 30 counts. A purchase on day 31 doesn&#8217;t.<\/p>\n<p>If there are multiple purchases within the 30-day window, the <strong>earliest<\/strong> one matches first.<\/p>\n<p>Shares matched under the 30-day rule do <strong>not<\/strong> enter the Section 104 pool. They&#8217;re matched directly to the sale.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Date<\/th>\n<th>Action<\/th>\n<th>Shares<\/th>\n<th>Price<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1 Feb 2025<\/td>\n<td>Sell<\/td>\n<td>500<\/td>\n<td>\u00a312.00<\/td>\n<\/tr>\n<tr>\n<td>15 Feb 2025<\/td>\n<td>Buy<\/td>\n<td>300<\/td>\n<td>\u00a311.50<\/td>\n<\/tr>\n<tr>\n<td>28 Feb 2025<\/td>\n<td>Buy<\/td>\n<td>200<\/td>\n<td>\u00a311.80<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Both buys are within 30 days of the sale (1 Feb + 30 = 3 Mar). They match in order \u2014 earliest first.<\/p>\n<p>First 300 shares: proceeds = 300 \u00d7 \u00a312 = \u00a33,600, cost = 300 \u00d7 \u00a311.50 = \u00a33,450. <strong>Gain: \u00a3150<\/strong><\/p>\n<p>Next 200 shares: proceeds = 200 \u00d7 \u00a312 = \u00a32,400, cost = 200 \u00d7 \u00a311.80 = \u00a32,360. <strong>Gain: \u00a340<\/strong><\/p>\n<p>All 500 sold shares are matched. Total gain: <strong>\u00a3190<\/strong><\/p>\n<p>If you&#8217;d matched against the pool instead (say, average cost was \u00a35.00), the gain would have been \u00a33,500. The 30-day rule saved you significant tax here \u2014 but that&#8217;s the point. HMRC treats the &#8220;sell and rebuy&#8221; as if you essentially didn&#8217;t sell, so the gain is based on the actual price movement during the brief period you didn&#8217;t hold the shares.<\/p>\n<h2>Rule 3: The Section 104 pool<\/h2>\n<p>Everything left after same-day and 30-day matching goes to the pool. The pool is a running weighted average of all your shares in the same company (same class).<\/p>\n<p><strong>Building the pool:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Date<\/th>\n<th>Action<\/th>\n<th>Shares<\/th>\n<th>Price<\/th>\n<th>Pool Shares<\/th>\n<th>Pool Cost<\/th>\n<th>Avg Cost<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10 Jan 2023<\/td>\n<td>Buy<\/td>\n<td>200<\/td>\n<td>\u00a35.00<\/td>\n<td>200<\/td>\n<td>\u00a31,000<\/td>\n<td>\u00a35.00<\/td>\n<\/tr>\n<tr>\n<td>15 Jun 2023<\/td>\n<td>Buy<\/td>\n<td>300<\/td>\n<td>\u00a36.50<\/td>\n<td>500<\/td>\n<td>\u00a32,950<\/td>\n<td>\u00a35.90<\/td>\n<\/tr>\n<tr>\n<td>20 Nov 2023<\/td>\n<td>Buy<\/td>\n<td>100<\/td>\n<td>\u00a34.00<\/td>\n<td>600<\/td>\n<td>\u00a33,350<\/td>\n<td>\u00a35.583<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Now you sell 250 shares at \u00a37.50 on 1 March 2025 (no same-day or 30-day match):<\/p>\n<p>Cost from pool: 250 \u00d7 \u00a35.583 = \u00a31,395.83<\/p>\n<p>Proceeds: 250 \u00d7 \u00a37.50 = \u00a31,875.00<\/p>\n<p><strong>Gain: \u00a3479.17<\/strong><\/p>\n<p>After the sale, the pool has 350 shares with a cost of \u00a31,954.17 (\u00a33,350 \u2212 \u00a31,395.83). The average cost per share hasn&#8217;t changed \u2014 it&#8217;s still \u00a35.583. That&#8217;s how pooling works: the average cost only changes when you buy more, never when you sell.<\/p>\n<h2>When multiple rules apply to one sale<\/h2>\n<p>A single disposal can trigger all three rules. Say you sell 1,000 shares on 5 March:<\/p>\n<p>200 were bought the same day \u2192 same-day rule takes 200<\/p>\n<p>300 are bought on 20 March \u2192 30-day rule takes 300<\/p>\n<p>The remaining 500 come from the pool \u2192 Section 104<\/p>\n<p>Each portion gets its own cost basis and gain\/loss calculation. You report the total.<\/p>\n<h2>Practical tips<\/h2>\n<p><strong>Want to lock in a loss?<\/strong> Wait 31 days before rebuying. Or buy inside an ISA \u2014 that&#8217;s not caught by the 30-day rule because ISA shares are a separate holding.<\/p>\n<p><strong>Regular investors:<\/strong> If you invest monthly via a regular investment plan, you&#8217;re building a pool with a gradually changing average cost. The share matching rules make monthly investing quite tax-efficient, because the pool smooths out your cost basis over time.<\/p>\n<p><strong>Keep records of everything.<\/strong> Every buy, every sell, every fee, every stock split. HMRC can ask you to justify your calculations, and &#8220;I don&#8217;t have the records&#8221; is not a good answer. You need to keep records for at least 5 years after the 31 January deadline for the tax year in question.<\/p>\n<p>If tracking all this manually sounds like a headache, <a href=\"https:\/\/taxbull.co.uk\">TaxBull<\/a> does it automatically. Upload your broker&#8217;s CSV export, and it applies all three matching rules in the correct order \u2014 including same-day compositing, which most other tools get wrong. Every disposal shows which rule was applied and which acquisition it was matched to, so you have a complete audit trail.<\/p>\n<p><em>This content is for informational purposes only. Always check your specific situation with a qualified tax professional.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clear explanation of HMRC&#8217;s three share matching rules for Capital Gains Tax: the same-day rule, the 30-day bed &#038; breakfast rule, and the Section 104 pool.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[19,20,10,18,21,17],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-cgt-guides","tag-30-day-rule","tag-bed-and-breakfast","tag-hmrc","tag-same-day-rule","tag-section-104-pool","tag-share-matching-rules"],"_links":{"self":[{"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":1,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":330,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions\/330"}],"wp:attachment":[{"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taxbull.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}