UK capital gains calculator for shares
Enter your buys and sells of one share or fund, in pounds. It matches them the way HMRC does (same day, then the next 30 days, then your average cost) and shows the gain on each sale and each tax year against your allowance. Free, no sign-up, and nothing you type is saved.
Your trades of one share
Price per share in pounds (e.g. 2.35 for 235p). Fees: dealing charges and stamp duty. Only shares held outside ISAs and pensions.
Each sale
How each sale’s cost was matched to your buys.
| Sold | Shares | Proceeds | Cost | Gain or loss | How the cost was matched |
|---|
Estimates from HMRC’s published rules, not tax advice. Gains on other shares, property or crypto count towards the same allowance. Check against HMRC’s guidance or with a tax adviser before you file.
Every account, matched automatically
Stockrules imports your trades from Trading 212, Interactive Brokers, Freetrade, Hargreaves Lansdown, AJ Bell, Vanguard and others, pools the same share across your general accounts, and keeps your Capital Gains figures and allowance up to date, ready for your Self Assessment.
Create a free accountHow HMRC matches shares
When you sell shares, HMRC doesn’t let you pick which ones you sold. The cost of the sale is matched in this order:
- Same day. Shares of the same company bought on the day of the sale.
- The next 30 days. Shares bought in the 30 days after the sale, earliest first. This is the “bed and breakfasting” rule: selling and buying back within 30 days doesn’t set a new cost for the shares you keep, it matches the sale against the buy-back.
- The section 104 pool. Everything else: all the shares you’ve held, at their average cost (including buying fees).
All the shares of one company you hold outside ISAs and pensions count as one holding, even across different brokers.
Bed and ISA
Selling shares in a general account and buying them back inside an ISA (“bed and ISA”) isn’t caught by the 30-day rule, because ISA shares are outside Capital Gains Tax. The sale in the general account is matched to your average cost as normal.
The annual exempt amount
Each tax year (6 April to 5 April) your first gains after losses are tax-free up to the annual exempt amount: £3,000 from 2024–25, £6,000 in 2023–24 and £12,300 before that. Above it, gains on shares are taxed at 18% within the basic rate band and 24% above it (from 30 October 2024; 10% and 20% before then).
When you have to report
If you’re in Self Assessment, report your sales on the capital gains pages (SA108) when your gains after losses are over the allowance, or your total sale proceeds are over £50,000, even if there’s no tax to pay. Reporting a loss lets you set it against gains in later years.
Official guidance: Tax when you sell shares and HS284 Shares and Capital Gains Tax on GOV.UK.
Estimates from HMRC’s published rules, not tax advice. Doesn’t cover share reorganisations, takeovers, employee share schemes, or shares held before 1982. Stockrules is run by Green Lane Corporation Ltd, a company registered in England and Wales (company number 17535546), 71–75 Shelton Street, Covent Garden, London WC2H 9JQ.