How the South Africa sole proprietor calculator is verified

Inputs

InputFieldType
Annual taxable profit (ZAR)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)
Tax before rebatetaxBeforeRebate($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, $min([$p, $const.b5]) - $const.b4]) + $const.r6 * $max([0, $min([$p, $const.b6]) - $const.b5]) + $const.r7 * $max([0, $p - $const.b6]), 2))
Income tax after primary rebateincomeTax$round($max([0, taxBeforeRebate - $const.primaryRebate]), 2)
Net income / yearnetIncome$round($max([0, annualProfit - 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
primaryRebate17820
b1245100
b2383100
b3530200
b4695800
b5887000
b61878600
r10.18
r20.26
r30.31
r40.36
r50.39
r60.41
r70.45

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 — 600,000 ZAR taxable profit — a typical full-time consultant

given annualProfit600000
expect taxBeforeRebate150727
expect incomeTax132907
expect netIncome467093

Case 2 — 150,000 ZAR — the rebate covers most of the tax

given annualProfit150000
expect taxBeforeRebate27000
expect incomeTax9180
expect netIncome140820

Case 3 — 2,000,000 ZAR — into the top bracket

given annualProfit2000000
expect taxBeforeRebate720969
expect incomeTax703149
expect netIncome1296851

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 South Africa sole proprietor calculator

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