PII redaction
PII Redaction (Open Source, Self-Hosted)
PII redaction removes emails, names, phone numbers, card data, and other sensitive text from input before you store it or send it elsewhere. Use it on AI APIs, production logs, and exported data.
Why PII redaction matters
- Prevent leaking sensitive data to AI APIs
- Reduce GDPR and compliance risk
- Keep logs and datasets safe
- Avoid sending user data to third-party services
Example
Input
My name is John, email john@email.com, phone 555-123-4567, card 4111 1111 1111 1111
Example output
My name is [REDACTED], email [REDACTED], phone [REDACTED], card [REDACTED]
PII redaction in Node.js
Install and use in a Node.js app:
npm install openredaction
import { redact } from "openredaction";
const input = "Contact me at jane@company.com";
const { redactedText } = redact(input);
console.log(redactedText);Features
- Runs locally
- 500+ built-in regex patterns
- Deterministic output
- Fast for inline use
- Open source and self-hosted
Open source vs managed redaction
| OpenRedaction | AWS / Google DLP |
|---|---|
| Runs locally | Cloud |
| No data leaves system | Sent externally |
| Deterministic (regex) | ML-based |
| Free / open source | Usage pricing |
| Fully auditable | Limited visibility |
Use cases
- Redact user input before sending to OpenAI
- Sanitise production logs
- Clean exported customer datasets
- Process form submissions safely
Regex vs AI
Regex is fast and predictable for known patterns.
AI can help with messy or unstructured text.
Many teams use regex first, then AI if they need it.
Use it locally in your app.