Spain National ID Validator
Verify Spanish DNI and NIE identification numbers instantly with format validation, modulus-23 check letter calculation, and a compliant random generator.
Enter a Spanish DNI or NIE number to check its format and check letter.
A Spanish DNI has eight digits plus a letter; an NIE starts with X, Y, or Z, followed by seven digits and a letter.
Output appears here...
Start by entering an ID
Type a Spanish DNI or NIE, or generate one to review the validation details.
Normalized ID—
Document typeUnknown type
Numeric base—
NIE prefix mapping—
Check letter—
Modulo result—
Quick rule summary
- Basic format: DNI numbers use eight digits plus a trailing letter. NIE numbers begin with X, Y, or Z, followed by seven digits and a check letter.
- Control letter: Convert the digits to a number, take modulo 23, and map 0-22 to TRWAGMYFPDXBNJZSQVHLCKE to obtain the letter.
- NIE prefixes: When computing the control letter, replace prefix X with 0, Y with 1, and Z with 2 before applying the modulo.
- Usage tips: The tool normalizes uppercase letters, removes spaces or hyphens, and highlights the check-letter calculation.
Disclaimer
- Do not enter real personal identification numbers; use sample data only.
- This tool is for educational reference and is not an official government service.
- Generated numbers must not be used for impersonation or unlawful activities.