How the Canada self-employed (federal) calculator is verified

Inputs

InputFieldType
Annual net business income (CAD)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)
CPP + CPP2cpp$round($const.cppRate * $max([0, $min([annualProfit, $const.ympe]) - $const.cppExemption]) + $const.cpp2Rate * $max([0, $min([annualProfit, $const.yampe]) - $const.ympe]), 2)
Taxable IncometaxableIncome$round($max([0, annualProfit - cpp / 2]), 2)
Federal income taxfederalTax($t := taxableIncome; $round($max([0, $const.r1 * $min([$t, $const.b1]) + $const.r2 * $max([0, $min([$t, $const.b2]) - $const.b1]) + $const.r3 * $max([0, $min([$t, $const.b3]) - $const.b2]) + $const.r4 * $max([0, $min([$t, $const.b4]) - $const.b3]) + $const.r5 * $max([0, $t - $const.b4]) - $const.r1 * $const.bpa]), 2))
Net income / year (federal only)netIncome$round($max([0, annualProfit - cpp - federalTax]), 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
cppExemption3500
ympe74600
yampe85000
cppRate0.119
cpp2Rate0.08
bpa16452
b158523
b2117045
b3181440
b4258482
r10.14
r20.205
r30.26
r40.29
r50.33

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 — 80,000 CAD net business income — a typical full-time contractor

given annualProfit80000
expect cpp8892.9
expect taxableIncome75553.55
expect federalTax9381.2
expect netIncome61725.9

Case 2 — 30,000 CAD — part-time, below the first earnings ceiling

given annualProfit30000
expect cpp3153.5
expect taxableIncome28423.25
expect federalTax1675.98
expect netIncome25170.52

Case 3 — 200,000 CAD — above both CPP ceilings

given annualProfit200000
expect cpp9292.9
expect taxableIncome195353.55
expect federalTax38664.58
expect netIncome152042.52

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 Canada self-employed (federal) calculator

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