The letter of the DNI, NIF or NIE is easily calculated from numbers and depends directly on the numbers that precede it. There are several ways to calculate it, including using a mathematical formula, Excel or specific websites. There are also exceptions, such as NIE for foreign residents. Using Excel to automate the process offers significant advantages, and specific websites can also calculate it. The format of the NIF for legal entities depends on the legal nature of the entity. It is not possible to change the letter on the DNI, as it is a personal and non-transferable document. Some practical tips are provided for calculating the letter. Additionally, there are some curiosities about the DNI.

The letter of the DNI, NIF or NIE is** easily calculated from numbers.** “Article 11 of Royal Decree 1553/2005, of December 23, establishes that the National Identity Document will include the personal DNI number and the verification nature corresponding to the Tax Identification number.” The letter is nothing more than a **verification system **of the eight digits. That is, it depends directly on the numbers that precede it. There are several ways with 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. Need **divide the complete number of our ID by 23** without taking decimals, rounding the result. Once we have divided the entire DNI number, we use the rest of the division to calculate the letter. And this remainder will always be between the numbers 0 and 22.

According to the value obtained, as collected from the Ministry of the Interior website, 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 DNI number is 12345678, divided by 23 gives the remainder 14, therefore, the letter would be Z: 12345678Z.

But there are exceptions. It must be taken into account that, in the case of a **NIE for a foreigner residing in Spain**, this has a letter (X, Y or Z), seven numbers and a check digit. In this case, to do the calculation we will have to do the following substitution of letters for numbers:

If it were a NIE, Y1234567, after converting the initial letter it would be: 11234567, which divided by 23 gives the remainder 10, which is equivalent to the letter X. The resulting NIF would be: Y1234567X. The X was used for NIEs assigned until 7/15/2008 and a Y for NIEs assigned later.

As we have seen in the previous table, **some letters have been removed** of the alphabet. Among them, some such as “I” or “O”, have been suppressed due to their similarity to the numbers 1 and 0. Also the letter “Ñ”, since there would be problems with computer systems around the world when to process the information. Furthermore, in this table we cannot find the letter U either. This is because, despite the fact that it does not look like any other symbol, and that it is a letter present in some of the most relevant languages at a global level, it is not included because, if we eliminate it, we have 23 letters left. And 23 is a prime number that becomes essential to give a value to our series of 8 numbers.

### Using Excel to calculate it

Yes, you won't believe it, but you can use an Excel spreadsheet to get the letter of a DNI. It is something very simple if you follow the following steps that we are going to tell you. All you need is to use the text function **EXTRACT** in addition to the mathematical function called **RESIDUE. **This is all you need to get started plus the following:

- Open Excel and enter the DNI number in cell A1.
- Enter the RESIDUE function in cell B1 like this: =RESIDUE(A1;23). The result you should get is 14.
- Next, you can check which letter the number 14 corresponds to in the table shown above, but you can also use the EXTRAE function to calculate it automatically.
- In this way, the complete function that you should see in cell B1 is the following: =EXTRAE(»TRWAGMYFPDXBNJZSQVHLCK»;RESIDUE(A1;23)+1;1). “We have to change” in quotes.

The best of all is that** You can copy the previous formula** to get the result directly in your own spreadsheet. The only value you should change is the one that appears in cell A1.

Using Excel to automate the process of calculating the letter of the DNI, CIF or NIF offers several significant advantages. By using specific formulas and functions in Excel, you can ensure you get** precise and accurate results** in the calculation of the letter. This avoids human errors that could occur when doing calculations manually.

**Automate the process** With Excel it allows you to save considerable time. Instead of manually calculating the letter for each ID number, you simply need to enter the corresponding numbers into the spreadsheet and the letter will be calculated automatically. This is especially useful if you have to process a large number of ID numbers.

### Use specific websites

If you don't want to have to calculate it manually, the easiest option to do so 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 letranif.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 **It gives us the security that we are not going to make mistakes.**

Furthermore, other websites such as calcular-letra-dni.appspot.com They follow the same system and we can enter the number in the box. Once you have filled it out, click on the button **“Calculate DNI letter”** to have the result. It's easy and very fast.

Another very similar to the previous two is calculardni.es. In just a few seconds we can verify the letter of the DNI or the letter of the NIF. We just have to enter the numbers and we will get the letter. It is also used to know the letter of the **NO**. You can use this application at any time to verify that the data provided is correct. In this way we will avoid defects in deeds, contracts or simply verify the correct NIE or DNI data.

### Depending on the NIF

The format of the NIF of the** legal persons and entities** In general, it consists of a letter depending on the legal nature of the entity, 7 numbers and a control code. The control code depends on the legal nature of the entity, so it will be a number or a letter. The initial letter depending on the legal nature of the entity can be:

- A: Corporations
- B: Limited liability companies
- C: Collective societies
- D: Limited partnerships
- E: Communities of goods
- F: Cooperative societies
- G: Associations and Foundations
- H: Communities of owners under horizontal property regime
- J: Civil companies, with or without legal personality
- N: Foreign entities
- Q: Local Corporations
- Q: Public organizations
- A: Congregations and religious institutions
- S: Bodies of the General Administration of the State and the autonomous communities
- U: Temporary Business Unions
- V: Other types not defined in the rest of the keys
- W: Permanent establishments of non-resident entities in Spain

### Change letter on the DNI

It is likely that we do not like the letter that we have received on our DNI, so some people wonder if we can change it. According to what we have analyzed previously, the letter is given from a mathematical calculation. So for the letter to be different, the number has to change too. Far from being a craving, there are people who want to change it for **legal or administrative problems**.

According to Decree 1553/2005, of December 23, it is established that the DNI is a personal and non-transferable document that **is not reassigned under any circumstances**. So we will have to put up with the lyrics we have been given for the rest of our days. It would not even be possible to change it, even if our identity is stolen or our ID is used fraudulently. To this end, anyone who uses this form would be committing a reportable crime.

## Practical tips

When calculating the letter it is important to take into account some practical tips to avoid common errors and ensure the accuracy of the results. Some useful tips are:

**Check identification numbers**: Before calculating the letter, make sure that the identification numbers you are using are correct and complete. An incorrect digit or number can lead to erroneous results in the calculation of the letter.**Use safe sources**: Make sure you get the formulas and calculation methods from reliable sources, such as official websites or well-known sources. Avoid using unverified formulas or methods, as they could generate erroneous results.**Check for exceptions or special cases**: When calculating the letter of the CIF or NIF, there are special cases in which different rules apply. For example, for certain entities or companies, the letters assigned may vary depending on their nature. Familiarize yourself with these exceptions and make sure you apply the correct rules in each case.**Use verification tools:**There are online tools and specialized software that can verify the validity of identification numbers and their corresponding letters. If you have doubts about the accuracy of your calculations, you can use these tools to validate the results.**Cross-check**: It is always advisable to cross-check to ensure that the results are consistent and correct. You can use different calculation methods or reliable sources to compare the results and confirm their accuracy.

By following these practical tips, you can avoid common errors and guarantee accuracy when calculating the letter of the DNI, CIF or NIF. Always remember to check and validate your results to ensure they are correct.

## Some curiosities about the DNI and its handwriting

The DNI with the number 1 (without letter), was issued on March 26, 1951. And contrary to what you might think, this was not the first DNI issued, but the one that belonged to Francisco Franco, and from which keep a copy. DNI number 2 belonged to his wife Carmen Polo, and number 3 to the couple's daughter, Carmen Franco.

It wouldn't be until **1990 when the first DNI with letter was issued**. With the rise of computer systems and the modernization of Public Administration management, it became necessary to implement this control letter that would serve to verify that the DNI number was correct, as we have already mentioned in previous paragraphs. . Only one year later, in 1991, the Spanish Documentation Unit was created, which was especially dedicated to solving problems derived from erroneous numbers.

These measures came as a solution to the large number of DNIs with errors that existed to date, since according to the Treasury, **In 1987, 30% of ID cards were wrong**derived from the lack of experience, means and implementation of a secure system that would avoid giving the same number to two different people.