How the Portugal regime simplificado calculator is verified

Inputs

InputFieldType
Annual revenue (EUR)annualRevenuenumber

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)
Ss BasessBase$round($min([annualRevenue * $const.ssIncomeShare, $const.ssAnnualBaseCeiling]), 2)
Social Security (21.4% of 70%)socialSecurity$round(ssBase * $const.ssRate, 2)
IRS taxable base (75%)taxableBase$round(annualRevenue * $const.serviceCoefficient, 2)
IRSirsTax($t := taxableBase; $round((($t < 8342 ? $t : 8342) * 0.125) + (($t > 8342 ? (($t < 12587 ? $t : 12587) - 8342) : 0) * 0.157) + (($t > 12587 ? (($t < 17838 ? $t : 17838) - 12587) : 0) * 0.212) + (($t > 17838 ? (($t < 23089 ? $t : 23089) - 17838) : 0) * 0.241) + (($t > 23089 ? (($t < 29397 ? $t : 29397) - 23089) : 0) * 0.311) + (($t > 29397 ? (($t < 43090 ? $t : 43090) - 29397) : 0) * 0.349) + (($t > 43090 ? (($t < 46566 ? $t : 46566) - 43090) : 0) * 0.431) + (($t > 46566 ? (($t < 86634 ? $t : 86634) - 46566) : 0) * 0.446) + (($t > 86634 ? ($t - 86634) : 0) * 0.48), 2))
Net income / yearnetIncome$round($max([0, annualRevenue - socialSecurity - irsTax]), 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
ssIncomeShare0.7
ssRate0.214
ssAnnualBaseCeiling77346.72
serviceCoefficient0.75

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 — 30,000 EUR revenue — a typical full-time freelancer

given annualRevenue30000
expect ssBase21000
expect socialSecurity4494
expect taxableBase22500
expect irsTax3945.97
expect netIncome21560.03

Case 2 — 60,000 EUR revenue — into the 43.1% band

given annualRevenue60000
expect ssBase42000
expect socialSecurity8988
expect taxableBase45000
expect irsTax11651.77
expect netIncome39360.23

Case 3 — 150,000 EUR revenue — Social Security stops at the base ceiling

given annualRevenue150000
expect ssBase77346.72
expect socialSecurity16552.2

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 Portugal regime simplificado calculator

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