Spain VAT number format
A Spain VAT identification number is the prefix ES followed by 9 characters; the first, the last or both are letters; ESB58378431 is a well-formed example. The national check digit is public, so a mistyped number is caught before VIES is asked. Structure as published in the Commission’s VIES FAQ, consulted 2026-10-24.
Structure
Prefix ES, then 9 characters; the first, the last or both are letters. The regular expression the API applies to the part after the prefix is ^(?:[A-Z][0-9]{8}|[0-9]{8}[A-Z]|[A-Z][0-9]{7}[A-Z])$; letters are upper-cased and spaces, dots and dashes removed before the test.
| Country prefix | Structure | Example | Public check digit |
|---|---|---|---|
| ES | 9 characters; the first, the last or both are letters | ESB58378431 | yes, verified before VIES |
The check digit
Spain publishes the algorithm of its check digit, so an impossible number is refused before VIES is asked: the answer says structure.checksum: "failed", costs nothing and reaches no upstream. The same algorithms are implemented by the open libraries (jsvat, python-stdnum).
How to validate it
The structure says whether a string can be a Spain VAT number; only VIES says whether it is registered. The free check below asks VIES live and shows the registered name and address where Spain publishes them; the API does the same from your code.
curl "https://veriport.io/api/v1/vat/validate?number=ESB58378431"What a valid answer proves
That the number was registered for intra-EU trade at the moment of the check. Keep the date and, on paid tiers, the VIES consultation number: together they are the evidence a tax audit asks for when an intra-EU supply was zero-rated.
Questions
- How many digits does a Spain VAT number have?
- 9 characters; the first, the last or both are letters, after the two-letter prefix ES: ESB58378431 is an example.
- Is ESB58378431 a real VAT number?
- It is a well-formed example used in the documentation; whether it is registered today is VIES’s answer, not this page’s. Check it with the free tool.
Free: VIES asked live, the answer dated and sourced.
Check a VAT numberSources
- VIES — VAT Information Exchange System: FAQ and VAT number structures (Q11) — European Commission, DG TAXUD, consulted 2026-10-24
- VIES REST API — check-vat-number, check-status (technical information) — European Commission, DG TAXUD, consulted 2026-10-24