calculator.onl
Categories50

Spanish DNI and NIE checksum validator

Check the control letter of an eight-digit DNI or an X/Y/Z plus seven-digit NIE, locally in the browser.

A worked example

Change only the last letter on the card. The eight digits still give the same check letter.

Structure checkStructurally validExpected letterZr = N mod 2314
DNI / NIE: 00000000A / X0000000A

Updates as you type

Use a dot or comma for decimals. No thousands separators.

YOUR RESULT

Structure check

Structurally valid

Calculated from your inputs

Expected letterZ
r = N mod 2314
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

For DNI, divide the eight-digit number by 23 and use the remainder as an index into the official control-letter sequence. For NIE, replace initial X/Y/Z with 0/1/2 first. Leading zeros are retained; letter case is normalized. For a related calculation, try Euclidean modulo calculator.

What to enter

InputWhat it meansExample value
DNI / NIEDNI / NIE: 00000000A / X0000000A12345678Z

How the calculation works

  1. Change the inputs to explore your own scenario. DNI / NIE: 00000000A / X0000000A.
  2. r=N mod 23; alphabet=TRWAGMYFPDXBNJZSQVHLCKE; NIE: X→0, Y→1, Z→2
  3. Supported format is eight digits plus a letter, or X/Y/Z plus seven digits and a letter. Checks syntax and control letter only, not issuance, identity or register status. Other NIF types and historical longer NIE formats are excluded. Identifier input is excluded from shared links.
The formular=N mod 23; alphabet=TRWAGMYFPDXBNJZSQVHLCKE; NIE: X→0, Y→1, Z→2

A worked example

Official Ministry example: 12345678 mod 23=14; table entry 14 is Z; 12345678Z passes the checksum. 12345678A does not.

Example you can load

What to enter
Result for this example · Structure checkStructurally valid

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

Supported format is eight digits plus a letter, or X/Y/Z plus seven digits and a letter. Checks syntax and control letter only, not issuance, identity or register status. Other NIF types and historical longer NIE formats are excluded. Identifier input is excluded from shared links.

Frequently asked questions

Does a passing result prove that the document exists?

No. A structural checksum test cannot confirm an issued identity document or its holder.

Which NIE prefixes are supported?

X, Y and Z followed by seven digits and the control letter. They are converted to 0, 1 and 2 for the remainder calculation.

Is my identifier included in a shared link?

No. This tool uses the existing local-only sharing policy and does not encode the identifier in a result URL.