๐Ÿชช Spanish DNI / NIE Validator

Calculate the control letter of a Spanish DNI or NIF and instantly check whether an ID number is valid. Also supports NIE numbers (X, Y, Z) and special NIFs (K, L, M), with bulk validation.

Check a DNI / NIE
Examples:
Result
Bulk validation

Support TinyToolWeb

Help us keep these tools free and ad-free!

About the Spanish DNI / NIE Validator

Every Spanish DNI (Documento Nacional de Identidad) ends with a control letter calculated from its 8 digits. This tool calculates that letter instantly and tells you, as you type, whether a DNI, NIF or NIE is valid.

It is useful for anyone who needs to check Spanish identification numbers before entering them in a form, a contract, an invoice or a database โ€” and it shows the calculation step by step so you can verify it yourself.

Key Features

  • Letter calculation: type the 8 digits and get the control letter immediately.
  • Instant validation: type the full number with its letter and see right away if it is correct โ€” and which letter it should be if not.
  • NIE and special NIF support: foreign national numbers (X, Y, Z) and special NIFs (K, L, M) are handled too.
  • Bulk mode: paste a list of numbers and validate them all at once, then copy the results.
  • Tolerant input: spaces, dots and dashes are ignored, lowercase letters are accepted.

How the Control Letter Is Calculated

  • Step 1: take the 8-digit DNI number (for a NIE, replace X with 0, Y with 1, Z with 2).
  • Step 2: divide it by 23 and keep the remainder (a number from 0 to 22).
  • Step 3: look up the remainder in the table below to get the letter.

Example: 12345678 รท 23 leaves a remainder of 14, which corresponds to the letter Z โ†’ 12345678Z.

0T
1R
2W
3A
4G
5M
6Y
7F
8P
9D
10X
11B
12N
13J
14Z
15S
16Q
17V
18H
19L
20C
21K
22E

Common Use Cases

  • Checking a customer's or employee's DNI before issuing an invoice or a contract
  • Recovering a forgotten control letter from the 8 digits of an ID card
  • Cleaning a spreadsheet or CRM export containing Spanish ID numbers
  • Developers testing form validation for Spanish NIF / NIE fields

Tips & Best Practices

  • For Spanish citizens, the DNI number followed by its letter is also their NIF (tax ID).
  • The letters I, ร‘, O and U are never used as control letters, to avoid confusion with other characters.
  • A correct control letter proves the number is well formed, not that it has actually been issued to someone.
  • Company tax IDs (former CIF, e.g. B12345678) use a different algorithm and are not covered by this tool.

Privacy & Security

All calculations run locally in your browser. No ID number is sent to any server, stored or logged โ€” you can even use the tool offline once the page is loaded.