What are the DNI and the NIE?

The DNI (Documento Nacional de Identidad) is the Spanish identity number: 8 digits and a control letter. Foreigners get an NIE (Número de Identidad de Extranjero) instead: X, Y or Z, then 7 digits and a letter. Both also work as the tax number, the NIF.

The letter isn't random. Divide the 8 digit number by 23 and look the remainder up in TRWAGMYFPDXBNJZSQVHLCKE: 0 gives T, 1 gives R, 2 gives W and so on up to 22, which gives E. The letters I, Ñ, O and U are never used. For an NIE, first swap the leading letter for a digit, X for 0, Y for 1 and Z for 2, and then divide the 8 digits you get.

Tool description

Enter a DNI or NIE and the tool tells you which one it is, checks the control letter and shows the remainder the letter comes from. Spaces, dots, dashes and lowercase letters are fine.

Need the letter for a number? Type only the number, 8 digits for a DNI or X, Y or Z and 7 digits for an NIE, and the tool tells you which letter it takes and shows the full number. When the letter you typed is wrong, it shows the right one too.

The number is checked in your browser and never sent anywhere.

Features

  • Tells a DNI from an NIE
  • Checks the control letter and shows the remainder behind it
  • Works out the letter for a number typed without one