Spain / Documents

DNI and NIE Validator

Check the letter of a Spanish DNI or NIE: the number's remainder modulo 23 gives the letter, and the tool shows the right one if it does not match.

DNI and NIE Validator: A DNI is eight digits and a letter; the letter is the number's remainder after dividing by 23, looked up in the table TRWAGMYFPDXBNJZSQVHLCKE. An NIE, for foreign residents, starts with X, Y, or Z, which count as 0, 1, and 2 in front of its seven digits, and ends with a letter worked out the same way. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
DNI and NIE validatorLocal processing

Runs entirely in your browser

The letter is the number's remainder after dividing by 23, looked up in the table TRWAGMYFPDXBNJZSQVHLCKE; for an NIE, X, Y, and Z count as 0, 1, and 2. Only the letter is verified, on this device.

Working out the letter by hand

Divide the eight digits by 23 and take the remainder: 12345678 ÷ 23 leaves 14, and position 14 of TRWAGMYFPDXBNJZSQVHLCKE, counting from 0, is Z. For an NIE starting with Y, put 1 in front of the seven digits and do the same.

For Brazilian CPF and CNPJ numbers, use the CPF and CNPJ validator.

Why I, Ñ, O, and U are missing

The table leaves out letters that are easily confused with digits or with each other, such as I and O, so a misread letter is less likely to look valid.

How to use it

  1. Paste one or more DNI or NIE numbers, one per line.
  2. Each is checked for its format and letter.
  3. Where the letter is wrong, the correct one is shown.

Privacy & limitations

Numbers are checked in your browser and never sent anywhere.

Related tools

Frequently asked questions

Does a correct letter mean the DNI is real?

No: it only means the letter matches the number. Only the police or the issuing authority can confirm a document.

What is the difference between a DNI and an NIE?

The DNI is the identity document of Spanish citizens; the NIE is the identification number for foreigners in Spain. Both use the same letter calculation.

What about the NIF?

For people, the NIF is the DNI or the NIE number itself; companies have a different NIF (formerly CIF) with another check.

Free tool · runs in your browser · no account required