Skip to content
← Notebook

Security & Privacy

How do you anonymise personal data before ChatGPT? 5 free detectors measured with Spanish ID numbers, IBANs and names

No local personal-data detector got below 10% leakage on its own. Rules for ID numbers, IBANs and phones plus GLiNER let 0.6% of 1,878 data points slip through in 500 documents.

Date
Nov 7, 2026
Reading time
8 min
Result
Rules + GLiNER: 0.6% of data leaks • best model alone: 10.6% • default Presidio: 32.6% • GLiNER: 76.7 ms per document on CPU

Translated from the Spanish original. The code, data and READMEs on GitHub are in Spanish.

If your company masks personal data before pasting a text into ChatGPT, no free tool is enough on its own: the best one let 10.6% of the data slip through. Combining a few rules for DNI, NIE (Spanish national and foreigner ID numbers), IBAN, emails and phones with the GLiNER model cut the leakage to 0.6%: 12 out of 1,878 data points in 500 documents. Presidio, one of the most cited libraries, let 32.6% slip through with its default Spanish configuration. Measured on 7 November 2026 on a laptop, without sending anything to the internet.

It’s one of the questions small businesses ask most before using AI with customer documents: “can I remove the personal data before sending it to ChatGPT?”. The answers going around name tools (Presidio, the privacy filter OpenAI open-sourced in 2026, GLiNER), but there’s no measurement in Spanish with Spanish ID numbers, IBANs and phone numbers. Here it is, with the code.

Definitions

  • Personal data: any data that identifies a person. Here we measure six types: name, email, phone, DNI or NIE, IBAN and postal address.
  • Detector: a program that finds that data in a text so it can be masked (for example, replacing “Clara Pinto” with “[PERSON]”) before sending it to an AI model.
  • Leaks: a data point left fully or partly visible. An IBAN with its last four digits visible or an address with the street unmasked counts as a leak.
  • Over-masked: text that wasn’t personal data and was masked anyway (for example, «Buenos días», “Good morning”). It gets in the model’s way, but it isn’t a legal risk.
  • Rules (regular expressions): fixed patterns that recognise formats, such as “8 digits and a letter”. They work for ID numbers, IBANs or phones; not for names or addresses.
  • Pseudonymising isn’t anonymising: under the GDPR, a text in which names have been replaced with markers is still personal data if the person can be re-identified. Masking reduces risk; it doesn’t take the processing outside the GDPR.

Hypotheses

  1. A local AI model detects more personal data than a set of rules.
  2. Presidio, the most recommended option, works well in Spanish out of the box.
  3. Rules for identifiers plus a model for names and addresses let less than 1% slip through.

Setup

  • Documents: 500 programmatically generated small-business texts, of five types: an email to an accounting firm, an online shop ticket, an HR note, a clinic record and a WhatsApp message (in lower case and without accents, the way people type them). They contain 1,878 personal data points with their exact position: 546 names, 303 phones, 301 addresses, 283 DNI or NIE, 266 emails and 179 IBANs.
  • Real formats: DNI written together, with a hyphen or with dots; NIE; IBAN with and without spaces; mobiles and landlines with spaces, hyphens, written together or with +34.
  • Made-up data: names, emails and addresses come from the Faker library; DNI, NIE and IBAN are random with valid check letters or digits. There’s no data about real people.
  • Detectors, all free and local:
    • Rules: our own regular expressions for email, phone, DNI/NIE and IBAN.
    • Default Presidio: Microsoft Presidio 2.2.366 with spaCy’s Spanish model (es_core_news_lg).
    • Presidio with Spanish phone numbers: the same, with the phone recogniser restricted to the ES region (a one-line change).
    • GLiNER multi PII v1: a small entity-detection model, with six labels in English (person, email, phone, address, ID document, IBAN).
    • OpenAI Privacy Filter: the 1.5-billion-parameter model OpenAI released under the Apache 2.0 licence, run with transformers 5.22.2.
    • Plus, the union of the rules with each model: anything flagged by either is masked.
  • Time: five full passes over the 500 documents, one at a time, on CPU. Median, minimum and maximum.
  • Machine: Apple M1 Max laptop with 64 GB, macOS 26.6.2, Python 3.12.13, plugged into mains power.

Results

What leaks with each detector

Detector Data that leaks Documents with any leak Over-masked text Time per document
Rules 46.6% 100.0% 0.0% 0.02 ms
Default Presidio 32.6% 84.2% 7.3% 4.9 ms
Presidio with Spanish phones 23.6% 72.0% 7.3% 4.3 ms
GLiNER multi PII 11.7% 40.8% 0.4% 76.7 ms
OpenAI Privacy Filter 10.6% 37.0% 1.4% 309.9 ms
Rules + Presidio with Spanish phones 18.3% 65.6% 7.3% —
Rules + OpenAI Privacy Filter 9.9% 35.6% 1.4% —
Rules + GLiNER 0.6% 2.4% 0.4% —

The combinations weren’t timed separately: they take as long as the model, because the rules add 0.02 ms. Time spread is low: GLiNER ranged from 76.1 to 79.4 ms across the five passes and OpenAI Privacy Filter from 309.4 to 310.7 ms. Detections were identical in all five.

Which type of data leaks (percentage of each type)

Detector Name Email Phone DNI/NIE IBAN Address
Rules 100.0% 0.0% 9.2% 0.0% 0.0% 100.0%
Default Presidio 7.7% 0.0% 72.6% 17.3% 0.0% 100.0%
Presidio with Spanish phones 7.7% 0.0% 17.2% 17.3% 0.0% 100.0%
GLiNER multi PII 0.9% 0.0% 0.7% 21.9% 80.4% 2.3%
OpenAI Privacy Filter 21.2% 0.0% 0.0% 4.6% 0.0% 23.3%
Rules + GLiNER 0.9% 0.0% 0.0% 0.0% 0.0% 2.3%
  • Each model fails at something different. GLiNER finds almost all names and addresses, but lets through 144 of the 179 IBANs. OpenAI Privacy Filter masks every IBAN and phone, but misses 21.2% of names; in messages written in lower case, 66.0%. It also lets through 13.2% of DNIs written with dots.
  • Presidio doesn’t mask any address completely. It flags the city or part of the street and leaves the rest: on average it masks 73.0% of each address. With its default configuration, it also misses 72.6% of phones; restricting it to Spanish phones brings that down to 17.2%. And it over-masks words like «Buenos» (“Good”), «Domicilio» (“Address”) or «Teléfono» (“Phone”): 7.3% of the text that wasn’t personal data.
  • Rules are perfect for the formats they know (DNI, NIE, IBAN and emails, with no failures) and blind to names and addresses. Ours failed on some landlines with spaces: 9.2% of phones.
  • What leaks with rules + GLiNER: 5 names and 7 addresses, in 12 of the 500 documents.

Load and volume

For 500 documents, GLiNER took 38.4 s and OpenAI Privacy Filter 154.9 s, on a laptop with no graphics card. Loading GLiNER into memory, with the model already downloaded, took 8.5 s.

What it means for a company

  • Hypothesis 1: it holds. The two models let between 10.6% and 11.7% of the data slip through, compared with 46.6% for the rules. But that still leaves some data visible in almost four out of ten documents (from 37.0% to 40.8%), and with real documents it would be worse.
  • Hypothesis 2: it doesn’t hold. Presidio out of the box lets 32.6% of the data through in Spanish. It can be tuned (here it dropped to 23.6% with one change), but with addresses that isn’t enough.
  • Hypothesis 3: it holds with GLiNER (0.6%) and not with OpenAI Privacy Filter (9.9%), because the rules mask exactly what GLiNER misses (IBAN and DNI) and not what OpenAI’s filter misses (names and addresses).

An accounting firm that pastes 300 customer emails a month into ChatGPT to summarise or classify them can mask the data beforehand on its own computer, for free and in under a second per document. But not even the best combination reaches zero: if the contract or company policy forbids even a single data point from leaving, you need human review or a business account with a data processing agreement.

When to use each option

  • Rules only: if all that needs to disappear is ID numbers, IBANs, emails and phones (for example, statements or listings). Fast and flawless with ID numbers, IBANs and emails; with phones you have to test every format your customers use. They leave every name.
  • Rules + GLiNER: the best option measured for free-form customer text (emails, tickets, messages). It’s the one we recommend trying first.
  • OpenAI Privacy Filter: good with account numbers and phones, weak with Spanish names, especially in lower case. Four times slower than GLiNER on this machine.
  • Presidio: useful as a framework to build your own system, but not as a ready-made solution for Spanish. If you use it, you need to tune phones and add an address detector.
  • Any of them: test it with 50 of your own documents before trusting it. It varies a lot depending on how your customers write.

Limitations

  • Synthetic documents. They’re built from templates, so they’re more regular than real ones: no spelling mistakes, no data split across two lines, no tables or scanned PDFs. With real documents, every leakage figure should be worse.
  • Six types of data. We didn’t measure dates of birth, licence plates, social security numbers, health data or data that identifies through context (“the owner of the bakery on the square”). None of these detectors solves that last case.
  • Simple configurations. GLiNER was used with a 0.5 threshold and English labels; other labels (for example, “bank account number” instead of “IBAN”) could change its IBAN result a lot. OpenAI Privacy Filter was decoded token by token, as in the example on its model card, without the Viterbi decoder from its official package. Presidio was tested with spaCy’s large model, which warns that it was trained with an earlier version.
  • Strict leak criterion: a single unmasked letter or digit of the data point is enough. With a looser criterion, Presidio would do better on addresses.
  • A single Apple Silicon laptop, with other apps open and plugged in. The timings are good for the order of magnitude. All the computation fit in under 30 minutes.
  • This isn’t legal advice. Masking data is a minimisation measure; it doesn’t replace the legal basis or the contract with the AI provider.

How to reproduce it

Code, document generator with a fixed seed, model revisions and per-data-point results (without the text): yeswelab-laboratorio/anonimizar-datos-personales-chatgpt-rgpd on GitHub. It runs with no accounts or keys; it downloads the three models from Hugging Face the first time. To test it with your documents, replace corpus.py with your labelled texts.

Want to use AI with your customers’ documents and don’t know how much data would leak? Commission the experiment with 50 of your documents and we’ll tell you which detector works with them and what risk remains.

#Presidio 2.2.366#spaCy es_core_news_lg#GLiNER multi PII v1#OpenAI Privacy Filter#transformers 5.22.2#PyTorch 2.15.0