Spanish DNI generator online (with valid check letter)

A DNI generator creates Spanish national ID numbers (DNI): 8 digits plus a check letter from the official algorithm. The number is divided by 23 and the remainder points to a letter in the table TRWAGMYFPDXBNJZSQVHLCKE. DNIs generated by DataMockSeed are fake: they pass any form validation, but belong to no real person.

Each DNI is generated with 8 digits and the real check letter, calculated by dividing the number by 23. The data is fictitious: it does not belong to any real person.

5 generated examples
55619530XValid
72922884GValid
96675593SValid
32215522CValid
33418109YValid

How it's calculated

8 digits + check letter, computed from the remainder of dividing the number by 23.

Generated sample
55619530X

The check letter comes from the remainder of dividing the number by 23, looked up in a fixed table.

  1. 1
    Number (8 digits)
    55619530
  2. 2
    Remainder of number ÷ 23
    10
  3. 3
    Letter at the remainder's position (TRWAGMYFPDXBNJZSQVHLCKE)
    X

Frequently asked questions

Do the generated DNIs belong to real people?

No. The 8-digit number is random and the letter is calculated with the official algorithm, but the DNI is not linked to any real record held by Spain's National Police (Dirección General de la Policía).

How is the DNI letter calculated?

By dividing the 8-digit number by 23: the remainder (from 0 to 22) gives the position of the letter in the table TRWAGMYFPDXBNJZSQVHLCKE. For example, 12345678 divided by 23 leaves a remainder of 14, which corresponds to the letter Z.

Is it legal to use a generated DNI?

Yes, for software testing, test forms, demos and database seeds. Using a generated DNI for real-world paperwork, to impersonate someone or to deceive others is illegal.

Can I generate a DNI with a wrong letter to test error handling?

Yes. The full generator can force an invalid check letter so you can see how a validator reacts to an incorrect DNI.

Keep exploring

Looking for more data types? Try the full generator.