Spain NIF-IVA validator

How the NIF-IVA format works

Format
ES + 1 alphanumeric character + 7 digits + 1 alphanumeric character
Example
ESX1234567X

Things to watch for

  • The first and last characters can be letters or digits depending on entity type
  • This tool checks the format only; no check-digit validation is performed
Regex for NIF-IVA
^ES[0-9A-Z][0-9]{7}[0-9A-Z]$

Spain’s VAT number, the NIF-IVA, has the most flexible shape in the EU: “ES”, then one character that can be a letter or a digit, then 7 digits, then another character that can again be a letter or a digit — for example ESX1234567X. That flexibility isn’t a loose spec; it reflects Spain running several taxpayer-ID systems (personal NIF/DNI, foreign-resident NIE, and company CIF) into a single VAT-number shape, where the leading and trailing characters signal entity type rather than following one fixed pattern.

That’s the detail worth remembering before assuming a Spanish VAT number is malformed: seeing a letter where you expected a digit, or vice versa, at either end isn’t necessarily wrong — it depends on whether the number belongs to an individual, a foreign resident, or a specific class of company. Rejecting a number purely because “it should be all digits” is a common but mistaken assumption with Spanish IDs.

Format check, in detail

This validator confirms the “ES” prefix, one alphanumeric character, 7 digits, and a final alphanumeric character — entirely in your browser, with no signup and nothing sent to a server. It’s a positional-shape check: it doesn’t compute whether the specific leading or trailing character is the correct control value for those 7 digits.

What this can’t tell you

A correctly shaped NIF-IVA doesn’t confirm an active VAT registration. Confirm current status through the EU’s VIES lookup or Spain’s Agencia Tributaria before relying on it commercially.

Scope: NIF-IVA format only — not control-character validation or registration status.

Content last reviewed 2026-07-07.

NIF-IVA FAQ

Why does a Spanish VAT number sometimes start with a letter and sometimes with a digit?

The leading character reflects entity type: companies typically get a letter indicating their legal form (for example a corporation versus a limited company), while Spanish individuals' NIF-IVA is built from their personal DNI, which is numeric at that position. Both are valid, just for different kinds of taxpayer.

What about the trailing character — is that also variable?

Yes, the final character can also be a letter or a digit depending on entity type and the control character calculated for that specific NIF or CIF. It isn't optional, but which kind of character it is depends on the taxpayer type.

Does this tool confirm the correct control letter or digit for a Spanish VAT number?

No — it confirms the overall shape (one alphanumeric character, 7 digits, one alphanumeric character) after 'ES'. It doesn't calculate whether the specific leading or trailing character is the mathematically correct one.

← More NIF-IVA validators