How to calculate the letter of the DNI, CIF or NIF: Formulas, Excel and webs

If you live in Spain and you are of legal age (and if you are a minor, in most cases, too) you will have a DNI that you will use for the rest of your life and that has a set of numbers and a letter at the end . Eight numbers and one letter. The letter is the check digit, an eight-digit verification system that allows you to check if you have entered the DNI correctly, for example, if you say it correctly. If you do not know it or have forgotten it, we can calculate the letter of the DNI .

The normal thing is that we know the letter of the DNI. Ours or that of the person who is under our guardianship , for example. We learn the eight digits and the final letter, which is still the easiest part of memorization. But you may have simply forgotten it, that you don’t remember it, that it is someone else’s DNI and you want to calculate it… If your classmate has told you to fill in the data for him, if your partner has told you to complete an authorization in his name but you can’t ask at the time what the letter was. In all these cases we can calculate the letter of the DNI with a series of tricks and simple processes.

calculate the letter of the DNI, CIF or NIF

The letter of the DNI, NIF or NIE is easily calculated from the numbers. “Article 11 of Royal Decree 1553/2005, of December 23, establishes that the National Identity Document will include the personal number of the DNI and verification character corresponding to the Tax Identification number”. The letter is nothing more than an eight-digit verification system. That is, it depends directly on the numbers that precede it. There are several ways in which we can calculate the letter of the DNI.

How to calculate it

There are several methods that allow us to calculate it. Applying a mathematical formula that we can do with any calculator is the most basic, but we can also use an Excel sheet or we can use a specific web page.

Applying a formula

In order to verify the DNI, we must follow a series of steps to know the control digit. We will only need a calculator or mental calculation, depending on what you are capable of doing…. We need to divide the complete number of our DNI by 23 without taking decimals, rounding the result. Once we have divided the complete number of the DNI, we use the rest of the division to calculate the letter. And this remainder will always be between the numbers 0 and 22.

Depending on the value obtained, as collected from the website of the Ministry of the Interior, we will be able to know which letter corresponds to our set of numbers by following a table provided by said ministry….

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

For example, if the ID number is 12345678, divided by 23 gives the remainder 14, therefore, the letter would be Z: 12345678Z.

Letra DNI

But there are exceptions. Keep in mind that, in the case of a NIE for a foreigner residing in Spain , it has a letter (X, Y or Z), seven numbers and a control digit. In this case, to do the calculation we will have to make the following substitution of letters for numbers:

  • X-0
  • AND – 1
  • Z–2

Using Excel to calculate it

In addition to the manual way, we can also easily know the letter of the DNI with a spreadsheet program such as Excel. Using the text function EXTRAE and the mathematical function RESIDUO, we can identify the letter of any identity document by following these steps:

  • Open Excel and enter the ID number in cell A1.
  • In cell B1, enter the RESIDUE function like this: =RESIDUE(A1,23). The result you should get is 14.
  • You can then check which letter the number 14 corresponds to in the table shown above, but you can also use the MID function to calculate it automatically.
  • So the full function you should see in cell B1 is as follows: =MID(”TRWAGMYFPDXBNJZSQVHLCK”;REMAID(A1;23)+1;1). You have to change » to quotation marks.

Although it can be a messy mess, all you have to do is copy this function and you will get the result. The only value that you will have to change if you want to calculate the letter of more documents is A1.

calcular-letra-dni-excel.jpg

Use specific websites

If you don’t want to have to calculate it manually, the easiest option to do it is to use a specific website that is capable of doing the calculations for you without having to do anything else. You will simply have to enter the corresponding website in the browser and write the figures to find out or calculate the letter of the DNI…

Through the web letterenif.com you will only have to enter the numbers of the national identity document you want and press the button so that the page calculates it automatically. Although the calculation is simple, it is better not to have any errors in important documents. That is why doing it through this website gives us the security that we are not going to make a mistake.

Letra CIF

In addition, other websites such as calculate-letter-dni.appspot.com follow the same system and we can enter the number in the box. Once you have filled it in, tap on the “Calculate ID letter” button to get the result. It is easy and very fast.

letra dni