International · Spain
Spain DNI & NIE validator.
Check a Spanish DNI (8 digits and a letter) or NIE (X, Y or Z, 7 digits and a letter) against its check letter. Everything runs in your browser.
How it works: divide the number by 23; the remainder (0 to 22) picks the check letter from the table TRWAGMYFPDXBNJZSQVHLCKE. For an NIE, the leading X, Y or Z is first replaced by 0, 1 or 2.
Inputs
Result
Enter a DNI or NIE and press Check.
How the DNI and NIE check letter works
A DNI is eight digits followed by a check letter. An NIE (for foreign nationals) is the letter X, Y or Z, seven digits, and a check letter. The letter is not random: it is derived from the number by a modulo 23 calculation.
| Step | What happens |
|---|---|
| 1 | For an NIE, replace the leading X with 0, Y with 1 or Z with 2 to get an 8-digit number |
| 2 | Divide the 8-digit number by 23 and keep the remainder (0 to 22) |
| 3 | Read the remainder's position in TRWAGMYFPDXBNJZSQVHLCKE (T=0, R=1, W=2 … E=22) |
Worked example: 12345678 divided by 23 leaves 14, the 15th letter is Z, so the DNI is 12345678Z. For the NIE X1234567L, X becomes 0, giving 01234567; the remainder is 19 and the 20th letter is L.
K, L and M numbers are not checked
Agencia Tributaria also issues NIFs beginning K, L and M (Spanish minors under 14, Spaniards living abroad, and foreigners without an NIE). We could not confirm their check-letter algorithm against a primary source, so this tool does not validate them.
Checksum check only, not a registry lookup
A passing result means the letter is consistent with the number. It does not confirm the document exists or belongs to anyone.
Sources
Dirección General de Ordenación del Juego, Cálculo del dígito de control (modulo 23, letter table, X/Y/Z to 0/1/2, worked example 12345678Z). Agencia Tributaria, Composición del NIF, personas físicas (DNI, NIE, K, L, M formats).
Checksum only — not a police or tax registry lookup
This tool checks the modulo 23 check letter entirely in your browser. A checksum-valid result is not proof the number was ever issued. Nothing you type is transmitted, stored, or logged.