How the Norway enkeltpersonforetak calculator is verified

Inputs

InputFieldType
Annual profit (NOK)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)
Trygdeavgift (10.8%)trygdeavgift$round(annualProfit <= $const.trygdeThreshold ? 0 : $min([annualProfit * $const.trygdeRate, $const.trygdeShadeRate * (annualProfit - $const.trygdeThreshold)]), 2)
Trinnskatttrinnskatt($p := annualProfit; $round($const.tr1 * $max([0, $min([$p, $const.t2]) - $const.t1]) + $const.tr2 * $max([0, $min([$p, $const.t3]) - $const.t2]) + $const.tr3 * $max([0, $min([$p, $const.t4]) - $const.t3]) + $const.tr4 * $max([0, $min([$p, $const.t5]) - $const.t4]) + $const.tr5 * $max([0, $p - $const.t5]), 2))
Tax on general income (22%)generalIncomeTax$round($const.generalRate * $max([0, annualProfit - $const.personfradrag]), 2)
Net income / yearnetIncome$round($max([0, annualProfit - trygdeavgift - trinnskatt - generalIncomeTax]), 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
trygdeRate0.108
trygdeThreshold99650
trygdeShadeRate0.25
personfradrag114540
generalRate0.22
t1226100
t2318300
t3725050
t4980100
t51467200
tr10.017
tr20.04
tr30.137
tr40.168
tr50.178

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 — 700,000 NOK profit — a typical full-time sole proprietor

given annualProfit700000
expect trygdeavgift75600
expect trinnskatt16835.4
expect generalIncomeTax128801.2
expect netIncome478763.4

Case 2 — 120,000 NOK — inside the trygdeavgift shade-in range

given annualProfit120000
expect trygdeavgift5087.5
expect trinnskatt0
expect generalIncomeTax1201.2
expect netIncome113711.3

Case 3 — 1,600,000 NOK — into the top trinnskatt step

given annualProfit1600000
expect trygdeavgift172800
expect trinnskatt158250.45
expect generalIncomeTax326801.2
expect netIncome942148.35

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 Norway enkeltpersonforetak calculator

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