Skip to content
Guide

Document anonymisation with AI: how it works and how to reverse it

Updated
By
The MagnolIA team
On this page
10 min read

Short answer

Anonymising a document before using AI means replacing each piece of personal data (names, ID numbers, accounts, addresses) with a placeholder, letting the AI work on that copy and then putting the real data back into the result. In MagnolIA Nexus the mapping table stays on your machine: without it, nobody can undo the change.

What does it mean to anonymise a document?

It means removing whatever reveals who the document is about. "Ana García López, ID 12345678Z" becomes "[PERSON_1], [ID_1]". The contract, report or claim still makes sense, but it no longer identifies anyone.

Strictly speaking, these are two different things. Anonymising means removing the link to the person irreversibly. Pseudonymising means replacing the data and keeping the information needed to restore it separately. MagnolIA Nexus does the latter, in the sense of Article 4(5) of the GDPR: that is why the result can come back with the real data.

Spain's data protection authority (AEPD) and the European Data Protection Supervisor say so in their joint paper 10 misunderstandings related to anonymisation: the first misunderstanding on the list is believing that pseudonymisation and anonymisation are the same thing, and their answer is that pseudonymised personal data is still personal data.

What techniques are there for removing personal data from a document?

The most common are five, and they are not interchangeable. For working with AI one thing matters most: that the text still makes sense afterwards.

Techniques for hiding personal data and what each is good for
TechniqueWhat it doesReversible?Useful for working with AI?
Redacting or deletingRemoves the value or covers it with a black bar.No.Hardly: the text loses who did what and the AI may mix people up.
MaskingShows only part of it: "****5678Z".No.Partly: fine for numbers, not for names.
Replacing with placeholdersSwaps each value for a consistent placeholder: "[PERSON_1]" is always the same person.Yes, if the mapping table is kept.Yes: the text keeps its meaning and the result can get the data back.
GeneralisingSwaps the exact value for a broader one: "43 years old" becomes "between 40 and 50".No.Yes for statistics; no for a document that has to come back complete.
Fictitious dataReplaces real values with invented, plausible ones.Only if the mapping is kept.Yes, with care: an invented name can match a real person.

The third is the one MagnolIA Nexus uses. Redacting by hand is still right for publishing a document; for having an AI summarise it or draft from it, it is not.

Back to contents

How do you anonymise a document with AI, step by step?

  1. You drop the document in

    In MagnolIA Nexus, you drag the document onto the Anonymiser agent. It does not leave your network.

  2. The data is detected

    Rules find data with a fixed format (ID numbers, IBANs, phone numbers) and a model running on your server finds what depends on context (names, companies, addresses, job titles).

  3. You review and correct

    You see every flagged item. Anything missing can be selected and added by hand; anything flagged by mistake can be removed.

  4. The AI works on the copy

    The model summarises, drafts or answers using the version without personal data. Within a project the same value always gets the same placeholder, so the text keeps its meaning.

  5. The result gets the data back

    Whatever the AI produces comes back with the original names and numbers, automatically.

Back to contents

What personal data does it detect?

MagnolIA's anonymiser recognises 18 types of data. They are detected in two ways, depending on whether they have a recognisable format.

Data the anonymiser detects and how it finds it
How it is detectedWhich dataWhy this way
By rulesSpanish national ID numbers (DNI, NIE), company tax IDs, IBANs, cards, social security numbers, phone numbers, emails, number plates, IP addresses, amounts and dates.They have a fixed format and, in several cases, a check digit that can be verified.
With the modelNames of people, companies, addresses and job titles.They have no format: you need to understand the sentence to know that "Mercedes" is a person and not a car.
By handAnything else you want to hide: a nickname, an internal reference, a project name.No detector is right every time. Human review is part of the process.

Which document formats does it accept?

  • Office documents: Word, Excel and PowerPoint (including .doc, .xls and .ppt), OpenDocument, Pages, Numbers and Keynote.
  • PDF and images.
  • Email: EML, MSG and MBOX.
  • Data: CSV, JSON, XML, YAML, SQL and SQLite.
  • Archives: ZIP.

It also checks data embedded inside the file, such as base64 or hexadecimal fields, which are not visible at a glance.

Back to contents

How is it reversed, and who holds the key?

Each replacement is stored as a mapping: "[PERSON_1] = Ana García López". That table is the key. With it, any text containing the placeholders has the real data restored; without it, nobody can undo the anonymisation.

The key is stored on the user's machine and never leaves it. The AI does not receive it: it only sees the placeholders.

This makes something else possible. If your organisation decides to use an external provider's model as well, that model receives only the copy without personal data, and the result is completed back on your machine. It is one of the building blocks of private AI for business.

Back to contents

What can go wrong when anonymising a document?

Removing the names is not always enough. These are well-known failures, whatever the tool.

Indirect identifiers
"The head of paediatrics at the hospital in a small town" identifies one person without naming her. A job title, a date, a place or a rare illness can point to someone alone or in combination.
Data the detector does not see
A nickname, a misspelt name, an internal reference or a value inside an image. No automatic detector finds everything.
What is not in the text
The author in the file's metadata, comments, tracked changes, or the file name itself.
A badly stored mapping table
Whoever has the copy and the table has the original document. The table deserves the same care as the document.
Inconsistent placeholders
If one person gets two placeholders, or two people share one, the AI reasons over a text that no longer says what the original said.

What should you check before giving a document to an AI? A checklist

  1. Does the AI need to know who it is about?

    If the task is summarising, translating or drafting, almost never. Then the data is surplus.

  2. Are all the direct identifiers marked?

    Names, ID numbers, phone numbers, email addresses, postal addresses, bank accounts, number plates and case numbers.

  3. Is any indirect identifier left?

    Unique job titles, notable dates, small places, rare diagnoses. Read the text as someone who knows the person would.

  4. Are the metadata, comments and file name clean?

    They are easily forgotten.

  5. Where does the mapping table stay?

    On your computer, not next to the copy or in an email.

  6. Where is the copy going?

    To an AI in your network or to an outside service. In the second case the copy is still personal data for you, who hold the key.

  7. Have you reviewed the result?

    When the data is restored, check that every placeholder has gone back to its place.

Back to contents

Do you still need to anonymise if the AI is already in your network?

Not to keep the document from an outside provider: with on-premise AI it does not leave your network. It remains useful in three cases.

  • To process no more data than needed. This is the data minimisation principle: if the task does not need the identity, better that the model does not see it.
  • To share the result. A summary or report without personal data can be shown to more people inside the organisation, or to a client.
  • To use an outside model for a specific case. The outside model receives only the copy, and the data comes back on your computer.

Where the AI should sit for each kind of document is compared in on-premise AI vs cloud AI. And how the anonymiser is used in daily work, alongside the other tools, is in AI in the office.

How does it fit with the GDPR?

Three articles of the EU's General Data Protection Regulation speak to what a reversible anonymiser does.

Article 4(5)
Defines pseudonymisation: processing data so that it can no longer be attributed to a person without additional information, which must be kept separately and protected.
Article 5(1)(c)
The data minimisation principle: data must be adequate, relevant and limited to what is necessary. If the AI does not need to know who the patient is to summarise a report, it should not be given that.
Article 32
Lists "the pseudonymisation and encryption of personal data" among the technical measures for ensuring security of processing.

Anonymising helps, but it is not enough on its own: it does not replace assessing each processing activity, which remains your organisation's job. The wider picture is in the guide to AI and the GDPR, ENS and EU AI Act.

Where can you try it?

In the MagnolIA LAB, free and from the browser. What you upload is encrypted in your browser before it leaves your device, and the server deletes its copy when it returns your result, within 10 minutes at the latest.

  • The online document anonymiser replaces the personal data in a file of up to 3 MB and gives you the copy and its key.
  • The tool to reverse an anonymised document puts the real data back into a text with placeholders, using that key.
  • The Leak check highlights the personal data in a text before you paste it into a public AI. No email required.

In an installation, the anonymiser is part of MagnolIA Nexus, and the model that detects names runs on your own server. That server can be built in-house or bought as a service: the comparison is in self-hosted LLM: build or buy, and what MagnolIA's fee includes is in what on-premise AI costs.

Back to contents

Frequently asked questions about anonymisation

How do you anonymise a document with AI?

In MagnolIA Nexus you drag the document onto the Anonymiser agent. Rules and a model running on your server flag every piece of personal data; you review and correct. The AI works on the copy without personal data and, when it finishes, the original data is put back into the result automatically.

Can an anonymised document be reversed?

A document anonymised with MagnolIA Nexus can be reversed with its key. Each replacement is stored as a mapping on the user's machine, and whatever the AI produces comes back with the real data. That key never leaves your machine: without it nobody can undo the anonymisation. Within a project, the same value always gets the same placeholder.

What is the difference between anonymising and pseudonymising?

Anonymising means removing the link to the person irreversibly. Pseudonymising means replacing the data and keeping the information needed to restore it separately. In GDPR terms (Article 4(5)), what MagnolIA Nexus does is pseudonymise: the mapping table stays on your machine and the AI never receives it.

What can go wrong when anonymising a document with AI?

Anonymising a document with AI can leave indirect identifiers (a job title, a date, a place), data the detector does not recognise, and metadata or comments. No detector is always right: Spain's AEPD and the European Data Protection Supervisor state that a human expert's involvement is necessary. That is why the MagnolIA anonymiser lets you review every item.

Do you still need to anonymise if the AI is already in your network?

With the AI in your network, you no longer need to anonymise to keep the document from an outside provider, because it does not leave. Anonymising is still useful so the model handles only the data it needs, to share the result with more people, and to use an outside model occasionally, which receives only the copy without personal data.

Is anonymising documents enough to comply with the GDPR?

Anonymising is not enough on its own. What MagnolIA Nexus does is pseudonymise (Article 4(5) GDPR): it replaces the data and keeps the information needed to restore it separately, on your machine. It is a technical measure cited in Article 32 and applies data minimisation, but it does not replace assessing each processing activity.

Sources

External figures on this page link to their original source.

  1. AEPD (Spain's data protection authority) and the European Data Protection Supervisor. 10 misunderstandings related to anonymisation (PDF, Spanish edition). www.aepd.es/guias/10-malentendidos-anonimizacion.pdf

  2. EUR-Lex. Regulation (EU) 2016/679, General Data Protection Regulation (GDPR). eur-lex.europa.eu/eli/reg/2016/679/oj

Use AI on your documents without exposing anyone

Tell us which documents you work with and what data they contain. We will show you the anonymiser on a case like yours and see what a pilot would look like.

Request a pilot