VAT Espanhol
Valida formato NIF/CIF espanhol (ESXXXXXXXXX).
Resultado
—
Spanish VAT number (NIF-IVA / NIF / CIF): a letter that tells you what kind of taxpayer it is
Spain's VAT number is the NIF-IVA: the prefix ES followed by the 9-character NIF (Número de Identificación Fiscal). Unlike purely numeric VAT IDs, the Spanish NIF can start or end with a letter, and that letter encodes the taxpayer type. The general shape is character + 7 digits + character, where the first and/or last position may be a letter or a control digit.
There are three broad families:
- DNI/NIF for residents: 8 digits + 1 control letter, where the letter comes from
número mod 23mapped to the stringTRWAGMYFPDXBNJZSQVHLCKE. - NIE for foreigners: leading
X,YorZ(converted to 0/1/2) + 7 digits + control letter, same mod-23 table. - CIF for legal entities (the old company code, now folded into NIF): leading organization letter (
A= S.A.,B= S.L.,G= associations, etc.) + 7 digits + a control character that is a digit or a letter depending on the entity type.
What the leading letter means (CIF)
A— Sociedad Anónima (S.A.)B— Sociedad Limitada (S.L.)E— comunidad de bienes;F— cooperativaG— asociación/fundación;J— sociedad civilN— entidad extranjera;P/Q/S— public bodies
Common pitfalls
- Letter vs digit control: for some CIF organization types the control character is a letter (A–J), for others a digit — using the wrong one fails validation.
- Case sensitivity: NIF letters are uppercase; normalize before checking.
- Format ≠ registration: a structurally valid NIF still needs VIES (or the AEAT) to confirm it's an active VAT registration.
FAQ
Is the CIF still used? The CIF was officially merged into the NIF in 2008, but the term is still widely used for company tax IDs and the format lives on.
How is the DNI control letter computed? Take the 8-digit number mod 23 and look it up in TRWAGMYFPDXBNJZSQVHLCKE.
What's the difference between NIF and NIE? NIF is for Spanish nationals and entities; NIE is the foreigner's identification number (starts with X/Y/Z).
Related Tools
CPF Validator
Validate Brazilian CPF numbers instantly using the official algorithm. Useful for testing document validation in applications. No data sent to servers.
Batch CPF Validator
Validate a list of CPFs (one per line) and see which are valid and which are not. No data sent to servers.
Batch CNPJ Validator
Validate a list of CNPJs (one per line) with a summary of valid, invalid and total. No data sent to servers.