How the Singapore net pay calculator is verified

Inputs

InputFieldType
Gross annual salary (SGD)grossAnnualnumber

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)
Employee CPF (20%)cpf$round((grossAnnual < $const.cpfCeiling ? grossAnnual : $const.cpfCeiling) * $const.cpfRate, 2)
Chargeable incometaxableIncome$round(grossAnnual - cpf, 2)
Income taxincomeTax($t := taxableIncome; $round((($t > 20000 ? (($t < 30000 ? $t : 30000) - 20000) : 0) * 0.02) + (($t > 30000 ? (($t < 40000 ? $t : 40000) - 30000) : 0) * 0.035) + (($t > 40000 ? (($t < 80000 ? $t : 80000) - 40000) : 0) * 0.07) + (($t > 80000 ? (($t < 120000 ? $t : 120000) - 80000) : 0) * 0.115) + (($t > 120000 ? (($t < 160000 ? $t : 160000) - 120000) : 0) * 0.15) + (($t > 160000 ? (($t < 200000 ? $t : 200000) - 160000) : 0) * 0.18) + (($t > 200000 ? (($t < 240000 ? $t : 240000) - 200000) : 0) * 0.19) + (($t > 240000 ? (($t < 280000 ? $t : 280000) - 240000) : 0) * 0.195) + (($t > 280000 ? (($t < 320000 ? $t : 320000) - 280000) : 0) * 0.20) + (($t > 320000 ? ($t - 320000) : 0) * 0.22), 2))
Net / year (after CPF & tax)netAnnual$round(grossAnnual - cpf - incomeTax, 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
cpfRate0.2
cpfCeiling96000

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 60,000 SGD, age 30

given grossAnnual60000
expect cpf12000
expect taxableIncome48000
expect incomeTax1110
expect netAnnual46890

Case 2 — S3 300,000 SGD — CPF ceiling binds

given grossAnnual300000
expect cpf19200
expect taxableIncome280800

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 Singapore net pay calculator

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