{
  "$comment": "Machine-readable companion to https://valem.run/calculators/spain/car-tax. Formula, inputs, outputs, engine-verified test vectors, cited sources and the re-runnable Valem ModelSpec behind the page.",
  "url": "https://valem.run/calculators/spain/car-tax",
  "dataUrl": "https://valem.run/calculators/spain/car-tax.json",
  "license": {
    "name": "CC BY 4.0",
    "url": "https://creativecommons.org/licenses/by/4.0/",
    "attribution": "Spain ivtm model by Valem (https://valem.run/calculators/spain/car-tax), CC BY 4.0.",
    "note": "Covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds themselves are law and are not licensed by anyone; the cited sources are where they come from."
  },
  "verificationUrl": "https://valem.run/calculators/spain/car-tax/verify",
  "country": "spain",
  "countryName": "Spain",
  "formula": "car-tax",
  "formulaName": "IVTM",
  "title": "Calculadora IVTM — Spain car tax",
  "answer": "Spain's IVTM is a municipal tax: a state base amount set by fiscal horsepower, multiplied by your town's coefficient of up to two.",
  "lang": "en",
  "currency": "EUR",
  "taxYear": "2026",
  "verification": {
    "claim": "internal-consistency",
    "statement": "The Valem engine reproduces this model's stated formula through 3 self-test cases (below, and re-runnable against the spec). That asserts internal consistency, NOT that the formula matches current law — the cited sources are the evidence for that, and carry the date each was last checked.",
    "selfTestCases": 3,
    "ratesAreIllustrative": false,
    "sourcesCheckedOn": "2026-08-02"
  },
  "sources": [
    {
      "label": "TRLRHL art. 95 — BOE",
      "url": "https://www.boe.es/buscar/act.php?id=BOE-A-2004-4214",
      "checked": "2026-08-02"
    }
  ],
  "terminalOutput": "ivtm",
  "inputs": [
    {
      "name": "fiscalCV",
      "type": "number",
      "label": "Potencia fiscal (CV)",
      "minimum": 0
    },
    {
      "name": "coefBand",
      "type": "string",
      "label": "Coeficiente municipal"
    },
    {
      "name": "customCoefficient",
      "type": "number",
      "label": "Coeficiente si « Otro » (entre 1,00 y 2,00)",
      "minimum": 1,
      "maximum": 2
    }
  ],
  "outputs": [
    {
      "name": "coefficient",
      "type": "number",
      "label": "Coeficiente aplicado",
      "formula": "($s := coefBand; $s = 'min' ? $const.coefMin : $s = 'medio' ? $const.coefMedio : $s = 'max' ? $const.coefMax : customCoefficient)"
    },
    {
      "name": "baseRate",
      "type": "number",
      "label": "Cuota base estatal",
      "format": "currency",
      "formula": "($c := fiscalCV; $c < 8 ? 12.62 : $c < 12 ? 34.08 : $c < 16 ? 71.94 : $c < 20 ? 89.61 : 112.00)"
    },
    {
      "name": "ivtm",
      "type": "number",
      "label": "IVTM anual",
      "format": "currency",
      "formula": "$round(baseRate * coefficient, 2)"
    }
  ],
  "testCases": [
    {
      "description": "C1 9 CV, coefficient 2 (Madrid)",
      "given": {
        "fiscalCV": 9,
        "coefBand": "max"
      },
      "expect": {
        "baseRate": 34.08,
        "ivtm": 68.16
      }
    },
    {
      "description": "C2 16 CV, coefficient 2",
      "given": {
        "fiscalCV": 16,
        "coefBand": "max"
      },
      "expect": {
        "baseRate": 89.61,
        "ivtm": 179.22
      }
    },
    {
      "description": "C3 9 CV en un municipio con el coeficiente mínimo — la mitad del IVTM",
      "given": {
        "fiscalCV": 9,
        "coefBand": "min"
      },
      "expect": {
        "coefficient": 1,
        "ivtm": 34.08
      }
    }
  ],
  "spec": {
    "id": "car-tax-spain",
    "version": "1.0.0",
    "schema": {
      "type": "object",
      "properties": {
        "fiscalCV": {
          "type": "number",
          "minimum": 0
        },
        "coefBand": {
          "type": "string"
        },
        "customCoefficient": {
          "type": "number",
          "minimum": 1,
          "maximum": 2
        },
        "coefficient": {
          "type": "number",
          "readOnly": true
        },
        "baseRate": {
          "type": "number",
          "readOnly": true
        },
        "ivtm": {
          "type": "number",
          "readOnly": true
        }
      }
    },
    "constants": {
      "coefMin": 1,
      "coefMedio": 1.5,
      "coefMax": 2
    },
    "defaultValues": [
      {
        "path": "$",
        "expr": "{'fiscalCV': 9, 'coefBand': 'max', 'customCoefficient': 2}"
      }
    ],
    "derivations": [
      {
        "path": "$.coefficient",
        "expr": "($s := coefBand; $s = 'min' ? $const.coefMin : $s = 'medio' ? $const.coefMedio : $s = 'max' ? $const.coefMax : customCoefficient)"
      },
      {
        "path": "$.baseRate",
        "expr": "($c := fiscalCV; $c < 8 ? 12.62 : $c < 12 ? 34.08 : $c < 16 ? 71.94 : $c < 20 ? 89.61 : 112.00)"
      },
      {
        "path": "$.ivtm",
        "expr": "$round(baseRate * coefficient, 2)"
      }
    ],
    "constraints": [],
    "metaDerivations": [],
    "viewDefinition": {
      "renderer": "builtin",
      "defaultView": "main",
      "views": [
        {
          "id": "main",
          "label": "IVTM",
          "layout": "vertical",
          "components": [
            {
              "id": "cv",
              "type": "numericField",
              "label": "Potencia fiscal (CV)",
              "bind": "$.fiscalCV"
            },
            {
              "id": "coefBand",
              "type": "selectField",
              "label": "Coeficiente municipal",
              "bind": "$.coefBand",
              "helperText": "Cada ayuntamiento fija su coeficiente entre 1,00 y 2,00 sobre la cuota estatal. Consúltalo en la ordenanza fiscal de tu municipio.",
              "options": [
                {
                  "value": "min",
                  "label": "Coeficiente mínimo estatal — 1,00"
                },
                {
                  "value": "medio",
                  "label": "Coeficiente intermedio — 1,50"
                },
                {
                  "value": "max",
                  "label": "Coeficiente máximo legal — 2,00 (Madrid, Barcelona y otras grandes ciudades)"
                },
                {
                  "value": "otro",
                  "label": "Otro — introducir el coeficiente de mi ayuntamiento"
                }
              ]
            },
            {
              "id": "coef",
              "type": "numericField",
              "label": "Coeficiente si « Otro » (entre 1,00 y 2,00)",
              "bind": "$.customCoefficient"
            },
            {
              "id": "tiles",
              "type": "group",
              "layout": "horizontal",
              "components": [
                {
                  "id": "ivtmTile",
                  "type": "statTile",
                  "label": "IVTM anual",
                  "bind": "$.ivtm",
                  "format": "currency",
                  "currency": "EUR"
                }
              ]
            },
            {
              "id": "breakdown",
              "type": "keyValueList",
              "label": "Desglose",
              "items": [
                {
                  "label": "Coeficiente aplicado",
                  "bind": "$.coefficient"
                },
                {
                  "label": "Cuota base estatal",
                  "bind": "$.baseRate",
                  "format": "currency",
                  "currency": "EUR"
                },
                {
                  "label": "IVTM (base x coeficiente)",
                  "bind": "$.ivtm",
                  "format": "currency",
                  "currency": "EUR"
                }
              ]
            },
            {
              "id": "note",
              "type": "staticText",
              "text": "'España IVTM: cuota base estatal por caballos fiscales, multiplicada por el coeficiente del municipio (hasta x2). Descuentos habituales para vehículos ecológicos. Estimación, no es asesoramiento fiscal. La Ley de Haciendas Locales fija las cuotas mínimas estatales y permite a cada ayuntamiento multiplicarlas por un coeficiente de hasta 2,00, así que el mismo coche paga hasta el doble según el municipio.'"
            },
            {
              "id": "sources",
              "type": "sourceList",
              "label": "Fuentes",
              "items": [
                {
                  "label": "TRLRHL art. 95 — BOE",
                  "url": "https://www.boe.es/buscar/act.php?id=BOE-A-2004-4214",
                  "date": "2026-08-02"
                }
              ]
            }
          ]
        }
      ]
    },
    "tests": [
      {
        "description": "C1 9 CV, coefficient 2 (Madrid)",
        "given": {
          "$.fiscalCV": 9,
          "$.coefBand": "max"
        },
        "expect": {
          "$.baseRate": 34.08,
          "$.ivtm": 68.16
        }
      },
      {
        "description": "C2 16 CV, coefficient 2",
        "given": {
          "$.fiscalCV": 16,
          "$.coefBand": "max"
        },
        "expect": {
          "$.baseRate": 89.61,
          "$.ivtm": 179.22
        }
      },
      {
        "description": "C3 9 CV en un municipio con el coeficiente mínimo — la mitad del IVTM",
        "given": {
          "$.fiscalCV": 9,
          "$.coefBand": "min"
        },
        "expect": {
          "$.coefficient": 1,
          "$.ivtm": 34.08
        }
      }
    ]
  }
}
