How the New Zealand sole trader calculator is verified

Inputs

InputFieldType
Annual profit after expenses (NZD)annualProfitnumber

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)
Income taxincomeTax($p := annualProfit; $round($const.r1 * $min([$p, $const.b1]) + $const.r2 * $max([0, $min([$p, $const.b2]) - $const.b1]) + $const.r3 * $max([0, $min([$p, $const.b3]) - $const.b2]) + $const.r4 * $max([0, $min([$p, $const.b4]) - $const.b3]) + $const.r5 * $max([0, $p - $const.b4]), 2))
ACC earner levyaccLevy$round($min([annualProfit, $const.accMaxEarnings]) * $const.accRate, 2)
Net income / yearnetIncome$round($max([0, annualProfit - incomeTax - accLevy]), 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
b115600
b253500
b378100
b4180000
r10.105
r20.175
r30.3
r40.33
r50.39
accRate0.0175
accMaxEarnings156641

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 — 85,000 NZD profit — a typical full-time sole trader

given annualProfit85000
expect incomeTax17927.5
expect accLevy1487.5
expect netIncome65585

Case 2 — 30,000 NZD — part-time

given annualProfit30000
expect incomeTax4158
expect accLevy525
expect netIncome25317

Case 3 — 200,000 NZD — above the ACC maximum liable earnings

given annualProfit200000
expect incomeTax57077.5
expect accLevy2741.22
expect netIncome140181.28

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 New Zealand sole trader calculator

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