Datatypes › Spain › Personally identifiable information

Spanish national identity document number (DNI)

Documento Nacional de Identidad (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, Cloudflare DLP, Databricks Unity Catalog data classification, Datadog Sensitive Data Scanner, DataPrep, Google Cloud Sensitive Data Protection (DLP), IBM Security Guardium Analyzer, Microsoft Purview Data Loss Prevention, Nightfall AI, python-stdnum, Snowflake sensitive data classification, validator.js

Regular expression

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

Python re syntax.

Test a value

Examples

ValueDescription
12442144H Synthetic number with a valid check digit
85103532J Synthetic number with a valid check digit
54362315-K python-stdnum test value, with a hyphen before the letter
12442144A invalid Check letter does not match
12442144H7 invalid One character too many

Child datatypes

IDNameCategoriesCountriesDescription
es_dni_masked Spanish identity document number, masked for publication PII persons, pii ES Number of a Spanish identity document (DNI or NIE) with all but four digits replaced by asterisks, as public bodies publish it next to...

Translations

LanguageNameDescription
SpanishDocumento Nacional de Identidad (DNI)

Sources

Use this record