Skip to content
Toolbrik

Spanish DNI/NIE Check Letter

Enter the 8 digits of a Spanish DNI and get the corresponding letter from the TRWAGMYFPDXBNJZSQVHLCKE table. Or enter a full NIE (X/Y/Z + 7 digits) and check whether its letter is valid.

DNI or NIE number

The letter is calculated by dividing the number by 23 and using the remainder against the official table (TRWAGMYFPDXBNJZSQVHLCKE). If you enter a DNI/NIE that already includes a letter, it's checked for correctness.

Letter result

Enter a DNI or NIE to calculate its letter.

How to use: DNI/NIE letter

  1. 1Type the Spanish DNI or NIE number without the letter.
  2. 2The tool computes the letter with the official algorithm.
  3. 3Copy the full document number with its letter.

What is it for?

  • Complete a DNI or NIE that is missing its letter.
  • Check whether a NIF entered in a form is correct.
  • Generate valid test data for applications.

The letter of the Spanish DNI/NIF

How it is calculated

The 8-digit number is divided by 23 and the remainder gives the letter in the sequence TRWAGMYFPDXBNJZSQVHLCKE. For example, remainder 0 corresponds to T.

NIE

In a foreigner's NIE the leading X, Y or Z is replaced by 0, 1 or 2 and the same calculation is applied.

Use

It helps catch typing errors in forms. It does not check that the document exists or belongs to anyone.

Related tools

Frequently asked questions

How does the letter table work?+

The number is divided by 23 and the remainder is used to pick the letter from the official table: TRWAGMYFPDXBNJZSQVHLCKE.

Was "DNI/NIE letter" useful?

Share it with whoever needs it. It's free and stores no data.