Generate a test Spain Número de Identidad de Extranjero
A Spanish NIE (foreigner ID) is a letter X, Y or Z, seven digits, and a control letter. The control letter follows the same modulo-23 rule as the DNI. These test values are synthetic but carry a valid control letter.
Synthetic NIE with a valid control letter. Not a real issued document.
Format specification
| Identifier | Número de Identidad de Extranjero (NIE) |
|---|---|
| Country | 🇪🇸 Spain |
| Format | A0000000-A |
| Length | 9 characters |
| Checksum | Mod 23 letter |
| Example | Z2913633-K |
| Safe strategy | Synthetic |
| Data quality | Verified against sources |
Validation regex
Matches the canonical value — strip separators and uppercase first: value.replace(/[^A-Za-z0-9]/g, '').toUpperCase()
^[XYZ]\d{7}[A-Z]$ References
Common questions
Will these pass my validation?
Yes — they are well-formed Número de Identidad de Extranjero values (A0000000-A) and pass standard format checks, including the Mod 23 letter checksum.
Could one belong to a real person?
These are synthetic values. They are format-valid but not drawn from a guaranteed reserved range, so use them only for testing.
Can I generate many at once?
Increase the count, or use the free API and CSV/JSON export for large datasets.