Data masking hides sensitive values from people or systems that should not see them, while the data stays tied to real people. De-identification changes the data so it is no longer about an identifiable person, which can take it out of laws like HIPAA. Masking is one of the tools you can use to de-identify, but masking a few fields does not make a dataset de-identified on its own. For the wider topic, see our guide to data de-identification.
Here is one patient record, handled both ways:
| Field | Original | Masked (support screen) | De-identified (analytics extract) |
|---|---|---|---|
| Name | Maria Lopez | M**** L**** | <PERSON>Kx7Qm2</PERSON> |
| SSN | 123-45-6789 | ***-**-6789 | Removed |
| Date of birth | 1984-03-12 | **/**/1984 | 1984 |
| Visit note | “Maria called from 415-555-0142 about her refill” | Shown in full to the support rep | “<PERSON>Kx7Qm2</PERSON> called from <PHONE>Wd29Lx</PHONE> about her refill” |
The masked view still shows the last four digits of the SSN and the full note, so it is still PHI. The extract removes or replaces identifiers in every field, including the free text.
What is data masking?
Data masking hides part or all of a sensitive value, for example by replacing digits with asterisks or swapping a value for a realistic fake one. Its job is access control: a support agent, tester or report reader sees only what they need.
Types of data masking
- Static masking: a copy of the database is masked once, usually for testing and development.
- Dynamic masking: values are masked on the fly when a user without access reads them; the stored data does not change.
- Format-preserving masking: the masked value keeps the original format, so a phone number still looks like a phone number and validators still pass.
For more, see static vs dynamic data masking. Masking is also different from encryption: encrypted data can be read in full by anyone with the key, while masked values stay hidden from people without access.
What is de-identification?
De-identification removes or replaces everything that identifies a person, including indirect details such as birth dates and ZIP codes, so the result is no longer personal data under a given law. It uses several methods together: removal, generalization (exact date to year), tokenization, hashing, synthetic replacement and date shifting. When a protected mapping is kept so approved users can reverse it, the result is pseudonymized data. When no mapping is kept, it moves toward anonymization; see de-identification vs anonymization.
Key differences between data masking and de-identification
| Question | Data masking | De-identification |
|---|---|---|
| Main goal | Hide values from people who should not see them | Make data no longer about an identifiable person |
| Scope | Selected fields, often only on screen or in a copy | Every direct and indirect identifier, including free text |
| Is the data still personal data? | Yes | No, if it meets the law’s standard (such as HIPAA Safe Harbor) |
| Reversible? | Dynamic masking: the original is untouched. Static masking: usually not | Only if a protected mapping is kept (pseudonymization) |
| Typical uses | Support screens, test databases, role-based views | Research, analytics, AI training, sharing with partners |
| In AI systems | Hides values from users of an AI app who lack access | Protects training data and prompts before they reach a model |
Tokenization sits between the two: it replaces values with tokens and can serve either goal. See data masking vs tokenization.
Is masked data de-identified?
Usually not. Under HIPAA, data is de-identified only through Safe Harbor (all 18 identifier types removed, and no actual knowledge that what is left could identify the person) or Expert Determination. Showing the last four digits of an SSN, or masking the name column while the notes still mention the patient, leaves identifiers in place. Masking helps you meet HIPAA’s minimum necessary and access rules, but the data stays PHI. For the full rules, read our HIPAA de-identification guide.
When to use each
- Staff need to work with real records, but not see every value: mask, by role.
- Developers need realistic test data: static or format-preserving masking on a copy, or de-identify the copy fully if it leaves your control.
- Data goes to analytics, research, a partner or AI training: de-identify, with consistent tokens if records must still link.
- Prompts and files go to an LLM: de-identify before the call, and let only approved users see real values in the answer.
Data masking and de-identification in healthcare AI
A health plan building a claims model needs millions of records where the same member appears as the same token across claims, notes and call transcripts. Masking the name column would hide identities on screen but leave them in the notes, and the training set would still be PHI. De-identifying in the pipeline, before the data reaches the model, keeps the links the model learns from while removing who the members are. The care team using the finished AI app still needs real values for their own patients, which is where role-based masking comes back in. For a step-by-step approach, see our PHI de-identification checklist.
How Protecto handles both
Protecto finds personal and health data in tables and free text, then applies the treatment you choose. For de-identification, it replaces each value with a format-preserving token that stays the same across datasets, keeping the mapping in a separate vault. For masking, users without access see masked values, while approved roles can see real ones, and every reveal is logged. A healthcare insurer has handled 50M+ records with Protecto. See PII masking for AI and PHI de-identification for data lakes.
Frequently asked questions
Is masked data de-identified?
Usually not. Masking hides selected values, but the data is still about a real person. Under HIPAA it is de-identified only if it meets Safe Harbor or Expert Determination, which means handling every identifier, including those in free text.
Is data masking the same as encryption?
No. Encryption scrambles data so anyone with the key can read all of it. Masking hides values from people without access, and format-preserving masking keeps the data usable for testing and analytics.
Is data masking the same as anonymization?
No. Anonymization changes data so no one can reasonably link it back to a person. Masking only hides values from certain viewers, and the full data still exists.
Which methods can a de-identification platform use?
Common methods are removal, masking, tokenization, hashing, generalization, date shifting and synthetic replacement. A good platform applies them to both tables and free text and keeps tokens consistent so records still link.
