Discover how the DNI letter is calculated: Step-by-step guide

Discover how the DNI letter is calculated: Step-by-step guide On a day-to-day basis, we rarely think about the handwriting of our National Identity Document (DNI) or how it is calculated. This character, which is often omitted when we are asked to provide it, is essential to guarantee the validity and originality of our DNI, helping to maintain security and prevent fraud. In this article, we are going to explore how this letter is calculated and we will see the steps you must follow to be able to calculate it yourself.

What is the DNI?

The DNI is a card that contains the most important data for granting Spanish citizenship and its format has evolved over the years in response to technological innovations. In its current form, it includes both visible elements, such as information that can be read on the card, and invisible elements, such as built-in security features to prevent counterfeiting.

Why is the letter of the DNI important?

La ID letter It is an essential security mechanism. This letter is the result of a mathematical operation that is carried out using the numbers on our DNI, which means that it is not assigned at random. The objective is to guarantee that, if any change is made to the DNI numbers, it can be detected immediately thanks to the fact that this letter would no longer match.

Calculation of the DNI letter

To calculate the letter of the DNI, you must follow a simple three-step process:

  • Take the complete number of your ID (without counting the letter)
  • Divide this number by 23
  • Use the remainder of this division to select the corresponding letter from a predefined table

It's worth noting that you'll always get a number between 0 and 22 after division, which means we need a 23-letter table to cover all possibilities.

Table for calculating the letter

The table used to calculate the DNI letter is the following:

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

Thus, if after dividing your DNI number by 23 you obtain a remainder of 4, your DNI letter would be "G".

Example of calculating the letter of the DNI

Suppose you have the DNI number 12345678. The steps to follow would be:

  • Divide 12345678 by 23, resulting in 536334.2608695652
  • Take just the decimal part and multiply it by 23: 0.2608695652 x 23 = 5.9999999976 (round to 6)
  • Finally, look for the number 6 in the predefined table, which corresponds to the letter “Y”. Therefore, the letter of your ID would be "Y"

It should be noted that calculating the letter of the DNI is an essential safeguard to prevent falsification, guarantee the authenticity of the DNI and keep your personal data safe.

Leave a comment