How the Singapore self-employed calculator is verified

Inputs

InputFieldType
Annual net trade income (SGD)netTradeIncomenumber

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)
MediSave contributionmedisave$round(netTradeIncome <= $const.medisaveFloor ? 0 : netTradeIncome * $const.medisaveRate, 2)
Income taxincomeTax($i := netTradeIncome; $round($const.r2 * $max([0, $min([$i, $const.b2]) - $const.b1]) + $const.r3 * $max([0, $min([$i, $const.b3]) - $const.b2]) + $const.r4 * $max([0, $min([$i, $const.b4]) - $const.b3]) + $const.r5 * $max([0, $min([$i, $const.b5]) - $const.b4]) + $const.r6 * $max([0, $min([$i, $const.b6]) - $const.b5]) + $const.r7 * $max([0, $min([$i, $const.b7]) - $const.b6]) + $const.r8 * $max([0, $min([$i, $const.b8]) - $const.b7]) + $const.r9 * $max([0, $min([$i, $const.b9]) - $const.b8]) + $const.r10 * $max([0, $min([$i, $const.b10]) - $const.b9]) + $const.r11 * $max([0, $min([$i, $const.b11]) - $const.b10]) + $const.r12 * $max([0, $min([$i, $const.b12]) - $const.b11]) + $const.r13 * $max([0, $i - $const.b12]), 2))
Net income / yearnetIncome$round($max([0, netTradeIncome - medisave - 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
medisaveRate0.08
medisaveFloor6000
b120000
b230000
b340000
b480000
b5120000
b6160000
b7200000
b8240000
b9280000
b10320000
b11500000
b121000000
r20.02
r30.035
r40.07
r50.115
r60.15
r70.18
r80.19
r90.195
r100.2
r110.22
r120.23
r130.24

Test vectors (3)

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 — 90,000 SGD net trade income — a typical full-time freelancer

given netTradeIncome90000
expect medisave7200
expect incomeTax4500
expect netIncome78300

Case 2 — 35,000 SGD — part-time

given netTradeIncome35000
expect medisave2800
expect incomeTax375
expect netIncome31825

Case 3 — 250,000 SGD — a well-paid consultant

given netTradeIncome250000
expect medisave20000
expect incomeTax30700
expect netIncome199300

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 self-employed calculator

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