Skip to main content
Ontelis home
See a demo
Ontelis home

Security

Data Masking vs Tokenization vs Anonymization

By the Published Updated 6 min read
In short

Data masking replaces a sensitive value with a realistic stand-in inside a system, usually without destroying it elsewhere. Tokenization swaps a value for a token, with reversibility depending on the implementation. Anonymization removes identifying detail so no method can reasonably link the record back to a person. Each method fits a different job, and mixing them up creates compliance risk.

The short answer

Data masking, tokenization and anonymization all do the same basic thing: they put something other than the real value in front of a reader who does not need to see it. They differ in what happens to the original value and who, if anyone, can get it back. Masking swaps in a realistic substitute and usually leaves the real value intact somewhere else. Tokenization swaps in a token, and whether the original can be recovered from it depends on the implementation. Anonymization is meant to remove the link to a person for good, though that depends on assessing the released information itself, not just the method's label.

Getting these three confused is where compliance risk actually lives. A masked copy of a patient database is not de-identified data just because the names look different. A tokenized customer ID is not anonymous just because the token itself is meaningless. Each method answers a different question, and the question that matters is: can this specific value, in this specific place, still be traced back to a real person, and by whom?

What do data masking, tokenization and anonymization mean?

Masking replaces a sensitive value with a realistic-looking substitute, in place, inside a system or a copy of one. A masked test environment might show "Jordan Rivera" instead of a real patient's name, formatted the same way a real name would be, so the application still works and testers still see data that looks real. The substitution usually happens one way inside that copy; it does not remove the original value from the system it was copied from.

Tokenization replaces a sensitive value with a token. In a vault-based implementation, authorized systems use a protected mapping to recover the original value. Other implementations use different mechanisms, so reversibility and storage arrangements depend on the design.

Anonymization removes or generalizes identifying detail so that no method reasonably available to anyone, not just the party holding the data, can link the record back to a specific person. Dates become years, ZIP codes become regions, small groups get suppressed rather than shown. Whether a given dataset counts as anonymized depends on assessing the released information itself, not on applying a label.

Pseudonymization sits between masking and anonymization as a defined legal term, mainly in European law. It describes processing that keeps a record technically linkable to a person through additional information, as long as that additional information is held separately and protected (GDPR Article 4(5)). Because the link still exists somewhere, GDPR's Recital 26 is explicit that pseudonymized data remains personal data, not anonymous data.

A side-by-side comparison

QuestionMaskingTokenizationAnonymization
Can an identifiable source record still exist separately?YesYesYes; assess whether the released information is anonymous
Is it designed to be reversed?Not inside the masked copyDepends on the implementationNo
Where is it most used?Test, analytics and demo environmentsPayment data, other high-value lookup fieldsPublic reporting, research datasets
Does HIPAA treat it as de-identified on its own?NoNoOnly if it meets Safe Harbor or Expert Determination
Is it still personal data under GDPR?Usually yesUsually yesNo, if done correctly

When is data de-identified under HIPAA or anonymous under GDPR?

HIPAA does not have a rule called "masking" or "tokenization." It has two specific, defined routes to de-identification, both under 45 CFR 164.514(b). The Safe Harbor method removes 18 listed categories of identifier, from names and ZIP codes to device identifiers and biometric data, and requires that the covered entity have no actual knowledge the remaining information could still identify someone. The Expert Determination method instead has a qualified person apply accepted statistical methods, conclude the re-identification risk is very small for an anticipated use, and document that conclusion. Neither route is satisfied just because a field was masked or tokenized; the result has to meet one of the two tests on its own terms.

GDPR takes a different structure. It defines pseudonymisation on its own terms, as processing where the data could still be attributed to a person using additional information kept separately (Article 4(5)). Recital 26 then settles the practical question a lot of teams ask: pseudonymized data, because it is still potentially linkable, is treated as personal data, not as anonymous data. Only information that cannot reasonably be re-identified by anyone falls outside GDPR's scope entirely. HIPAA de-identification and GDPR anonymization use different tests. Meeting HIPAA Safe Harbor does not, by itself, establish that information is anonymous under GDPR.

Why this matters once an AI agent is in the room

Every one of these methods predates agentic AI, but an agent raises the same question with a shorter deadline: what can this specific model call see, and does that match what the method was actually built to protect. Before sending data to a model, assess the complete payload, its permitted purpose, the endpoint and the applicable privacy controls. A masking or tokenization label alone does not establish that the disclosure is permitted.

Ontelis Mask treats this as a field-by-field decision rather than a single switch. For each field it sets what Ontelis stores, what each reader or agent sees, and what, if anything, may leave the data plane toward a model. Its store treatments include keep, pseudonymize, generalize, metadata only and do not ingest; its serve treatments include full, masked, aggregate only and none, so a field pseudonymized in storage can still be served as fully masked, or not served at all, to a specific agent. Ontelis suppresses counts of one to ten as "under 11". This is a product control, not a universal regulatory threshold or proof of de-identification. The rule set behind these decisions is a Mask policy, an enforced, versioned set of rules, similar in kind to a Snowflake masking policy, and distinct from a company's written privacy policy. A named person, not an agent, decides when that policy changes.

Ontelis does not certify that a given field meets HIPAA Safe Harbor, Expert Determination or GDPR anonymization; those are determinations a customer's own privacy and legal teams make, because they depend on the full context a field sits in, not on Ontelis. What Mask provides is the control point that enforces whichever decision the customer's privacy team has made, consistently, before a value reaches a reader or a model.

Teams that run HCP and commercial data can see how Ontelis fits their work on the Commercial Data and IT solutions page.

Book a demo to see how a single record moves through Mask's store, serve and send gates, field by field.

Questions and answers

What is data masking?

Data masking replaces a sensitive value with a realistic stand-in, such as a fake name or a shifted date, inside a system or a copy of one. The original value may still exist elsewhere unless a separate rule removes it. Ontelis Mask applies masking as one of several field-level treatments, decided per field and per reader, not as a single setting applied to a whole dataset.

What is the difference between masking, tokenization and anonymization?

Masking swaps a value for a realistic substitute in place. Tokenization swaps a value for a token; in a vault-based design authorized systems can recover the original, while other designs use different mechanisms. Anonymization removes or generalizes identifying detail so no reasonably available method can link the record back to a person.

Can masked or tokenized data be reversed?

Tokenization's reversibility depends on the implementation: a vault-based design lets authorized systems recover the original value, while other designs use different mechanisms. Masking is usually one-way inside the masked copy, though the real value often still exists in the source system it was copied from. Ontelis keeps its pseudonymization lookup table under a separate key role so Ontelis staff cannot reverse a token.

Is pseudonymized data still personal data under GDPR?

Yes. GDPR defines pseudonymisation as processing that keeps the data linkable to a person through additional information held separately (Article 4(5)), and Recital 26 states that pseudonymized data should still be treated as information about an identifiable natural person. Only anonymous information, where no one can reasonably re-identify the person, falls outside GDPR's scope.

Does HIPAA treat masked or tokenized data as de-identified?

Not automatically. HIPAA sets two specific routes to de-identification under 45 CFR 164.514(b): the Safe Harbor method, which removes 18 listed identifier categories, or Expert Determination, where a qualified person documents that re-identification risk is very small for a stated use. Masking or tokenizing a field does not by itself satisfy either route unless the result meets one of them.

Sources

  1. 45 CFR 164.514 - Other requirements relating to uses and disclosures of protected health informationCornell Law School Legal Information Institute, 2026
  2. Art. 4 GDPR - DefinitionsIntersoft Consulting (gdpr-info.eu), 27 April 2016
  3. Recital 26 GDPR - Not Applicable to Anonymous DataIntersoft Consulting (gdpr-info.eu), 27 April 2016

Keep reading

All guides

Where pharma puts AI to work.

See a demo