Skip to content
Step by Step Internet 🌐 Guides for learning to surf the Net
Web

How to calculate the letter of the electronic DNI and what is the DNIe for? Step by step guide

How to calculate the letter of the electronic DNI and what is the DNIe for? Step by step guide

One of the most useful documents we have is the electronic ID or DNI-E, which is a digital version of the classic National Identity Document . However, many people do not have much idea of ​​how to use it and what advantages it has in taking the time to take it out since they think that it is something that only businessmen and related people need. But they can’t be further from the truth.

One of the most important elements of this document is the letter , which is an alphabetic value that is located just at the end of the identification number. This is used as a verifier to ensure that the number before it is true and correct, so it is not placed at random. There are several ways to get this letter, which is determined by an algorithm in which the numerical value is divided by 23 and the result is replaced by a letter.

This is something that the authorities do when printing the document in physical form, but how is it done with the digital version? That is what you will learn in this tutorial where we will teach you how to get the letter of the Electronic ID and we will educate you to know what this document is and why it is important that you have it and take advantage of all the benefits that come with him.

What is the electronic ID and what advantages does it offer in Spain ?

partes DNI electrónico

The DNI-E is the electronic version of the well-known National Identity Document that allows you to verify your identity when performing processes on the internet. In a way it works like a digital signature that allows you to carry out legal procedures with national organizations such as Finance or Social Security , so you don’t have to move from the comfort of your home and wait hours sitting in an office.

The advantages of this identification document are many since financial institutions can check your data, which facilitates the exchange of information. One of the benefits of this technology is that you can access your Bank account remotely, using as your identification element your digital trail represented in your thumbprint.

This tool also makes it easier for you to sign documents in PDF or Microsoft Word formats. When using it, everyone knows that you were the person who did the process . With this, I want to tell you, that the DNI, guarantees your identity at all times, decreasing the risks of fraud and promotes the use of electronic means, since technology is practically impenetrable.

To use this technology, you must install a program on your computer, which was developed for the Windows, MacOS and Linux operating systems. If by chance your platform is that of the “manzanita” or that of the “penguin” you must use an OpenDNIe application, to make it work, but in general it is very easy to use on all platforms. If you want to activate or renew the Electronic ID click here.

Steps to check and calculate the letter of the DNI (National Document of Identity) of a person

Calculate the letter of the DNI-E is one of the easiest things to do, as we said before, all you have to do is divide your identification number and as the rest is attributed to you a letter.

These letters vary and are not in alphabetical order, but you can find out using this table below:

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

And what about foreigners? Those expatriates residing in Spain have a NIF that consists of a letter that can be X, Y or Z, a 7-digit number and a control code The latter is determined in the same way as the letter of the DNI; dividing it by 23 and according to the result a unique code is determined .

Online Tools

With this program, you can calculate the letter of the DNI (National Identity Document) or the letter of the NIF (Tax Identification Number). Then, do the following:

  • Enter this website .
  • This information appears on the screen:

Calcular-DNI-herramientas-online

  • Write your DNI / NIF in the box and click on « Calculate letter «.
  • Then you throw your ID with your respective letter That’s it.

The other online tools are similar in operation, we leave the URLs for you to visit and perform the calculation in which you think best.

  • Notin.es/utilidades/calcular-letra-dni
  • Gabilos.com/textocalculadoranif.htm
  • Calculate.site/letra-dni

Excel Calculation Sheet

The Excel Spreadsheet , from Microsoft Office, offers many functions, and it has one that facilitates the calculation of the DNI / NIF.

The procedure is as follows :

  • It all starts in function module 23 , which serves as an integer.
  • This one gets like the rest; when performing the entire division of the DNI by the number 23.
  • When you use this Excel function, the result will range between values ​​0 and 22.

The number 14 observed on the screen is said result in this case, then you must place the letters in the following order: TRWAGMYFPDXBNJZSQVHLCKE.

But … Why is this order followed and not all the letters of the alphabet?

modulo23

  • The reason is that the letters I, O, Ñ and U were not incorporated. The first two is to avoid mistakes and confusion so that they are not interpreted as numbers 1 and 0 . In the case of the letter Ñ it was not used because it does not work with them in the other countries of Europe, and in that of the letter U to avoid being compared with the V.
  • Being 14 the result of the previous division begins the process of counting spaces, for example for the DNI “ 12345678 ” its letter is Z.
  • You must start counting from 0, and not from 1 and as a result you will have the correct order, which is Z, the fourteenth letter of the order we gave you previously.
  • I invite you to do this example with the online tools shown above and check the result.

To apply all this in Excel you must do the following:

  • You must open the Excel sheet, to enter the formula.
  • Then you place yourself in the cells and create a DNI list column and next to the numbers column, you create another for the result with the letter.

listado_DNI

  • Then you will calculate the letter with this formula, remember you should only use module 23 + the order of the letters.
  • What would leave you something like this:
  • EXTRAE («TRWAGMYFPDXBNJZSQVHLCKE»; WASTE (A2; 23) +1; 1)
  • What translated into Spanish means: “ When performing the calculation the remainder of the entire division of cell A2 by 23, and when adding one, and must indicate the letter assigned to the DNI ”.

Thanks to the functionalities of Excel functions, which has among its rows the Residue , directly calculates the rest of the entire division of the DNI / 23. Then keep in mind the +1, this is because Excel always starts from 1 and not from scratch.

It would look as you see it in the following image:

DNI-Letra

  • Excel will allow you to concatenate the DNI and the letter, in a few words, you will join the numbers with the letter.
  • What you should do is write the following formula:
  • = CONCATENATE (A2; EXTRAE («TRWAGMYFPDXBNJZSQVHLCKE»; RESIDUE (A2; 23) +1; 1))

That will make everything show as follows:

concatenar

Through a Mathematical Algorithm

To perform this procedure, you should have knowledge of algorithm and programming, in addition to having a development environment software such as Eclipse and Java Runtime Environment (JRE, Java Runtime) that allows you to perform the coding . But calm, I will give you the codes already made. What I want is for you to have ideas on how to perform the DNI / NFI calculation using another method.

  • You must keep in mind what you learned in Excel. As for the procedure of using the formula. I remind you: “When calculating the rest of the entire division of cell A2 by 23, and adding one, and must indicate the letter assigned to the DNI” or what is the same; EXTRAE( prevaTRWAGMYFPDXBNJZSQVHLCKE benefits;RESIDUO(A2;23)+1;1)
  • View the DNI letter table , this is what goes make the algorithm, when executing the program.

letra-dni

  • Proceed to the coding in JAVA language . The algorithm will perform what the excel function did; calculate module 23 to your ID number.
  • Then to get the letter: To do that, execute a String that will belong to the letters in order, so with a charAt ( module) you can calculate the letter corresponding to the indicated position. Now I show you the java code that implements the calculation:

Compilar_conEcplipse1

Remember to do this, you must have programming knowledge . You can go to a computer institute or academy and tell a qualified computer scientist to execute the code. The result will be to list the DNI with its respective letter.