Spain DNI / NIE Validator
Check the control letter of a Spanish DNI (national ID) or NIE (foreigner ID) using the official modulo-23 algorithm. 100% local. Built for Spain.
Batch check — paste many, one per line
Validate a Spanish DNI or NIE
Enter a DNI (8 digits + letter) or NIE (X/Y/Z + 7 digits + letter) to verify its control letter. Everything runs locally in your browser.
Spain's DNI is 8 digits plus a control letter; the NIE (for foreign residents) swaps the first character for X, Y or Z. The control letter is pure math, defined in official regulations: the number modulo 23 indexes the sequence TRWAGMYFPDXBNJZSQVHLCKE. For NIE, replace X/Y/Z with 0/1/2 before computing. This tool recomputes the letter locally, tells you the expected letter when it mismatches, and normalizes formatting.
A correct control letter proves the string is well-formed — it does not prove the document exists or belongs to anyone. Identity documents are issued and verified by the Ministerio del Interior / Policía Nacional; when legal certainty matters, verify through official channels. Last verified: July 2026.
FAQ
How is the DNI letter computed?
Take the 8-digit number modulo 23 and read the letter at that position in TRWAGMYFPDXBNJZSQVHLCKE (position 0 = T). Example: 12345678 mod 23 = 14 → Z, so 12345678Z is valid.
How does NIE validation differ?
Replace the leading letter before the math: X→0, Y→1, Z→2, then treat it as a 9-digit number and apply the same mod-23 table. X1234567L, for instance, validates as 01234567 + letter.
Which letters can never appear as the control?
I, Ñ, O and U are excluded from the table to avoid confusion with 1, N, 0 and V. If a "DNI" ends in one of those, it is invalid on sight.
Is my number uploaded when I check it?
No — the check is one modulo operation running in your browser. Nothing is transmitted, logged or stored, which also makes batch-checking employee lists GDPR-friendlier; the lawful basis for processing remains your responsibility.