Spain VAT number: format and validation
Format
ES followed by 9 characters: a letter or digit, then 7 digits, then a letter or digit. The local term is Numero de Identificacion Fiscal (IVA: Impuesto sobre el Valor Anadido) (NIF-IVA, Spanish).
Pattern: /^[A-Z0-9]\d{7}[A-Z0-9]$/
- Company NIFs open with a legal-form letter (A for sociedad anonima, B for sociedad limitada) and close with a control character
- A valid Spanish NIF returns invalid in VIES unless the business is enrolled in the ROI (Registro de Operadores Intracomunitarios)
- VIES returns no name and address for Spanish numbers (Spain withholds them), so a valid check gives no company data
Example of a registered number: ESA28015865
Check digit
Spain VAT numbers carry a check digit (Control character): For legal entities the final character is a check digit or letter derived from the seven middle digits under Spain's NIF composition rules (Orden EHA/451/2008).
Check a Spain VAT number
Checks route through VIES. Caching is enabled by default. Read the source, original result time and freshness label alongside validity; a cached or stale result does not freshly confirm current registration. VIES confirms validity for Spain numbers but does not disclose the company name or address, so company is null.
Enter a VAT number to see its registration result, source and freshness
Validate via API
The same validation as an API call, with the example number above:
curl "https://api.avatcado.com/v1/validate?vat_number=ESA28015865" \
-H "Authorization: Bearer avat_live_your_api_key"import Avatcado from "@avatcado/node";
const avatcado = new Avatcado("avat_live_your_api_key");
const { data, error } = await avatcado.vat.validate({
vatNumber: "ESA28015865",
});
if (data?.data.valid) {
console.log(`Registered: ${data.data.company?.name}`);
}Free tier includes 500 validations per month. Get an API key or read the API documentation.
How Avatcado validates Spain numbers
- Primary source: VIES.
- Company name and address: no, VIES discloses neither for Spain (observed 2026-09-04).
- When VIES is down: the most recent cached result, then a refunded 503.
See the full coverage table.
Frequently asked questions
Why does a real Spanish VAT number fail VIES validation?
Spain only feeds VIES with businesses enrolled in the ROI. A domestic-only company has a perfectly valid NIF but no NIF-IVA, so VIES reports it invalid; that means 'not registered for intra-EU trade', not 'fake number'.
Is a CIF different from a NIF?
No longer: the separate CIF for companies was folded into the NIF by Orden EHA/451/2008, though the old term is still common. The company format (letter + 7 digits + control character) survived the rename.
How does Avatcado validate Spain VAT numbers when VIES is down?
For Spain VAT numbers, uncached checks use VIES, the EU's VAT Information Exchange System, which routes the query to Spain's own national database. Caching is enabled by default without a requester VAT number. Read the freshness label and original result time to distinguish a new lookup from a previous result. VIES confirms validity for Spain numbers but does not disclose the company name or address, so company is null even for a valid number. That is a data choice made by Spain's own tax administration rather than a limitation of Avatcado's integration, and it matched what we observed on 2026-09-04. No national register is published for Spain that Avatcado can consult as a substitute, unlike the ten EU countries with a national fallback on Pro and Business, so an availability fault such as MS_UNAVAILABLE or a timeout can be answered only by eligible cache. A stored result has meta.cached: true and meta.source_status: "unavailable", plus meta.stale: true when it is past the cache window. Requester checks disable stored responses by default; cache=true opts back in. If no eligible stored result can answer, the request returns a refunded 503 (upstream_member_state_unavailable). A cached or stale result is earlier registration evidence, not a fresh check.
Related guides
- Validate EU VAT Numbers via API: Developer Guide
- VIES API Guide: REST Endpoint, SOAP & Integration
- EU VAT Reverse Charge: What Developers Need to Know
VAT rate in Spain
The standard VAT rate in Spain is 21%. Reduced rates: 10%, 4%. See all Spain VAT rates.
Sources
- ROI, VIES and NIF-IVA Agencia Tributaria, accessed August 13, 2026
- Orden EHA/451/2008 (NIF composition) Boletin Oficial del Estado, accessed August 13, 2026
- VIES VAT validation European Commission, accessed August 13, 2026