# PII detection and redaction

PII redaction finds personally identifiable information (PII), such as names, emails and card numbers, and masks it before it reaches a model or leaves in a response.

## How it works

Detection comes first, and two methods are usually combined:

- **Patterns** for data with a fixed shape: emails, phone numbers, card numbers (confirmed with a checksum), national ID numbers.
- **Models** for data without one: names, addresses, health details. A model reads the context, so it can tell Jordan the person from Jordan the country.

Each span found is then replaced, usually with a typed placeholder: `Email me at ana@example.com` becomes `Email me at [EMAIL]`, and the sentence stays usable for the model.

## Detect, redact or block

Once PII is found, the [action](/glossary/guardrail-actions) is a separate choice:

- **Detect.** Let the text through and log or flag the finding. Use it to measure what flows through the app.
- **Redact.** Mask the spans and pass the rest. Use it when the task does not need the values.
- **Block.** Stop the whole message. Use it when the data must never enter or leave.

## Where to put it

On the input, before the model call, so personal data does not reach a third-party model. On the output, so the model does not repeat personal data from its context ([data leakage](/glossary/data-leakage)).

## With White Circle

[Control](/products/control) detects PII before the model call, and redact is one of the actions a policy can take.

