Home🇪🇸 SpainNúmero de Identidad de Extranjero

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 · not collision-guaranteed Validate a number →
Y0599267-Q

Synthetic NIE with a valid control letter. Not a real issued document.

Format specification

IdentifierNúmero de Identidad de Extranjero (NIE)
Country🇪🇸 Spain
FormatA0000000-A
Length9 characters
ChecksumMod 23 letter
ExampleZ2913633-K
Safe strategy Synthetic
Data qualityVerified 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

  1. en.wikipedia.org/wiki/National_identification_number#Spain

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.

Validate an existing number →

For software testing only. These numbers are synthetic and must never be used for real-world identification, applications, or to impersonate anyone.