Skip to main content

20% off your first year with code See plans

Spanish documents · DNI · NIE · NIF

Hide Spanish ID numbers in PDFs: DNI, NIE and NIF

If you handle Spanish paperwork, whether as a relocation agency, an international law firm or an HR team with staff in Spain, you will meet three identifiers everywhere. The DNI is the national identity card number of Spanish citizens (eight digits and a check letter); the NIE is the equivalent for foreign residents (a letter, seven digits and a check letter); and the NIF is the tax ID, which for individuals is the DNI or NIE number.

In Spain, plans are arranged with our sales team.

30 seconds with a fictitious resolution: the PDF is uploaded, patterns and AI options are selected, detections are reviewed, then the document is anonymized and pseudonymized.

These numbers rarely appear only once: they sit in the header, the parties clause, the signature block and often in a photocopy of the ID card stapled at the end. Anonimatum's [G] DNI / NIF pattern finds them by their format throughout the document, and its own AI adds the context around them: the holder's name, address or phone number. Scanned pages go through OCR first.

The ID card copy needs its own treatment, because besides the number it shows a photo, a signature, a date of birth and, on the back, an address. There you combine text detection with visual redaction zones over the image. Everything is reviewed in the preview and processed on EU servers.

How to hide DNI numbers in a PDF

  1. 1

    Upload the document

    A native PDF, a scan or a ZIP with several files. Pages without a text layer go through OCR before detection.

  2. 2

    Switch on the ID pattern

    Select [G] DNI / NIF and, if you also want to hide the holder, the AI options «GDPR anonymization» and «Addresses».

  3. 3

    Cover the ID card copy

    On the image of the card, place visual redaction zones over the photo, the signature and the remaining card details.

  4. 4

    Review and download

    Check every detected number in the preview and download the PDF without the identifiers.

Fictitious document

Before and after: a Spanish residential lease

Fictitious Spanish lease with a landlord, a foreign tenant and a property manager. DNI, NIE, NIF, names, address and the ID card copy are hidden.

Before · Residential lease (fictitious document)

CONTRATO DE ARRENDAMIENTO DE VIVIENDA (residential lease)

Landlord: Javier Ortiz Campos, DNI 12345678Z

Tenant: Ioana Popescu, NIE X1234567L

Property manager: Luis Rey Martín, NIF 00000000T

Property: C/ Laurel 8, 2.º A, 28005 Madrid

Monthly rent: €950, payable between the 1st and 5th of each month

Term: five years from signature

Annex I, copy of the landlord's DNI: photo, signature and card details

After · Residential lease (fictitious document)

CONTRATO DE ARRENDAMIENTO DE VIVIENDA (residential lease)

Landlord: (redacted), DNI (redacted)

Tenant: (redacted), NIE (redacted)

Property manager: (redacted), NIF (redacted)

Property: (redacted)

Monthly rent: €950, payable between the 1st and 5th of each month

Term: five years from signature

Annex I, copy of the landlord's DNI: (redacted)

Rent, term and the existence of the annex stay because they are the terms of the lease; identifiers, names and the ID card image are redacted.

Where DNI numbers hide in a document

In running text

Parties clauses, signature blocks, invoice headers. The [G] DNI / NIF pattern searches every page, not just the first one.

In scans

A signed, scanned application has no text to search. OCR recognizes it before detection; those pages count double towards your page quota.

In the ID card copy

The image includes photo, signature, date of birth and, on the back, an address. You cover it with visual zones you place and review yourself.

Next to other identifiers

Hiding only the number is pointless if the full name and address remain. Combine the pattern with the AI options for names and addresses.

Hiding Spanish ID numbers: frequently asked questions

Do I have to hide the DNI before sharing a Spanish document?

It depends on the purpose and the recipient, but the GDPR's data minimization principle means not sharing more than needed. For official publications in Spain, the Spanish data protection act (LOPDGDD) sets out how to identify people using their name and only some digits of their ID number.

Does it also detect the NIE of foreign residents?

Yes. The [G] DNI / NIF pattern covers Spanish-format DNI and NIE numbers and the NIF of individuals. ID documents from other countries have no built-in pattern; for those you can define your own pattern based on their format.

Can it read a scanned ID card automatically?

There is no dedicated ID card reader. If the number is legible, OCR turns it into text and the pattern detects it; the photo, signature and rest of the card are covered with visual redaction zones.

Can I leave part of the number visible?

With pseudonymization, partial masking keeps a controlled part of the value visible and hides the rest. With redaction, the whole number disappears from the PDF.

Can I hide DNI numbers in many documents at once?

Yes. Upload a ZIP to batch processing with the pattern switched on and you get back a ZIP with every PDF redacted to the same rule.

Remove Spanish ID numbers before you send the file

Try the [G] DNI / NIF pattern on a lease or an application at app.anonimatum.com, or ask us for a demo if you work in batches.

Try it in the app

Not in Spain?