How the United Kingdom take-home pay calculator is verified

Inputs

InputFieldType
Gross annual salary (GBP)grossAnnualnumber
Pension contribution (fraction, e.g. 0.05)pensionPctnumber

The formula

Each derived value below is computed by the Valem engine from the expression shown, in this order. Nothing else runs — there is no hidden code path.

Derived valueFieldFormula (JSONata)
Pension ContributionpensionContribution$round(grossAnnual * pensionPct, 2)
Adjusted IncomeadjustedIncome$round(grossAnnual - pensionContribution, 2)
Personal allowancepersonalAllowance($over := adjustedIncome - $const.paTaperThreshold; $red := $over > 0 ? $over / 2 : 0; $pa := $const.paBase - $red; $round($pa > 0 ? $pa : 0, 2))
Taxable incometaxableIncome($ti := adjustedIncome - personalAllowance; $round($ti > 0 ? $ti : 0, 2))
Income taxincomeTax($ti := taxableIncome; $b := $ti < $const.basicBand ? $ti : $const.basicBand; $h := $ti > $const.basicBand ? ($ti < $const.higherTaxableLimit ? $ti : $const.higherTaxableLimit) - $const.basicBand : 0; $a := $ti > $const.higherTaxableLimit ? $ti - $const.higherTaxableLimit : 0; $round($b * $const.basicRate + $h * $const.higherRate + $a * $const.additionalRate, 2))
National Insuranceni($m := (grossAnnual < $const.niUpperLimit ? grossAnnual : $const.niUpperLimit) - $const.niPrimaryThreshold; $m := $m > 0 ? $m : 0; $u := grossAnnual - $const.niUpperLimit; $u := $u > 0 ? $u : 0; $round($m * $const.niMainRate + $u * $const.niUpperRate, 2))
Net / yearnetAnnual$round(grossAnnual - pensionContribution - incomeTax - ni, 2)
Net / monthnetMonthly$round(netAnnual / 12, 2)

Rates and thresholds

The expressions above read these as $const. They are the figures the annual refresh replaces, so they live as data rather than being written into the formulas — which is what makes a year-on-year change a one-line diff instead of an edit to arithmetic.

ConstantValue
paBase12570
paTaperThreshold100000
basicBand37700
higherTaxableLimit112570
basicRate0.2
higherRate0.4
additionalRate0.45
niPrimaryThreshold12570
niUpperLimit50270
niMainRate0.08
niUpperRate0.02

Test vectors (2)

Every case is executed against this model on each build, by the Java engine and independently by a JavaScript one. A mismatch of a single cent fails the build, so the page cannot ship advertising a figure the model no longer produces.

Case 1 — S1 35,000 GBP single, no pension

given grossAnnual35000
given pensionPct0
expect personalAllowance12570
expect taxableIncome22430
expect incomeTax4486
expect ni1794.4
expect netAnnual28719.6
expect netMonthly2393.3

Case 2 — S3 130,000 GBP — personal allowance fully tapered

given grossAnnual130000
given pensionPct0
expect personalAllowance0
expect taxableIncome130000

Sources

Check it yourself — and reuse it

The whole model as JSON — inputs, outputs, formulas, vectors and sources in one re-runnable document.

This model is published under CC BY 4.0: use it, adapt it, build on it, with attribution. The licence covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds are law, and nobody licenses those; the sources above are where they come from.

← Back to the United Kingdom take-home pay calculator

Built with Valem — a live, verifiable calculator you can fork and embed.