Spanish DNI validator: check if the letter is correct

A DNI (Spanish national ID number) is valid if its letter matches the remainder of dividing its 8 digits by 23, looked up in the table TRWAGMYFPDXBNJZSQVHLCKE. This DNI validator runs that calculation in your browser: it confirms that the format and letter are consistent, but does not check whether the DNI exists or who it belongs to.

Paste a DNI and we check whether the number and the letter match the official algorithm. We do not check whether the document actually exists.

Quick validator

Check whether a DNI, NIE, CIF, IBAN, card number, NSS or CCC has a valid format and check digit.

The validator checks format and check digits. It does not check whether the document or account exists. The value is never sent to any server or stored in the URL.

How it's calculated

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

Generated sample
14570577P

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

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

Frequently asked questions

How do I know if a DNI letter is correct?

Divide the 8 digits of the DNI by 23 and look up the remainder in the table TRWAGMYFPDXBNJZSQVHLCKE: if the resulting letter matches the one on the DNI, it is correct. The validator does this calculation automatically.

Does the DNI validator query a real database?

No. It only checks that the check letter matches the mod 23 calculation; it does not verify that the DNI exists or who it belongs to.

Is the DNI I enter stored or sent anywhere?

No. DNI validation runs in your browser and the value is never sent to any server.

Keep exploring

Need to validate another data type? Use the full validator.