How the Sweden lön efter skatt calculator is verified

Inputs

InputFieldType
Bruttolön / år (SEK)grossAnnualnumber
Kommunkommunstring
Kommunalskatt om « Annan » (t.ex. 0.3241)customMunicipalRatenumber

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)
KommunalskattmunicipalRate($s := kommun; $s = 'genomsnitt' ? $const.rateGenomsnitt : $s = 'stockholm' ? $const.rateStockholm : $s = 'goteborg' ? $const.rateGoteborg : $s = 'malmo' ? $const.rateMalmo : $s = 'osteraker' ? $const.rateOsteraker : $s = 'dorotea' ? $const.rateDorotea : customMunicipalRate)
Beskattningsbartaxable($b := grossAnnual - $const.grundavdrag; $round($b > 0 ? $b : 0, 2))
KommunalskattmunicipalTax$round(taxable * municipalRate, 2)
Jobbskatteavdragjobbskatteavdrag($j := taxable * 0.09; $round($j < $const.jobbCap ? $j : $const.jobbCap, 2))
Statlig skattstateTax$round(grossAnnual > $const.stateThreshold ? (grossAnnual - $const.stateThreshold) * $const.stateRate : 0, 2)
Netto / årnetAnnual$round(grossAnnual - (municipalTax - jobbskatteavdrag) - stateTax, 2)
Netto / månadnetMonthly$round(netAnnual / 12, 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
grundavdrag24300
stateThreshold660400
stateRate0.2
jobbCap46200
rateGenomsnitt0.3238
rateStockholm0.304
rateGoteborg0.326
rateMalmo0.324
rateOsteraker0.2893
rateDorotea0.3565

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 — S1 420,000 SEK, average kommun

given grossAnnual420000
given kommunannan
given customMunicipalRate0.3241
expect taxable395700
expect municipalTax128246.37
expect jobbskatteavdrag35613

Case 2 — S2 700,000 SEK — state tax binds

given grossAnnual700000
given kommunannan
given customMunicipalRate0.3241
expect taxable675700
expect jobbskatteavdrag46200
expect stateTax7920

Case 3 — S3 420.000 kr i Stockholm — lägre kommunalskatt än riksgenomsnittet

given grossAnnual420000
given kommunstockholm
expect municipalRate0.304
expect municipalTax120292.8

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 Sweden lön efter skatt calculator

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