HMRC's worked examples, reproduced

    We run HMRC's own published Capital Gains Tax examples through the FiscalFox calculation engine. Here are HMRC's answers next to ours.

    Updated 12 October 2026Checked against published GOV.UK/HMRC guidance

    Published by FiscalFox · Editorial accountability: Grant Christopher Sloane

    At a glance

    19

    HMRC worked examples reproduced

    Exact to the penny
    8
    Matches HMRC's rounded figure
    5
    Same shares matched
    6

    Each example runs as an automated test on every change to the calculation code.

    What this page shows

    HMRC publishes worked examples in its Self Assessment helpsheets, its Capital Gains Manual, its Cryptoassets Manual and on GOV.UK. We enter the facts of each example into the FiscalFox calculation engine and compare its answer with HMRC's. For all 19 examples below, FiscalFox gets HMRC's answer.

    Each example shows the facts, HMRC's answer, our answer and a link to HMRC's page. They run as automated tests on every change to the calculation code, so these answers are checked again each time the engine changes.

    • Exact to the penny (8): Our figures are the same as HMRC's.
    • Matches HMRC's rounded figure (5): HMRC rounds each step to whole pounds. We keep pence, so our figure is exact to the penny, before HMRC's whole-pound rounding. The difference is always under £1. For example, in HS284 Example 3 HMRC gives a gain of £329 and FiscalFox gives £329.33.
    • Same shares matched (6): HMRC says which shares a sale is matched with but gives no money figures. We check the engine matches the same shares.

    HMRC has not reviewed or endorsed FiscalFox. These are HMRC's public examples, and the checks on this page are our own.

    Share matching and Section 104 holdings

    Sales are matched first with shares bought the same day, then with shares bought in the next 30 days, then with the Section 104 holding at its average cost.

    HS284 Example 1

    Five purchases, one Section 104 holding

    Same shares matched

    An investor buys shares in Wilson and Strickland plc five times between 1979 and 2006. All of them form one Section 104 holding.

    The facts

    DateEventSharesAmount
    7 June 1979Buy2,000Not given
    4 November 1982Buy2,500Not given
    26 August 1987Buy2,500Not given
    7 July 1998Buy3,000Not given
    14 May 2006Buy2,000Not given

    HMRC's answer and ours

    Shares in the Section 104 holdingHMRC12,000FiscalFox12,000

    How HMRC matches it

    • Every purchase joins the same Section 104 holding.

    FiscalFox gives the same result.

    HS284 Example 2

    A sale followed by a buy-back within 30 days

    Exact to the penny

    Mr Schneider sells 4,000 shares and buys 500 back 12 days later. The 500 are matched under the 30-day rule and the rest come from his Section 104 holding.

    The facts

    DateEventSharesAmount
    Before the saleSection 104 holding9,500Not given
    30 August 2024Sell4,000£6,000
    11 September 2024Buy500£850

    HMRC's answer and ours

    Shares matched under the 30-day ruleHMRC500FiscalFox500
    Shares taken from the Section 104 holdingHMRC3,500FiscalFox3,500
    Proceeds for the 500 sharesHMRC£750FiscalFox£750.00
    Allowable cost of the 500 sharesHMRC£850FiscalFox£850.00
    Gain or loss on the 500 sharesHMRC£100 lossFiscalFox£100.00 loss

    How HMRC matches it

    • 500 shares sold on 30 August are matched with the 500 bought on 11 September (30-day rule).
    • The other 3,500 come from the Section 104 holding.

    FiscalFox gives the same result.

    HS284 Example 3

    Two sales from a Section 104 holding, with dealing costs

    Matches HMRC's rounded figure

    Ms Pierson buys shares twice, paying dealing costs each time, then sells part of her holding twice. Each sale takes its share of the pooled cost.

    The facts

    DateEventSharesAmountDealing costs
    April 2016Buy1,000£4,000£150
    September 2019Buy500£2,050£80
    May 2024Sell700£3,360£100
    February 2025Sell400£2,080£105

    HMRC's answer and ours

    Section 104 holding after both purchasesHMRC1,500FiscalFox1,500
    Pooled cost after both purchasesHMRC£6,280FiscalFox£6,280.00
    First sale: allowable costHMRC£2,931rounded to £1FiscalFox£2,930.67
    First sale: gainHMRC£329rounded to £1FiscalFox£329.33
    Pooled cost left (800 shares)HMRC£3,349rounded to £1FiscalFox£3,349.33
    Second sale: allowable costHMRC£1,675rounded to £1FiscalFox£1,674.67
    Second sale: gainHMRC£300rounded to £1FiscalFox£300.33
    Pooled cost left (400 shares)HMRC£1,674rounded to £1FiscalFox£1,674.67

    Note on HMRC's page: HMRC publishes this example for 2025 and 2026 with every date one year apart. Both give the same figures, and we check both. The 2026 PDF says the second sale was in February 2025, but its own working uses February 2026, so we follow the working.

    CG51560 Example 1

    Sell everything, buy it all back within 30 days

    Same shares matched

    Miss A sells all 1,000 of her shares and buys 1,000 back 30 days later. The sale is matched with the new shares, not her old holding.

    The facts

    DateEventSharesAmount
    Before the saleSection 104 holding1,000Not given
    1 July 2011Sell1,000Not given
    31 July 2011Buy1,000Not given

    HMRC's answer and ours

    Shares matched under the 30-day ruleHMRC1,000FiscalFox1,000
    Shares taken from the Section 104 holdingHMRC0FiscalFox0

    How HMRC matches it

    • All 1,000 shares sold are matched with the purchase on 31 July (30-day rule).

    FiscalFox gives the same result.

    CG51560 Example 2

    Part of a sale matched with a later purchase

    Same shares matched

    Mr B sells 1,700 shares and buys 500 three days later. Only 500 of the shares sold are matched with the new purchase.

    The facts

    DateEventSharesAmount
    Before the saleSection 104 holding2,500Not given
    27 March 2012Sell1,700Not given
    30 March 2012Buy500Not given

    HMRC's answer and ours

    Shares matched under the 30-day ruleHMRC500FiscalFox500
    Shares taken from the Section 104 holdingHMRC1,200FiscalFox1,200

    How HMRC matches it

    • 500 shares are matched with the purchase on 30 March (30-day rule).
    • The other 1,200 come from the Section 104 holding.

    FiscalFox gives the same result.

    CG51560 Example 3

    A purchase just outside the 30 days

    Same shares matched

    Mrs C sells 2,000 shares and buys 3,000 more 31 days later. The purchase is too late for the 30-day rule, so the whole sale comes from her Section 104 holding.

    The facts

    DateEventSharesAmount
    Before the saleSection 104 holding10,000Not given
    28 February 2009Sell2,000Not given
    31 March 2009Buy3,000Not given

    HMRC's answer and ours

    Shares matched under the 30-day ruleHMRC0FiscalFox0
    Shares taken from the Section 104 holdingHMRC2,000FiscalFox2,000

    How HMRC matches it

    • All 2,000 shares sold come from the Section 104 holding.

    FiscalFox gives the same result.

    CG51590 Example 1

    The 30-day rule, then the Section 104 holding

    Exact to the penny

    Ms Davy builds a holding with three purchases, sells 2,000 shares, buys 2,000 back within 30 days, then makes a second sale later in the year.

    The facts

    DateEventSharesAmount
    15 April 2006Buy1,000£1,300
    4 August 2006Buy1,000£1,450
    19 January 2007Buy500£950
    16 March 2010Sell2,000£6,850
    7 April 2010Buy2,000£6,790
    10 December 2010Sell2,200£7,700

    HMRC's answer and ours

    March sale: gainHMRC£60FiscalFox£60.00
    December sale: allowable costHMRC£3,256FiscalFox£3,256.00
    December sale: gainHMRC£4,444FiscalFox£4,444.00
    Shares left in the Section 104 holdingHMRC300FiscalFox300
    Pooled cost leftHMRC£444FiscalFox£444.00

    How HMRC matches it

    • The March sale is matched with the 7 April purchase (30-day rule), so those shares never join the holding.
    • The December sale comes from the Section 104 holding.

    FiscalFox gives the same result.

    Bonus issues and takeovers

    New shares from a bonus issue or a share-for-share takeover are not a new purchase. They take over the cost and date of the shares they came from.

    HS285 Example 2

    A 1 for 2 bonus issue

    Same shares matched

    A company gives one free share for every two held. The new shares join the existing holding at no extra cost and are not treated as a new purchase.

    The facts

    DateEventSharesAmount
    Not givenShares held1,000Not given
    Not given1 for 2 bonus issue500Nil

    HMRC's answer and ours

    Shares held after the bonus issueHMRC1,500FiscalFox1,500

    How HMRC matches it

    • The bonus shares are not an acquisition, so the same day and 30-day rules never match a sale with them.

    FiscalFox gives the same result.

    HS285 Example 3

    A bonus issue shortly after a sale

    Same shares matched

    An investor sells 200 shares, then receives a bonus issue 27 days later. The bonus shares are not a purchase, so the sale is matched with the original shares.

    The facts

    DateEventSharesAmount
    6 May 2013Buy1,100Not given
    4 February 2025Sell200Not given
    3 March 20251 for 3 bonus issue300Nil

    HMRC's answer and ours

    Shares matched under the 30-day ruleHMRC0FiscalFox0
    Shares taken from the original holdingHMRC200FiscalFox200
    Shares held after the bonus issueHMRC1,200FiscalFox1,200

    How HMRC matches it

    • The 200 shares sold come from the shares bought in 2013, not the bonus shares.

    FiscalFox gives the same result.

    HS285 Example 6

    A takeover paid in shares

    Exact to the penny

    One company takes over another and pays only in its own shares. The investor already owns some shares in the buyer. There is no sale, and the old cost carries over to the new shares.

    The facts

    DateEventSharesCost
    Not givenShares held in the target company5,000£6,000
    Not givenShares already held in the buyer2,000£8,000
    Not givenTakeover: 5 buyer shares for each target share25,000Nil

    HMRC's answer and ours

    Gain on the takeoverHMRC£0FiscalFox£0.00
    Buyer shares held afterwardsHMRC27,000FiscalFox27,000
    Cost of the buyer holdingHMRC£14,000FiscalFox£14,000.00

    Cryptoassets

    HMRC applies the same matching rules to tokens. HMRC writes these dates without a year, so we show the day and month only.

    CRYPTO22251 Example 1

    A simple sale from a token pool

    Exact to the penny

    Victoria buys tokens twice, then sells a third of them. The cost comes from the pool average.

    The facts

    DateEventTokensAmount
    BeforeOpening holding100£1,000
    18 SeptemberBuy50£125,000
    1 DecemberSell50£300,000

    HMRC's answer and ours

    Allowable costHMRC£42,000FiscalFox£42,000.00
    GainHMRC£258,000FiscalFox£258,000.00
    Tokens left in the poolHMRC100FiscalFox100
    Pooled cost leftHMRC£84,000FiscalFox£84,000.00

    CRYPTO22252 Example 2

    Two sales and a purchase on one day

    Matches HMRC's rounded figure

    Martyn sells tokens twice and buys once on the same day. Both sales are matched with that day's purchase first.

    The facts

    DateEventTokensAmount
    BeforePool5,000£500
    23 JuneSell1,000£800
    23 JuneBuy1,600£1,000
    23 JuneSell500£600

    HMRC's answer and ours

    Proceeds for the dayHMRC£1,400FiscalFox£1,400.00
    Allowable costHMRC£938rounded to £1FiscalFox£937.50
    GainHMRC£462rounded to £1FiscalFox£462.50
    Tokens left in the poolHMRC5,100FiscalFox5,100
    Pooled cost leftHMRC£562rounded to £1FiscalFox£562.50

    How HMRC matches it

    • Both sales (1,500 tokens) are matched with the 1,600 bought that day (same day rule).

    FiscalFox gives the same result.

    CRYPTO22253 Example 3

    Two sales matched with three later purchases

    Exact to the penny

    Rachel sells twice and then buys three times within 30 days. Each sale is matched with the earliest purchases in turn.

    The facts

    DateEventTokensAmount
    BeforePool2,000£1,000
    31 MarchSell1,000£400
    20 AprilSell500£150
    21 AprilBuy700£175
    28 AprilBuy500£100
    1 MayBuy500£150

    HMRC's answer and ours

    31 March sale: gainHMRC£165FiscalFox£165.00
    20 April sale: gainHMRC£20FiscalFox£20.00
    Tokens left in the poolHMRC2,200FiscalFox2,200
    Pooled cost leftHMRC£1,060FiscalFox£1,060.00

    How HMRC matches it

    • 31 March sale: 700 tokens from 21 April and 300 from 28 April (30-day rule).
    • 20 April sale: 200 tokens from 28 April and 300 from 1 May (30-day rule).

    FiscalFox gives the same result.

    CRYPTO22254 Example 4

    Same day purchases first, then the pool

    Matches HMRC's rounded figure

    Daniel sells and buys several times in one day. He sells more than he buys that day, so the extra comes from his pool.

    The facts

    DateEventTokensAmount
    BeforePool8,000£1,000
    31 JanuarySell5,000£500
    31 JanuaryBuy4,000£320
    31 JanuaryBuy1,000£75
    31 JanuaryBuy1,000£70
    31 JanuarySell2,000£142
    31 JanuaryBuy500£35

    HMRC's answer and ours

    Tokens matched with that day's purchasesHMRC6,500FiscalFox6,500
    Cost of the same day tokensHMRC£500FiscalFox£500.00
    Tokens taken from the poolHMRC500FiscalFox500
    Cost of the pool tokensHMRC£63rounded to £1FiscalFox£62.50
    GainHMRC£79rounded to £1FiscalFox£79.50
    Tokens left in the poolHMRC7,500FiscalFox7,500
    Pooled cost leftHMRC£937rounded to £1FiscalFox£937.50

    CRYPTO22255 Example 5

    The 30-day rule, then the pool

    Exact to the penny

    Melanie sells 4,000 tokens and buys 500 back 12 days later. The 500 are matched under the 30-day rule and the rest come from her pool.

    The facts

    DateEventTokensAmount
    BeforePool14,000£200,000
    30 AugustSell4,000£160,000
    11 SeptemberBuy500£17,500

    HMRC's answer and ours

    Tokens matched under the 30-day ruleHMRC500FiscalFox500
    Cost of the 30-day tokensHMRC£17,500FiscalFox£17,500.00
    Cost of the pool tokensHMRC£50,000FiscalFox£50,000.00
    GainHMRC£92,500FiscalFox£92,500.00
    Tokens left in the poolHMRC10,500FiscalFox10,500
    Pooled cost leftHMRC£150,000FiscalFox£150,000.00

    CRYPTO22256 Example 6

    Same day, 30-day and pool rules together

    Matches HMRC's rounded figure

    Gulferaz makes three sales in a week, with purchases on the first sale's day and after it. All three matching rules apply.

    The facts

    DateEventTokensAmount
    BeforePool100,000£300,000
    31 JulyBuy10,000£45,000
    31 JulySell30,000£150,000
    5 AugustSell20,000£100,000
    6 AugustBuy50,000£225,000
    7 AugustSell100,000£150,000

    HMRC's answer and ours

    31 July sale: gainHMRC£15,000FiscalFox£15,000.00
    5 August sale: gainHMRC£10,000FiscalFox£10,000.00
    Pool before the 7 August saleHMRC110,000FiscalFox110,000
    Pooled cost before the 7 August saleHMRC£345,000FiscalFox£345,000.00
    7 August sale: allowable costHMRC£313,637rounded to £1FiscalFox£313,636.36
    7 August sale: gain or lossHMRC£163,637 lossrounded to £1FiscalFox£163,636.36 loss
    Tokens left in the poolHMRC10,000FiscalFox10,000
    Pooled cost leftHMRC£31,363rounded to £1FiscalFox£31,363.64

    How HMRC matches it

    • 31 July sale: 10,000 tokens from that day's purchase (same day rule) and 20,000 from 6 August (30-day rule).
    • 5 August sale: 20,000 tokens from 6 August (30-day rule).
    • 7 August sale: all from the pool.

    FiscalFox gives the same result.

    CRYPTO22257 Example 7

    Token for token exchanges across two pools

    Matches HMRC's rounded figure

    Elina swaps one token for another six times. Each swap is a sale of one token and a purchase of the other, so both pools change.

    The facts

    DateGivesReceivesValues used
    31 August1,000 token G10,000 token HG £3,200, H £3,200
    31 August5,000 token H600 token GH £1,700, G £1,920
    31 August550 token G5,000 token HG £1,760, H £1,650
    4 September2,000 token H180 token GH £560, G £558
    16 September400 token G4,000 token HG £1,080, H £1,080
    27 October12,000 token H900 token GH £2,400, G £2,430

    HMRC's answer and ours

    Token G, 31 August: gainHMRC£280FiscalFox£280.00
    Token G, 16 September: gain or lossHMRC£120 lossFiscalFox£120.00 loss
    Token G pool at the endHMRC99,730FiscalFox99,730
    Token G pooled cost at the endHMRC£298,890FiscalFox£298,890.00
    Token H, 31 August: gainHMRC£267rounded to £1FiscalFox£266.67
    Token H pooled cost after 31 AugustHMRC£3,307rounded to £1FiscalFox£3,306.67
    Token H, 4 September: gainHMRC£18FiscalFox£18.00
    Token H, 27 October: gain or lossHMRC£1,417 lossrounded to £1FiscalFox£1,416.67 loss

    Note on HMRC's page: HMRC's text says the 180 token G received on 4 September go into the token G pool. Under the 30-day rule they are matched with the 31 August disposal instead, and HMRC's own pool table leaves them out. We follow the table.

    Tax on the year's gains

    After the annual exempt amount, gains are taxed at 18% within the basic rate band and 24% above it.

    GOV.UK rates Example 1

    Gains that fit inside the basic rate band

    Exact to the penny

    In 2026 to 2027, someone with £20,000 of taxable income makes £12,600 of gains. After the £3,000 allowance, all the taxable gain falls in the basic rate band.

    The facts

    ItemAmount
    Tax year2026 to 2027
    Taxable income£20,000
    Gains£12,600

    HMRC's answer and ours

    Taxable gains after the allowanceHMRC£9,600FiscalFox£9,600.00
    Capital Gains TaxHMRC£1,728FiscalFox£1,728.00

    GOV.UK rates Example 2

    Gains split across the basic and higher rates

    Exact to the penny

    The same person makes £52,600 of gains instead. Part of the taxable gain is taxed at 18% and the rest at 24%.

    The facts

    ItemAmount
    Tax year2026 to 2027
    Taxable income£20,000
    Gains£52,600

    HMRC's answer and ours

    Taxable gains after the allowanceHMRC£49,600FiscalFox£49,600.00
    Capital Gains Tax (£17,700 at 18%, £31,900 at 24%)HMRC£10,842FiscalFox£10,842.00

    What this does not cover

    The calculator does not cover indexation allowance (used for older disposals and by companies), splitting cost between different classes of share, qualifying corporate bonds, residential property rates, or gains made by companies. HMRC examples on those topics are not on this page. Nor are examples we can only reproduce by entering the facts in a special way.

    Matching HMRC's examples shows the rules are applied correctly. It cannot show that a broker export is complete, so FiscalFox still flags missing history and unusual rows for you to review. Read the calculation methodology for more.

    Sources and licence

    Each example links to the HMRC or GOV.UK page it comes from. We describe each scenario in our own words and quote HMRC's figures. Where HMRC's page has a slip, we say so in a note and use the figure HMRC's own working supports.

    Contains public sector information licensed under the Open Government Licence v3.0.

    Official UK tax references

    This guide is checked against published GOV.UK and HMRC material. FiscalFox is a calculation tool, not personal tax advice; review unusual transactions with a qualified adviser.

    Ready to calculate your capital gains?

    Upload your broker files and generate reviewable SA108 supporting reports. Start free.