Calculate DNI letter
Online calculator for Spanish ID letter. Discover which letter corresponds to your ID number.
Your DNI letter
Enter your ID number
How is the DNI letter calculated?
The DNI letter is calculated using a simple mathematical algorithm: the ID number is divided by 23 and the remainder of that division indicates the position of the letter in a predefined table of 23 letters.
Official formula:
letra = "TRWAGMYFPDXBNJZSQVHLCKE"[numeroDNI % 23] Calculation example:
For ID 12345678:
12345678 % 23 = 14
Letter at position 14 = Z
Complete ID: 12345678-Z
ID letter table
What is the DNI letter?
The DNI letter is an alphabetic character assigned to each Spanish National Identity Document. It serves as a control digit to verify that the ID number is correct and avoid transcription errors.
How does the algorithm work?
The algorithm divides the ID number (8 digits) by 23. The remainder of that division (a number from 0 to 22) is used as an index in the letter string TRWAGMYFPDXBNJZSQVHLCKE. This string is officially defined by the Ministry of Interior.
- Official algorithm: uses Ministry of Interior formula
- Instant: calculates the letter in milliseconds
- 100% accurate: guaranteed exact result
- Complete table: visualize all 23 possible letters
- Free: online calculator available 24/7
- No registration: we don't save or store your ID
Frequently Asked Questions
How is the DNI letter calculated?
TRWAGMYFPDXBNJZSQVHLCKE.Why divide by 23?
What letters can a DNI have?
What is the purpose of the DNI letter?
What is the official formula?
letter = "TRWAGMYFPDXBNJZSQVHLCKE"[DNInumber % 23]. The % symbol represents the remainder of the division, also known as modulo.