Skip to contentRedact PII for your data. Get a quote

Coverage · Spain

Spanish DNI detection and redaction

OpenAnonymizer finds the Spanish DNI in text and replaces it with a placeholder. The number is confirmed by its official label and its check digits are verified. It runs on a CPU, with no GPU and no API calls.

At a glance

Country
Spain ES
Format
DNIDocumento Nacional de Identidad
Placeholder
ES_DNI1Each distinct value gets its own number: ES_DNI_1, ES_DNI_2, and so on. Formats from other countries use the ES_DNI placeholder too.
How it is confirmed
ChecksumOfficial label and checksum
Used for
Identifying Spanish citizens. The same number, with its letter, is the citizen's tax ID (NIF).

About the DNI

The DNI is issued by the Policía Nacional.

The number is eight digits and a check letter. The letter comes from the number modulo 23, so a mistyped digit usually gives the wrong letter.

12345678Z is a well-known test value that passes the check.

ExampleThe engine's real output for this input, in Fast mode (the default). The number is a test value.
In
DNI: 12345678Z
Out
DNI: ES_DNI1

How OpenAnonymizer handles it

Checked by checksum. The format's check digits are verified, so most mistyped or made-up numbers fail. A number with the right label and shape is still masked when its checksum fails, so a typo doesn't let it through.

  • It runs locally on a CPU, with no GPU and no API calls, so the text never leaves your machine.
  • Every package ships every detector, so this format is covered in each of them.
  • It covers 34 languages.
How a match is decided