How to use DNI and NIE letter calculator
- 01Type the numberDNI or NIE.
- 02See the letterOr whether it’s valid.
- 03CopyThe full DNI/NIE.

12345678 → Z.
The letter of a DNI or NIE is the remainder of the number divided by 23, looked up in an official table. This tool applies that rule and checks complete numbers.
Work out the control letter of a Spanish DNI or NIE, or check that a full DNI/NIF is correct. The letter comes from a simple official rule: divide the number by 23 and look up the remainder in a table. The tool runs in your browser and doesn’t look up anyone’s details.
How the letter is calculated
- Take the 8 digits of the DNI (add leading zeros if it has fewer).
- Divide by 23 and keep the remainder, a number from 0 to 22.
- Look up the remainder in the table T R W A G M Y F P D X B N J Z S Q V H L C K E: 0 is T, 1 is R, 2 is W and so on.
- Example: 12345678 ÷ 23 leaves 14, which is Z, so the full DNI is 12345678Z.
NIE numbers for foreign residents
An NIE starts with X, Y or Z followed by 7 digits. For the calculation the first letter becomes a digit (X = 0, Y = 1, Z = 2) and the same divide-by-23 rule gives the final letter. Example: X1234567 gives L, so the NIE is X1234567L.
What it can and can’t tell you
- It catches typing mistakes: if a digit is wrong, the letter no longer matches.
- It doesn’t prove that the DNI exists or belongs to anyone, and it doesn’t look anything up.
- Spaces, dots and dashes are ignored, so 12.345.678-Z works too.
At a glance
- Price
- Free. No sign-up, no watermark.
- Privacy
- Your text stays in your browser. Nothing is uploaded.
- Works in
- Chrome, Edge, Firefox and Safari, on phones and computers
Questions
Does this find out whose DNI it is?
No. It only checks that the letter matches the number. It doesn’t look anything up.
How does it work for an NIE?
The first letter X, Y or Z is replaced by 0, 1 or 2, and the same divide-by-23 rule gives the final letter.
Is my number sent anywhere?
No. The letter is worked out in your browser.
Is the DNI letter the same as the NIF letter?
Yes. For Spanish citizens the NIF is the DNI number with the same letter.
Why does a website reject my DNI?
Usually the letter doesn’t match a digit that was typed wrong. Check the number here; if it’s valid, the website may expect a specific format such as no dash.