Skip to content

Spanish DNI and NIE letter calculator

Work out the control letter of a Spanish DNI or NIE, or check whether the letter you have is correct. In your browser, nothing stored.

AvailableIn your browserInput: Text

How to use: Spanish DNI and NIE letter calculator

  1. Type the 8 digits of the DNI, or the X, Y or Z plus the 7 digits of the NIE.
  2. See the matching letter and the full number.
  3. If you also type the letter, it tells you whether it matches the number.

What it accepts and what you get

Input
A DNI number (8 digits) or NIE number (X, Y or Z + 7 digits), with or without the letter.
Output
The control letter, the full number and, if you typed the letter, whether it is correct.
Where your data is processed
Your data is processed in your browser and is not sent to our servers.

Limitations and notes

  • It uses the official formula: the number (with X=0, Y=1, Z=2 for NIEs) divided by 23 gives the remainder that picks the letter.
  • It only checks that the number-letter pair is consistent. It does not confirm the document exists, is valid or belongs to anyone.
  • K, L, M letters and company CIFs are not supported. No random numbers are generated either.

Frequently asked questions

Is the number I type stored?

No. It is calculated in your browser and neither sent nor stored.

Can I use it to check a DNI is real?

No: it only catches a mistyped letter. An invented number with the right letter would also pass.

When to use it

  • When filling in a form and unsure about the letter.
  • To spot a wrongly copied letter in a data list.
  • To understand how the letter is calculated.

Examples

12345678
The letter is Z, so it becomes 12345678Z.
X1234567
The X counts as 0, and the letter turns out to be L.

Common mistakes

  • Believing a matching pair proves the document is real.
  • Forgetting the leading zero on short numbers.
  • Using the calculator with company CIFs.