How the Portugal iuc calculator is verified
Inputs
| Input | Field | Type |
|---|---|---|
| Cilindrada (cm³) | cc | number |
| Emissões CO2 (g/km, WLTP) | co2 | number |
| Ano da 1ª matrícula | anoMatricula | number |
| Gasóleo | gasoleo | boolean |
| 100% elétrico (isento) | eletrico | boolean |
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 value | Field | Formula (JSONata) |
|---|---|---|
| Taxa de cilindrada | taxaCilindrada | ($c := cc; $round($c <= 1250 ? $const.cil1 : $c <= 1750 ? $const.cil2 : $c <= 2500 ? $const.cil3 : $const.cil4, 2)) |
| Taxa de CO2 | taxaCo2 | ($e := co2; $round($e <= 140 ? $const.co21 : $e <= 205 ? $const.co22 : $e <= 260 ? $const.co23 : $const.co24, 2)) |
| Coeficiente do ano | coeficiente | ($a := anoMatricula; $a <= 2007 ? 1.00 : $a = 2008 ? 1.05 : $a = 2009 ? 1.10 : 1.15) |
| Adicional de gasóleo | adicionalGasoleo | ($c := cc; $round(gasoleo ? ($c <= 1250 ? $const.ad1 : $c <= 1750 ? $const.ad2 : $c <= 2500 ? $const.ad3 : $const.ad4) : 0, 2)) |
| IUC anual | iuc | $round(eletrico ? 0 : (taxaCilindrada + taxaCo2) * coeficiente + adicionalGasoleo, 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.
| Constant | Value |
|---|---|
cil1 | 31.77 |
cil2 | 63.74 |
cil3 | 127.35 |
cil4 | 435.84 |
co21 | 65.15 |
co22 | 97.63 |
co23 | 212.04 |
co24 | 363.25 |
ad1 | 5.02 |
ad2 | 10.07 |
ad3 | 20.12 |
ad4 | 68.85 |
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 — C1 gasolina de 2019, 1.395 cm³, 109 g/km — o exemplo publicado
given cc | 1395 |
|---|---|
given co2 | 109 |
given anoMatricula | 2019 |
given gasoleo | no |
given eletrico | no |
expect taxaCilindrada | 63.74 |
expect taxaCo2 | 65.15 |
expect coeficiente | 1.15 |
expect adicionalGasoleo | 0 |
expect iuc | 148.22 |
Case 2 — C2 o mesmo carro em gasóleo — soma o adicional de 10,07 EUR
given cc | 1395 |
|---|---|
given co2 | 109 |
given anoMatricula | 2019 |
given gasoleo | yes |
given eletrico | no |
expect adicionalGasoleo | 10.07 |
expect iuc | 158.29 |
Case 3 — C3 100% elétrico — isento de IUC
given cc | 0 |
|---|---|
given co2 | 0 |
given anoMatricula | 2024 |
given gasoleo | no |
given eletrico | yes |
expect iuc | 0 |
Sources
- Código do IUC — Portal das Finanças · checked 2026-08-05
- Tabelas IUC 2026 — DECO PROteste · checked 2026-08-05
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 iuc calculator
Built with Valem — a live, verifiable calculator you can fork and embed.