Generate test DNI / NIE numbers
Fictional numbers with correct check digits, for testing software. They may by chance match a real person's number, so never use them to identify or impersonate anyone.
Click a number to copy it.
How a DNI / NIE is structured
- DNI: 8 digits + 1 check letter.
- NIE: X, Y or Z + 7 digits + 1 check letter.
- The letter is determined by the number modulo 23.
How the check works
Using the published example 12345678Z:
Divide the number by 23 and look up the remainder: 12345678 mod 23 = 14, and position 14 in TRWAGMYFPDXBNJZSQVHLCKE (counting from 0) is Z. For a NIE, first replace X, Y or Z with 0, 1 or 2.
A passing check only means the number is well-formed; it doesn't prove the number was issued to anyone.
Frequently asked questions
Which letters are never used?
I, 脩, O and U are left out of the check letters to avoid confusion with similar-looking characters.
Is the DNI number the same as the NIF?
For Spanish citizens, yes: the NIF (tax number) is the DNI number with its letter.