HHelpje

Spanish DNI / NIE Validator

Check a Spanish DNI, NIE or NIF number (control letter).

Enter a DNI, NIE or NIF (CIF) number to validate it.

DNI / NIE / NIF validator — check a Spanish ID number online

Our free DNI, NIE and NIF (CIF) validator lets you instantly verify any Spanish identification number. The tool automatically recognises the document type: 8 digits means DNI, starting with X, Y or Z means NIE, and starting with an organisation letter means NIF. Spaces and hyphens are ignored.

DNI (Documento Nacional de Identidad) is issued to Spanish citizens and serves as the primary identity document. NIE (Numero de Identidad de Extranjero) is the equivalent for foreigners residing or working in Spain. NIF (formerly CIF) is the tax number for legal entities: companies, foundations, associations and other organisations.

If you enter only 8 digits (without a letter), the validator calculates and displays the correct check letter — useful when filling in a form and you only have the numeric part.

Check letter algorithm

For DNI and NIE, the numeric part (8 digits for DNI; for NIE: prefix digit + 7 digits) is divided by 23. The remainder (0-22) points to a letter in the table "TRWAGMYFPDXBNJZSQVHLCKE". For NIF the algorithm is more elaborate: odd positions are multiplied by 2 (with digit-summing of the result), even positions added directly, and the control digit is (10 - sum%10)%10. Some organisation types require a letter check character instead of a digit.

Full privacy — local processing

Validation takes place entirely in your browser. Not a single character you type reaches any server. You can use the validator offline too.

Frequently asked questions

What is DNI?
DNI (Documento Nacional de Identidad) is the Spanish national identity number. It consists of 8 digits followed by one check letter. It is issued to Spanish citizens and serves as the primary identification document.
How does NIE differ from DNI?
NIE (Numero de Identidad de Extranjero) is the identification number for foreigners in Spain. It starts with the letter X, Y or Z, followed by 7 digits and a check letter. The algorithm for calculating the check letter is identical to DNI — the prefix X/Y/Z is replaced with the digit 0/1/2.
What is NIF (CIF)?
NIF (Numero de Identificacion Fiscal) for legal entities corresponds to the former CIF (Codigo de Identificacion Fiscal). It consists of a letter identifying the type of organisation (e.g. A = public limited company, B = private limited company), 7 digits and a check character, which can be a digit or a letter depending on the organisation type.
How is the DNI check letter calculated?
The 8-digit number is divided by 23 and the remainder is taken. The result (0-22) is used as an index into the string "TRWAGMYFPDXBNJZSQVHLCKE". For example, for number 12345678: 12345678 mod 23 = 14, giving the letter "Z". The algorithm uses no weighting — only the remainder from division matters.
Is my data sent to a server?
No. All validation takes place locally in your browser. Not a single character you type reaches any server. You can use the validator even without an internet connection.

See also