Datatypes

Spanish national identity document number (DNI)

ID es_dni

DatatypePersonal data (PII)identifierDraft

This record is a draft: it has not been reviewed yet and may be incomplete or wrong. Do not rely on it for compliance decisions. Help improve it (see CONTRIBUTING.md).

Documento Nacional de Identidad, the identity number of Spanish citizens: eight digits and a check letter, which is the number modulo 23 looked up in TRWAGMYFPDXBNJZSQVHLCKE. The same value is the person's tax number (NIF). Foreigners receive an NIE instead.

Parent datatype
Spanish Tax identification number esnif
Categories
Personally identifiable information, Person related
Countries
Spain
Languages
Spanish
W3C DPV
pd:OfficialID
Google DLP
SPAIN_DNI_NUMBER
Microsoft Purview
Spain DNI, EU national identification number
python-stdnum
stdnum.es.dni
Check digit
es_dni
Quality
100/100
Metacrafter rules
no detection rule yet
Supported by tools
Amazon Macie, AWS Glue Sensitive Data Detection, Azure AI Language PII detection, Databricks Unity Catalog data classification, DataPrep, Google Cloud Sensitive Data Protection (DLP), IBM Security Guardium Analyzer, Microsoft Purview Data Loss Prevention, Nightfall AI, python-stdnum, Snowflake sensitive data classification

Regular expression

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

Python re syntax.

Examples

ValueDescription
12442144HSynthetic number with a valid check digit
85103532JSynthetic number with a valid check digit
54362315-Kpython-stdnum test value, with a hyphen before the letter
12442144A invalidCheck letter does not match
12442144H7 invalidOne character too many

Translations

LanguageNameDescription
SpanishDocumento Nacional de Identidad (DNI)

Sources

Use this record