Spanish NIF / DNI letter calculator
Enter the digits of your Spanish DNI or NIE and get the check letter instantly. It also checks whether a complete document is valid. The calculation runs in your browser, with no data transmitted.
Accepts 8 digits (DNI) or a NIE starting with X, Y or Z. You can include the letter to check whether it is correct.
How is the DNI letter calculated?
The NIF letter is not random: it is obtained by dividing the DNI number by 23 and taking the remainder. That remainder (from 0 to 22) maps to a position in the official letter sequence TRWAGMYFPDXBNJZSQVHLCKE. That is why a number always has exactly one valid letter.
For a NIE, the leading letter is first replaced by a number (X→0, Y→1, Z→2) and then the same calculation is applied. This tool runs entirely in your browser, so no personal data is transmitted.