NIE validator: verify the prefix and check letter

An NIE (Spain's foreigner identity number) is valid if, after replacing the X, Y or Z prefix with 0, 1 or 2, the resulting number divided by 23 leaves a remainder that matches its final letter in the table TRWAGMYFPDXBNJZSQVHLCKE. This NIE validator runs the calculation in your browser, without querying official records.

Paste an NIE and we check that the prefix and digits produce the given check letter, using the same calculation as the DNI.

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

X/Y/Z prefix (equivalent to 0/1/2) + 7 digits + check letter, same calculation as the DNI.

Generated sample
Y6870218V

The X/Y/Z prefix is replaced by 0/1/2 and the rest follows the same calculation as the DNI.

  1. 1
    Prefix → equivalent digit
    Y → 1
  2. 2
    Full number (prefix + 7 digits)
    16870218
  3. 3
    Remainder of number ÷ 23
    17
  4. 4
    Letter at the remainder's position
    V

Frequently asked questions

What does a valid NIE look like?

An X, Y or Z letter, followed by 7 digits and a check letter; for example, X1234567L. The validator accepts the NIE with or without hyphens and spaces.

Why is an NIE invalid if the prefix is correct?

Usually because the final letter does not match the remainder of dividing the number by 23 once the prefix is converted to 0, 1 or 2; this is often caused by a typo.

Does the NIE validator check with the Police or the Immigration Office?

No. It only checks the check letter algorithm; it does not verify that the NIE has been assigned to anyone.

Keep exploring

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