# invest.capital-gains-tax
**Status: needs review by a tax professional before it is published.**
Capital Gains Tax due from a UK individual for one tax year, from the year's
gains and losses, the taxable income that has already used part of the basic
rate band, and any losses brought forward. Returns each step: gains, losses,
losses brought forward used, the annual exempt amount used, taxable gains, the
gains charged at each rate with the tax on each, the total, and the losses
left to carry forward.
## How it is worked out
1. The year's losses are set against the year's gains in full, even where
that takes the net gains below the annual exempt amount and wastes it
(CG21500).
2. Losses brought forward are used only to bring the net gains down to the
annual exempt amount; the rest carry on (CG21500).
3. The annual exempt amount comes off what is left.
4. The losses and exempt amount are set against the gains charged at the
highest rate first, as TCGA 1992 s1F and s1K allow ("in the way that is
most beneficial ... generally against gains charged at the highest rate").
5. What taxable income leaves of the basic rate band is charged at the lower
rate, given first to the gains whose two rates are furthest apart (in
2024/25, 10%/20% gains before 18%/24% ones), since that saves the most.
6. Tax is worked out for each rate and rounded down to the penny.
For the rates in the data this order gives the lowest tax. The rates follow
the date of each disposal, so 2024/25 mixes 10%/20% for shares sold up to
29 October 2024 with 18%/24% from 30 October.
## Rules data
`data/cgt-years.json` has, per tax year, the annual exempt amount and the
basic rate band (in pence). `data/cgt-rates.json` has the lower and higher
rate for residential property and other assets by disposal date. Years
covered: 2020/21 to 2026/27. A tax year outside those, or a date before a
pruned build's horizon, is refused rather than guessed.
| Tax year | AEA | Basic rate band |
|---|---|---|
| 2020/21 | £12,300 | £37,500 |
| 2021/22, 2022/23 | £12,300 | £37,700 |
| 2023/24 | £6,000 | £37,700 |
| 2024/25 to 2026/27 | £3,000 | £37,700 |
| Disposals | Residential property | Other |
|---|---|---|
| 6 Apr 2016 to 5 Apr 2024 | 18% / 28% | 10% / 20% |
| 6 Apr 2024 to 29 Oct 2024 | 18% / 24% | 10% / 20% |
| from 30 Oct 2024 | 18% / 24% | 18% / 24% |
## Out of scope
Business Asset Disposal Relief and Investors' Relief (and the basic rate band
they use first), carried interest, trusts and personal representatives, losses
carried back on death, non-residents, and the reliefs that extend the basic
rate band (gift aid and personal pension contributions: pass `taxableIncome`
less the grossed-up contributions). CGT bands are UK-wide, so a Scottish
taxpayer uses the UK basic rate band here, not the Scottish income tax bands.
Each gain is the caller's: work it out per disposal first (for shares,
`invest.section-104-pool`).
## Sources
Read on 2026-09-23:
- GOV.UK, "Capital Gains Tax rates and allowances" (AEA 2021/22 to 2026/27;
rates by period including 6 April 2024 to 29 October 2024 and from
30 October 2024): https://www.gov.uk/guidance/capital-gains-tax-rates-and-allowances
- HMRC Capital Gains Manual CG10246, "Capital Gains Tax: rates of tax - before
30 October 2024" (10%/20% and 18%/28% from 6 April 2016; basic rate band use):
https://www.gov.uk/hmrc-internal-manuals/capital-gains-manual/cg10246
- The Capital Gains Tax (Annual Exempt Amount) Order 2020, SI 2020/333
(£12,300 for 2020/21): https://www.legislation.gov.uk/uksi/2020/333/made
- CG21500, "Individuals: losses: assessment" (order of loss set-off; TCGA92/S1F
most beneficial): https://www.gov.uk/hmrc-internal-manuals/capital-gains-manual/cg21500
- CG10150, "Partial re-write of TCGA 1992" (old s4B is now s1F and s1K):
https://www.gov.uk/hmrc-internal-manuals/capital-gains-manual/cg10150
- GOV.UK, "Income Tax: Personal Allowance and basic rate limit from 2019-20"
(£37,500 for 2019/20 and 2020/21):
https://www.gov.uk/government/publications/income-tax-personal-allowance-and-basic-rate-limit-from-2019-to-2020/income-tax-personal-allowance-and-basic-rate-limit-from-2019-20
- GOV.UK, Budget 2021 OOTLAR Annex A (basic rate band £37,700 for 2021/22 to
2025/26): https://www.gov.uk/government/publications/budget-2021-overview-of-tax-legislation-and-rates-ootlar/annex-a-rates-and-allowances
- GOV.UK, "Income Tax rates and allowances for current and previous tax years"
(£37,700 for 2023/24 to 2026/27):
https://www.gov.uk/government/publications/rates-and-allowances-income-tax/income-tax-rates-and-allowances-current-and-past
## What a reviewer should check
- The allocation order in steps 4 and 5, and the line rounding (down to the
penny per rate; HMRC's return rounds gains to whole pounds).
- That a zero gain is simply ignored and a loss of any kind offsets gains of
any kind.
## Before you rely on this
**Not professional advice.** This capability calculates investment figures from published rules. It is a software component for developers, not financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have a tax adviser review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.
**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified tax adviser has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.
## Notices
Contains public sector information licensed under the Open Government
Licence v3.0 (https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).
Legislation: Crown copyright and database right.
1.0.1 marks it unreviewed and adds its attribution notices (NOTICE). The code and the tests are unchanged.