Spain DNI and NIE Letter Calculator
Work out the check letter of a Spanish DNI or NIE from its number, or verify that the letter on a Spanish ID is correct, with the mod-23 calculation shown.
How to use it
- 01
Type the DNI or NIE number, with or without the final letter. Dots, hyphens and spaces are fine.
- 02
If you type only the number, you get the letter that belongs to it.
- 03
If you add the letter too, the tool tells you whether it is right and, if not, which letter it should be.
How it works
The DNI letter is a check character: the number is divided by 23 and the remainder (0 to 22) picks a letter from the fixed sequence TRWAGMYFPDXBNJZSQVHLCKE. For 12345678 the remainder is 14, which is Z.
For the NIE issued to foreign residents, the leading letter is replaced by a digit before dividing: X becomes 0, Y becomes 1 and Z becomes 2. X1234567 is calculated as 01234567, giving the letter L.
The letter only catches typing mistakes, such as a wrong digit or two swapped digits. A matching letter does not prove that the document exists or who it belongs to; only the Spanish authorities can confirm that.
Examples
- Sample DNI
12345678 ÷ 23 leaves a remainder of 14, so the letter is Z: 12345678Z.
- NIE starting with Y
Y1234567 is calculated as 11234567, whose remainder is 10: the letter is X, so Y1234567X.
- NIE application forms
Many Spanish forms reject an NIE with the wrong letter. Checking it here first avoids a returned application.
Frequently asked questions
What is the difference between a DNI and an NIE?
The DNI is the national ID number of Spanish citizens. The NIE is the identification number given to foreigners who live, work or own property in Spain. Both end in a check letter calculated the same way.
Can this tool tell me who a DNI belongs to?
No. It only checks that the number is typed correctly. There is no database behind it and nothing is sent anywhere.
Is the NIF the same as the DNI?
For Spanish individuals, yes: the NIF (tax ID) is the DNI number plus its letter. Companies use a different format with other rules.
Related tools
- 14.06
IBAN Validator
Validators - 14.02
Chile RUT Validator and Check Digit Calculator
Validators - 14.03
Argentina CUIT and CUIL Validator
Validators - 14.04
Mexico RFC Validator
Validators - 14.05
Brazil CPF and CNPJ Validator
Validators - 01.01
Age Calculator
Calculators - 01.02
Percentage Calculator
Calculators - 02.01
VAT & Sales Tax Calculator
Finance