To anonymize unstructured data, you de-identify free text and files by detecting sensitive values with context-aware models rather than column rules, replacing each one with a realistic synthetic value that stays consistent everywhere the same person or organization appears, and verifying the output against what was detected. Because names, account numbers, and health details can sit anywhere in an email, chat thread, PDF, or transcript, detection quality and cross-document consistency decide whether the result is both private and still useful.

Why unstructured data is harder to de-identify than a database

In a database, you point a rule at a column; in free text and files, a sensitive value can appear anywhere, in any form, with nothing labeling it as sensitive. A column named ssn tells a masking rule where to look; an email thread offers no such map, with one customer's name in the To line, the greeting, a forwarded signature, and an attached PDF. That's why the methods built for de-identifying production databases don't carry over. A 2022 analysis in International Data Privacy Law found that most legal and technical work on data anonymization has centered on tables, leaving the requirements for text and images largely unaddressed.

The goal of data anonymization is the same in both settings, data that no longer identifies anyone, but unstructured sources complicate it. The same person surfaces in many forms — an email display name, a Slack handle, a signature block, a nickname, a spreadsheet row — and a detector has to recognize every one. Quasi-identifiers hide in narrative, too: a ticket mentioning the only pediatric cardiologist in a small town who was on leave in March identifies one person without naming them. And the containers are mixed: attachments, scanned images, and semi-structured exports such as Slack JSON, where message text sits in nested fields beside user IDs and timestamps.

In practice, PII in unstructured sources tends to hide in:

  • Email headers, display names, and signature blocks
  • Message and document bodies
  • Attachments in formats different from their parent message
  • Scanned forms and images, where text exists only as pixels
  • File metadata such as authors, comments, and tracked changes

The workable sequence is: detect sensitive values wherever they appear, choose a transformation per type, apply it consistently across every file, and verify the result. It's the general anonymization process, adapted to data with no fixed columns.

How to detect PII in unstructured text

Detection is the step that determines privacy, because any sensitive value the detector misses passes straight through to the output. Precision is the share of flagged spans that are actually sensitive; recall is the share of all sensitive spans the detector finds. Low precision costs utility, while low recall costs privacy, because every miss is a real identifier left in the data. That makes recall the privacy measure, and no single technique delivers it alone.

Effective pipelines layer several methods:

  • Regular expressions catch values with a fixed format, such as Social Security numbers, email addresses, and phone numbers. They're fast but blind to context.
  • Named entity recognition (NER), a model that locates and classifies spans of text such as people, organizations, and locations, handles values that only context reveals. Jordan is a person in one sentence and a country in the next.
  • An LLM verification layer reviews the candidates NER proposes and removes false positives, raising precision.
  • OCR and form handling turn scanned pages into readable text and catch values that sit beside a field label, such as Patient Name, rather than inside a sentence.

Domain-specific identifiers need their own treatment. Medical record numbers, claim numbers, and internal employee IDs follow formats no generic model has seen, so you define them as custom types.

Tonic Textual is built around this layered approach. Its proprietary NER models are trained for real-world domain text such as clinical notes, legal documents, and transcripts, where generic PII detection underperforms, and an LLM verifies the candidates they find. You can define custom entity types with a regular expression or by training a model on examples, map form labels to entity types so values in structured forms and scanned documents are caught by field, and detect logos and signatures in scanned images, not only text.

Against human-annotated data in Tonic.ai's PrivacyBench benchmark, Tonic Textual's detection caught 94.3% of PII, more than 7 points more than any non-Textual engine tested, while keeping precision above 90%. Tonic.ai built the benchmark, and its datasets and scoring code are public, so teams can score their own pipeline on the same raw email, Slack, and document exports.

Choosing how to transform each type of sensitive value

Once a value is found, you choose how to transform it, and that choice, made per entity type, sets the tradeoff between privacy and usefulness. A given name, a diagnosis, and a city rarely need the same treatment, so most datasets mix several of the core anonymization techniques. Redaction removes a value or covers it with a black box. Tokenization swaps it for a consistent placeholder such as NAME_GIVEN_x7k2. Synthetic replacement substitutes a realistic stand-in. Generalization and suppression coarsen a value, turning a birth date into a year, or drop it entirely. Some types, such as public product names or the names of public figures quoted in the news, can be left untouched, because replacing them removes meaning without protecting anyone.

TechniqueWhat the reader of the output seesReversible?Preserves readability and model signal?When to use it
RedactionA blank, a black box, or an entity labelNoNo — gaps break sentences and remove signalDocuments released for human reading where the value has no analytic use
TokenizationA consistent placeholder, e.g. NAME_GIVEN_x7k2Yes, if a lookup table is keptPartly — repeat mentions stay linked, but text reads unnaturallyAnalysis that counts or joins entities without reading the text
Synthetic replacementA realistic stand-in, e.g. Dana → MayaNot from the output aloneYes, when replacements are consistentTraining, analysis, licensing, and sharing
Generalization / suppressionA coarser value (1987 instead of a full date) or nothingNoPartly — broad patterns survive, detail is lostDates, locations, and rare attributes that act as quasi-identifiers

In free text, the form of the output matters as much as its privacy. Placeholders break the flow of a sentence, and a model trained on them learns to produce tokens, which is a real cost when de-identifying training data. Realistic replacement keeps text reading naturally, provided it's consistent: the same original value must map to the same synthetic one every time. Reversibility is the other line to watch. Tokenization backed by a lookup table can be undone by anyone holding the table, which makes it pseudonymization, and under GDPR pseudonymized data is still personal data.

Tonic Textual lets you choose a handling option for each entity type: synthesize, redact, or ignore. Synthesized values are consistent, so a given original value always receives the same replacement wherever it appears in a dataset, while each entity type in the same dataset keeps its own setting, so names can be synthesized while a type with no identifying value is left as is.

Keeping identities consistent across every file

Consistency is what separates usable de-identified text from fragments: every mention of one real person or organization has to map to the same synthetic identity, in every message and every file. Take Dana Whitfield, who appears as Dana Whitfield in an email header, @dwhit in a Slack export, and D. Whitfield in a spreadsheet. Replace each mention independently and you get three unrelated people; replace them from one mapping and she becomes Maya Castellano, @mcast, and M. Castellano everywhere.

That consistency has to hold along four dimensions at once:

  1. Across messages: every mention of one person gets the same synthetic identity.
  2. Across file types: that identity holds in emails, chat, PDFs, documents, spreadsheets, and CSVs.
  3. Within an identity: the synthetic email address and handle plausibly belong to the synthetic name, and a nickname maps to a nickname form of it.
  4. Across an organization: every form of one employer's name maps to one synthetic organization, with email domains and addresses kept in step.

In unstructured data, this is what referential integrity means: the relationships survive de-identification. The customer who opened a ticket is still the one who closed it. Training, analysis, and licensing company data to AI labs all depend on those relationships, and fragmented identities read as noise to a model. Inconsistency can also leak: if the full name is replaced but a nickname like Whit is missed, the real surname survives inside the de-identified text. That's why company data de-identification, where email, chat, tickets, and documents move together, treats consistency as core.

The Tonic Advantage: consistent replacements across the whole document set. Tonic finds sensitive values across free text and files wherever they're stored, and its synthesized replacements stay consistent from one file to the next, so a name replaced one way in an email isn't replaced another way in the Slack export or the spreadsheet. Tonic maps what a dataset holds before anything changes and keeps a record of everything it detected and replaced, so a reviewer can check that consistency rather than take it on trust.

Verifying the result and documenting what changed

De-identification isn't finished until you've measured the result and recorded what was done. Verification starts with detection: have reviewers annotate a representative sample of your own documents, run the pipeline on it, and score precision and recall against those human labels. Next comes residual risk. Even with every direct identifier replaced, quasi-identifiers and rare events can let someone be re-identified through linkage with other data, so review what remains and generalize where needed. Finally, route low-confidence detections to human review instead of accepting or discarding them silently.

Under GDPR Recital 26, data is anonymous only when individuals are no longer identifiable by means reasonably likely to be used, so whether anonymized data still counts as personal data depends on context, not on the file alone. In the US, HIPAA defines de-identification through two methods. HHS guidance makes clear that Safe Harbor's identifier removal reaches free-text fields, not only structured ones. Expert Determination is the alternative: a qualified expert assesses the data and certifies that the risk of re-identification is very small. The same questions shape what de-identified means when company data is sold.

A defensible verification pass covers:

  • A sample-based accuracy check against human annotations
  • A review of remaining quasi-identifiers and rare events
  • Human review of low-confidence or flagged items
  • A transformation record of what was detected, what replaced it, and where

Tonic Textual keeps a record of what was detected and replaced, so the result is documented rather than asserted. Its Request Auditor scores a configurable share of redaction requests and routes low scorers into a review queue. Textual supports HIPAA Safe Harbor and Expert Determination de-identification workflows, and Tonic.ai provides de-identification that meets HIPAA requirements, with certification available through an independent Expert Determination partner.