NIE Validator
ValidatorValidate Spanish NIE numbers instantly. Checks the X/Y/Z prefix, 7 digits, and the Mod 23 control letter. Free, runs in your browser.
Looking for the Portuguese NIF instead?
This tool validates the Spanish NIE (foreigner ID). If you need to validate a Portuguese tax number, use our NIF Validator →
About this tool
About NIE Validator
This validator checks Spanish NIE (Número de Identificación de Extranjero) numbers using the official Mod 23 algorithm. Enter a 9-character NIE and the tool instantly determines whether the check letter is correct — no network request needed. If you enter a DNI-shaped number instead, the tool tells you and links to the dedicated DNI validator.
The validator expects a string starting with X, Y, or Z followed by 7 digits and a check letter. The prefix letter is converted to its numeric equivalent (X=0, Y=1, Z=2) before computing the modulus, using the same underlying algorithm as this site's DNI validator. The tool reports the prefix series, the 7-digit body, the check letter, and a clear error message when validation fails — including a distinct message when the input looks like a DNI rather than a NIE.
Use this validator to verify NIE numbers collected from users before processing them in your backend — property purchase forms, bank account opening, employment onboarding, or immigration paperwork — to debug why a NIE is failing validation in your system, or to manually check a document number for correctness.
Instant validation with no network requests — all computation runs locally in the browser. The validator handles spaces, hyphens, and mixed case, normalising the input before checking, and clearly distinguishes a wrong check letter from a DNI entered by mistake.
Key Features
- Validates Spanish NIE numbers (foreign nationals)
- Official Mod 23 check letter algorithm
- Detects DNI-shaped input and links to the DNI validator
- Normalises spaces, hyphens, and case
- Shows series, number body, and check letter
- Precise error messages for each failure mode
- 100% browser-based, no data sent
FAQ
NIE Validator — Frequently Asked Questions
How does the NIE check letter work?
The prefix letter is converted to a digit (X→0, Y→1, Z→2) and prepended to the 7-digit body to form an 8-digit number. That number is taken modulo 23, and the result indexes into the table 'TRWAGMYFPDXBNJZSQVHLCKE' to produce the check letter — the same algorithm and table used for the Spanish DNI.
Why does this tool say my input looks like a DNI?
If you enter 8 digits followed by a letter with no X, Y, or Z prefix, that's the DNI format, not NIE. This validator is scoped to NIE only and will point you to the dedicated DNI Validator instead of guessing which document you meant.
What does 'invalid check letter' mean?
It means the format is correct (X/Y/Z followed by 7 digits and a letter), but the last character does not match the expected Mod 23 result. This usually indicates a typo somewhere in the number, since any digit change shifts the expected check letter. Double-check that you entered the number exactly as printed on the document.
Can this validator confirm a NIE belongs to a real person?
No. This tool only validates the mathematical structure of the check letter. A number can be format-valid but not actually assigned to anyone. Confirming a NIE is genuinely issued requires access to official Spanish government records, which no public tool can provide.
Tips
- Hyphens and spaces are stripped automatically — enter the number with or without them
- Lowercase letters are accepted — the validator converts to uppercase before checking
- The NIE Generator tool on this site creates random, check-digit-valid NIEs for test data
- If your number starts with 8 digits instead of X/Y/Z, you likely have a DNI — use the DNI Validator
Explore more
Related Tools
Other tools that might be useful for your workflow