Skip to content

Data Protection

Data Redaction vs Data Masking: What's the Difference?

A plain-language explainer with examples, from the Maskflare glossary.
Related concepts
  • Redaction
  • Masking
  • Reversibility

Short answer

Redaction removes sensitive data, usually for good: a black bar or [REDACTED] takes its place. Masking replaces the value with something else, such as a partial value, a fake value or a token, and some masking can be reversed by whoever holds the key. Redact when nobody downstream needs the value. Mask when the data must stay usable.

The same sentence, four ways

The quickest way to see the difference is to run one sentence through each technique. Here's a refund instruction a finance team might paste into an AI assistant:

TechniqueResultReversible?
OriginalRefund CHF 2,400 to Ada Lovelace, IBAN CH93 0076 2011 6238 5295 7-
RedactionRefund CHF 2,400 to [REDACTED], IBAN [REDACTED]No
Partial maskingRefund CHF 2,400 to A* L*, IBAN CH93 ** 95 7No
Tokenization (reversible masking)Refund CHF 2,400 to mf_mask_170b..., IBAN mf_mask_d7e0...Yes, with access to the token store
Format-preserving encryptionRefund CHF 2,400 to Kvo Mrtpwqzx, IBAN CH51 8812 0457 9930 1146 2Yes, with the key

Redaction keeps the shape of the sentence and throws the values away. Every form of masking keeps something: a hint of the original, a token that points back to it, or a value in the same format that can be decrypted.

What is data redaction?

Redaction is the removal of sensitive content so that it can't be recovered from the output. In a PDF it's a black bar (done properly, with the underlying text deleted, not just covered). In text it's a label such as [REDACTED] or [EMAIL]. The point of redaction is that there's no way back: nobody holds a key, and there's nothing to leak later.

What is data masking?

Masking is a broader family. It replaces sensitive values with substitutes that keep some usefulness. The common kinds:

  • Partial masking: show the last four digits of a card, hide the rest.
  • Substitution: swap real names for realistic fake ones, common in test data.
  • Tokenization: swap each value for a random token and keep the mapping in a secure store. See reversible tokenization.
  • Deterministic masking: the same value always gets the same token, so joins, search and embeddings still work.
  • Format-preserving encryption: encrypt the value into something with the same format, such as a valid-looking IBAN, decryptable with the key.
  • Static vs dynamic: static masking changes a copy of the data at rest; dynamic masking changes it on the fly as it's read or sent.

Redaction vs masking side by side

RedactionMasking
What happens to the valueRemovedReplaced
Can it be reversed?NoDepends on the method: tokens and FPE yes, partial masking no
Keeps formatNoOften (partial, FPE)
Keeps usefulnessLow: text reads oddlyHigh: models, tests and joins still work
Ongoing riskNone from the outputThe token store or key must be protected
GDPR status of the outputCan be anonymous if nothing else identifies the personPseudonymized, still personal data, if reversible
Typical usePublishing, legal disclosure, logsTest data, support screens, AI prompts, analytics

When should you use redaction?

  • Publishing documents: court filings, freedom-of-information responses, PDFs sent outside the company.
  • Logs and analytics where nobody will ever need the real value. See PII redaction for logs.
  • Data you're legally required to remove, not just hide.

Redaction is simple and final, and that's both the strength and the problem. If an AI assistant drafts "Dear [REDACTED]", someone has to fix it by hand. Do that forty times a day and people stop using the assistant, or stop redacting.

When should you use masking?

  • Test and development data that must look real but can't be real.
  • Customer support screens, showing the last four digits of a card.
  • AI prompts and responses. The model works on tokens and the person reading the answer sees the real values again. This is reversible masking, and it's what Maskflare does by default.
  • Search and RAG over sensitive documents. Deterministic masking gives the same value the same token every time, so matching still works. See RAG and embeddings.

What does GDPR call them?

GDPR doesn't use the words "masking" or "redaction". It talks about anonymization and pseudonymization.

  • Anonymized data can't be linked back to a person by anyone, with any means reasonably likely to be used (Recital 26). GDPR no longer applies to it.
  • Pseudonymized data (Article 4(5)) can be linked back with extra information that's kept separately, such as a token store or key. It's still personal data, but GDPR treats pseudonymization as a recognized safeguard.

Thorough redaction can produce anonymized data, but only if nothing left in the text identifies the person. Reversible masking is pseudonymization by design. The full comparison is in pseudonymization vs anonymization. Not legal advice.

Which one should you use for AI prompts?

Reversible masking, in almost every case. Here's the same prompt under each approach:

Redaction vs reversible masking in an AI prompt
Prompt:   Write a short reply to Ada Lovelace confirming her refund of CHF 2,400.

Redacted: Write a short reply to [REDACTED] confirming her refund of CHF 2,400.
Answer:   Dear [REDACTED], we have processed your refund of CHF 2,400...

Masked:   Write a short reply to mf_mask_170b... confirming her refund of CHF 2,400.
Model:    Dear mf_mask_170b..., we have processed your refund of CHF 2,400...
Restored: Dear Ada Lovelace, we have processed your refund of CHF 2,400...

The provider sees the same thing in both cases: no name. Only the masked version gives the user a reply they can send. In Maskflare each rule picks its own action, so you can mask names and IBANs, redact anything nobody needs back, and block credentials outright in the same policy.

What are the common mistakes?

  • Redacting the IBAN but leaving the name and city, which together identify the person anyway.
  • Masking with a pattern that ignores checksums. Half your order numbers end up masked as card numbers, and people stop trusting the tool.
  • Calling partially masked data "anonymous". Four digits plus a postcode is often enough to find someone.
  • Masking the prompt but logging the original in your own application.
  • Covering text in a PDF without deleting it, so a copy and paste brings the original back.

Frequently asked questions

Is tokenization the same as masking?

Tokenization is one kind of masking: the value is swapped for a random token, and a secure store maps it back.

Is masked data still personal data under GDPR?

If it can be reversed, yes. It's pseudonymized. If it truly can't be linked back by anyone with reasonably likely means, it's anonymized.

Which is better for ChatGPT and other AI tools?

Reversible masking. The provider never sees the real values, and the answer still makes sense once the values are restored.

Is data masking the same as encryption?

Format-preserving encryption is a kind of masking, but most masking isn't encryption. Partial masking and redaction can't be undone at all, and tokenization uses a lookup store rather than a key.

Can I use redaction and masking together?

Yes, and most policies should. Mask the values the answer needs, redact the ones nobody needs back, and block secrets.