PII redaction
PII redaction is the detection and removal or masking of personally identifiable information, such as names, phone numbers, addresses and card numbers, from text or images before it is sent to a model, stored in logs or shown to others.
Also called: PII, personally identifiable information, PII masking, de-identification
By Divya Sharma · Checked Nov 15, 2026 · How we review
Personally identifiable information (PII) is information that can identify a specific person, alone or combined with other data. NIST's guide SP 800-122 is a common reference for what counts and how to protect it. AI applications handle a lot of it: support chats, uploaded documents, call transcripts and the prompt logs kept for debugging.
Why it matters when building with AI
Every prompt sent to a hosted model leaves your system. Every trace your LLM observability tool stores is another copy. Redacting PII first reduces what a provider, a log viewer or an attacker can see, and it can stop personal data from ending up in fine-tuning sets. It sits naturally in the input side of your guardrails.
How it works
A detector scans the text for entities. Simple ones use patterns and checksums, for example for card or national ID numbers. Others use named-entity recognition models to find names and places, which patterns miss. Each match is then replaced: deleted, masked with a label such as `<PERSON>`, or swapped for a consistent placeholder or fake value so the model can still follow the conversation. Some systems keep a secure mapping so the real values can be put back in the final answer. Microsoft's open-source Presidio, now a community project, is a widely used toolkit that detects and anonymises entities in text and images.
Limits
Detection is never perfect. Unusual names, misspellings, free-form addresses and context clues slip through, while aggressive settings remove words the model needed. Redaction also does not settle where data is processed or kept; see data residency and zero data retention. What counts as PII, and what you must do with it, depends on the laws that apply to you, which this page does not cover.
Related terms
- Guardrails (AI)
- Guardrails are runtime checks placed around a language model that inspect inputs and outputs and block, rewrite or redirect them, so an application stays on topic, avoids harmful content and follows rules the model alone would not reliably keep.
- Data residency
- Data residency is a control that keeps a customer's data stored, and often processed, in a chosen geographic region such as the EU, so a team can meet its own legal, contractual or customer rules on where data lives.
- Zero data retention
- Zero data retention (ZDR) is an arrangement in which an AI provider does not keep a customer's prompts and outputs after a request is answered, usually offered only to approved customers and only for eligible API features.
- LLM observability
- LLM observability is recording what an AI application does in production, including prompts, responses, tool calls, latency, token use and cost, as traces you can search, so you can debug failures and see how the system behaves over time.