About the DNI & NIE Letter Calculator
Every Spanish DNI ends with a control letter calculated from its eight digits, and every NIE for foreign residents does the same with an X, Y or Z in front. Forms reject the number when the letter is wrong, so it is worth checking before you submit.
Type the digits to get the letter, or type the full DNI or NIE to check it. The tool uses the official method — the number modulo 23 picks a letter from TRWAGMYFPDXBNJZSQVHLCKE — and shows the calculation. Nothing you type leaves your device.
How to use the DNI & NIE Letter Calculator
- Type the 8 DNI digits, or X/Y/Z and 7 digits for a NIE.
- Read the control letter and the full number.
- Add the letter yourself to check a complete number.
Features
- DNI and NIE (X, Y, Z)
- Calculate or validate
- Calculation shown
- Works offline
Supported formats
- Plain text
Frequently asked questions
How is the DNI letter calculated?
Divide the 8-digit number by 23 and take the remainder (0–22). The remainder selects the letter from TRWAGMYFPDXBNJZSQVHLCKE. For a NIE, X, Y and Z are first replaced by 0, 1 and 2.
Are my numbers saved?
No. Calculations happen in your browser and nothing you enter is sent anywhere or stored.
Added · Last reviewed · Maintained by Sohail Khax · How we test tools