Check a Spanish VAT number

Validate a VAT number from Spain against the EU's VIES service, here or from your own code.

Country prefixES
Local nameNIF-IVA (número de identificación fiscal)
FormatES followed by 9 characters: a letter or digit, 7 digits, a letter or digit
ShapeESX1234567X (an example of the shape, not a real registration)
Pattern^ES[A-Z0-9]\d{7}[A-Z0-9]$

Good to know about Spain

Check a Spanish VAT number now

VAT number with its 2-letter EU country prefix (give vat or name)

Uses one of your 3 free calls. Nothing is charged, and a call that fails is not counted.

How the check works

The check asks VIES, the European Commission's VAT Information Exchange System, which in turn asks the member state's own tax database. Valid means the number is registered for intra-EU trade at the moment of the check. Where the member state shares them, the answer also carries the registered name and address. Spaces, dots and hyphens in the number are ignored.

From your code

curl -H "Authorization: Bearer $API_KEY" \
  "https://agent-data-tools.revmesh2074.workers.dev/vat/validate?vat=ESX1234567X"

One GET request, JSON back: valid, and the registered name and address when they are shared. A failed check is never charged. Keys, monthly plans and code in Python and Node.js: Company check API. Reference: tool page.

Questions

What does a Spanish VAT number look like?

ES followed by 9 characters: a letter or digit, 7 digits, a letter or digit, for example ESX1234567X (an example of the shape, not a real registration). Locally it is called NIF-IVA (número de identificación fiscal).

How do I check that a Spanish VAT number is valid?

Enter it on this page, or send it to the API. The check asks VIES, the European Commission's VAT Information Exchange System, which in turn asks the member state's own tax database. Valid means the number is registered for intra-EU trade at the moment of the check.

Why would a real number come back as not valid?

The business may not be registered for intra-EU trade, the registration may have ended, or the number may be written with the wrong prefix or a missing digit. A member state's database can also be unavailable for a short time; the check then fails instead of answering not valid.

What is special about Spain?

Spain does not share the registered name and address through VIES: a check returns valid or not valid only.

Anything else to know about Spain?

A Spanish NIF is valid in VIES only when the business is entered in the register of intra-Community operators (ROI).

Other countries

Austria · Belgium · Bulgaria · Cyprus · Czech Republic · Germany · Denmark · Estonia · Greece · Finland · France · Croatia · Hungary · Ireland · Italy · Lithuania · Luxembourg · Latvia · Malta · Netherlands · Poland · Portugal · Romania · Sweden · Slovenia · Slovakia · Northern Ireland