{"inline_business":{"spain-dni-nie-letter-calculator":{"input_label":"DNI or NIE number","input_hint":"With or without the letter; spaces, dots and dashes are accepted. NIE: X, Y or Z followed by 7 digits.","result":"Control letter","kind_dni":"Recognised document: DNI / NIF of a Spanish individual.","kind_nie":"Recognised document: NIE (foreigner identity number).","valid":"The letter {{letter}} is correct.","invalid_letter":"Wrong letter: you entered {{given}}, the expected letter is {{expected}}.","computed_only":"No letter entered: this is the letter computed for this number.","step_nie":"NIE: the leading letter {{prefix}} is replaced by the digit {{digit}}.","step_mod":"{{number}} ÷ 23: remainder {{rest}}","step_letter":"Remainder {{rest}} → letter {{letter}} in the official table","table_title":"Remainder → letter table","err_empty":"Enter a number.","err_chars":"Format not recognised: a DNI has up to 8 digits and a letter; a NIE starts with X, Y or Z.","err_dni_length":"A DNI has at most 8 digits.","err_nie_length":"A NIE has exactly 7 digits after X, Y or Z.","note":"Only the letter is checked: a number with a correct letter is not necessarily assigned to anyone. Computed in your browser; nothing is sent."}},"docs_business":{"tools":{"spain-dni-nie-letter-calculator":{"content":{"title":"How the DNI and NIE letter is calculated in Spain","intro":"In Spain, the letter of a DNI is the remainder of the number divided by 23, turned into a letter with the table TRWAGMYFPDXBNJZSQVHLCKE. For a NIE, X is first replaced by 0, Y by 1 and Z by 2. Example: 12345678 leaves a remainder of 14, so the letter is Z.","details":"
The DNI number (8 digits) is divided by 23. The remainder, from 0 to 22, points to a letter in the official table: 0 = T, 1 = R, 2 = W, 3 = A … 14 = Z … 22 = E. The letters I, O, U and Ñ are never used so they cannot be confused with 1, 0, V and N. A foreigner's NIE (X, Y or Z plus 7 digits) follows the same calculation once the leading letter is replaced: X = 0, Y = 1, Z = 2.
It accepts input with or without the letter, spaces, dots or dashes, pads a short DNI with leading zeros and shows the normalised form. When you type a letter it tells you whether it is right and, if not, which letter was expected. It also says why an entry is rejected.
A correct letter only shows that the number is consistent; it does not prove the document exists. Company tax numbers follow a different rule and are not covered.
Sources and dates: Spanish Ministry of the Interior, “Cálculo del dígito de control del NIF/NIE”, which gives the 23-letter table and the X/Y/Z conversion; the number and its check letter are set by article 12 of Real Decreto 255/2025 of 1 April (checked on 15/10/2026).
"},"faqs":[{"question":"How do I find the letter of a Spanish DNI?","answer":"Divide the 8-digit number by 23 and keep the remainder. That remainder (0 to 22) maps to a letter of the sequence TRWAGMYFPDXBNJZSQVHLCKE: 0 = T, 14 = Z, 22 = E. For 12345678 the remainder is 14, so the letter is Z."},{"question":"How is the letter of a NIE starting with X, Y or Z calculated?","answer":"Replace X with 0, Y with 1 and Z with 2, then apply the same modulo 23 calculation to the resulting number. X1234567 becomes 01234567, whose remainder is 19, so the letter is L."},{"question":"Does a correct letter mean the DNI exists?","answer":"No. The letter only catches typing errors: about 1 invented number in 23 gets a correct letter by chance. Only the Spanish authorities can confirm that a DNI or NIE has been issued."}]}}}}