CGT Guides

How TaxBull Calculates Your Capital Gains Tax

23 March 2026 · 3 min read · By admin

Transparency matters when your tax bill is on the line. This page explains exactly which HMRC rules TaxBull applies, in what order, and how we handle the edge cases.

Legislation we follow

Rule Legislation HMRC Reference
Same-day matching TCGA 1992 s.105(1) CG51560
Same-day compositing TCGA 1992 s.105(1) CGT calculator algorithm
30-day bed & breakfast rule TCGA 1992 s.106A CG51565
Section 104 pool (average cost) TCGA 1992 s.104 CG51570, HS284
Options as chargeable assets TCGA 1992 s.144 CG12300, CG55500
Option exercise = single transaction TCGA 1992 s.144(2)-(3) CG55535
Incidental costs of disposal TCGA 1992 s.38(1)(c) CG15250
Annual exempt amount TCGA 1992 s.1L CG18100
CGT rates (from 30 Oct 2024) Finance Act 2025 s.7-12

Processing order

Step 1 — Parse. Your CSV is parsed entirely in your browser. We detect the broker format (Robinhood UK, Trading 212, Freetrade, Tastytrade, or generic) and extract: date, transaction type, instrument, quantity, price, and amount.

Step 2 — Classify. Each transaction is classified as a stock trade, option trade, or non-CGT event (deposits, dividends, FX conversions). Non-CGT events are excluded.

Step 3 — FX conversion. USD amounts are converted to GBP using HMRC’s official monthly exchange rates from trade-tariff.service.gov.uk. Each transaction uses the rate for the month it occurred in.

Step 4 — Fee calculation. Broker-specific fees are calculated and added to acquisition costs or deducted from disposal proceeds. For Robinhood UK this includes the 0.1% FX spread, Trading Activity Fee, Options Regulatory Fee, and commission.

Step 5 — Option matching. Options are grouped by identical key (same ticker + expiry + call/put + strike). Within each group, closes are matched to opens using FIFO order with a two-pass temporal constraint: Pass 1 matches only against opens from earlier dates. Pass 2 falls back to same-day opens (preventing roll mismatches). Expiries are matched to remaining opens. Assignments and exercises produce £0 option gain and pass the premium to the stock CGT engine.

Step 6 — Stock matching. For each instrument, all buy and sell transactions are processed through HMRC’s three-rule hierarchy:

6a. Same-day compositing: All buys on the same day are merged into a single composite buy (weighted average cost). All sells on the same day are merged into a single composite sell. This happens before matching, per TCGA s.105(1).

6b. Same-day matching: Composite sells are matched against composite same-day buys.

6c. 30-day matching: Remaining sells are matched against buys in the 30 days following the sale. Earliest buy first. Day 30 is included, day 31 is not.

6d. Section 104 pool: Everything left goes to the weighted-average pool. Cost is allocated proportionally: cost_of_sold_shares = pool_total_cost × (shares_sold ÷ pool_total_shares).

Step 7 — Summary. Events are grouped by tax year (6 April to 5 April). Gains and losses are separated. SA108 box figures are calculated: listed shares in Boxes 23-30, options in Boxes 14-22.

Validation

Our calculation engine has been tested against:

The published algorithm at cgtcalculator.com, including their Example 1 dataset (12 trades across VOD and BP, 2020-2025).

AccountingWeb’s worked bed and breakfast examples.

A custom 15-test suite covering: same-day compositing correctness, 30-day boundary edge cases (day 30 vs day 31), pool erosion across multiple sells, fee and stamp duty handling, same-day priority over B&B and pool, B&B earliest-buy-first ordering, competing sells for the same B&B buy, pure losses, and mixed gain/loss scenarios.

What we don’t handle (yet)

Corporate actions beyond stock splits (mergers, demergers, takeover paper-for-paper exchanges). These require manual adjustment.

Pre-April 1982 holdings and the 31 March 1982 rebasing rules.

Business Asset Disposal Relief, Investors’ Relief, or any other CGT reliefs.

CFD taxation (which may be treated as income rather than capital gains depending on HMRC’s view of your trading pattern).

If any of these apply to your situation, consult a tax professional.

Last updated: March 2026. Rules and rates reflect Finance Act 2025 and HMRC guidance current at time of writing.

Tags:calculation engineHMRC rulesmethodologyshare poolingTCGA 1992
Ready to calculate your UK Capital Gains Tax?

Free HMRC-compliant calculator with SA108 output. Supports Robinhood UK, Trading 212, Freetrade, and more.

Calculate CGT Free →

Leave a Reply

Your email address will not be published. Required fields are marked *