Home › 🇪🇸 Spain › Documento Nacional de Identidad

Generate a test Spain Documento Nacional de Identidad

A Spanish DNI/NIF is eight digits followed by a control letter, formatted 00000000-A. The letter is derived from the number modulo 23. These test values are synthetic but carry a valid control letter.

Synthetic · not collision-guaranteed Validate a number →
62707394-X

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

Format specification

IdentifierDocumento Nacional de Identidad (DNI / NIF)
Country🇪🇸 Spain
Format00000000-A
Length9 characters
ChecksumMod 23 letter
Example71003203-H
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()

^\d{8}[A-Z]$

References

  1. en.wikipedia.org/wiki/Documento_Nacional_de_Identidad_(Spain)

Common questions

Will these pass my validation?

Yes — they are well-formed Documento Nacional de Identidad values (00000000-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.