LLM Guardrails & PII Redactor
Build and test deterministic PII redaction rules entirely in your browser
Built-in email, phone, T.C. identity, Luhn credit card, Turkish IBAN, IPv4, and SSN detectors plus custom regular expressions. All processing is client-side.
Examples
TCKN plus Luhn filtering
scanGuardrails("IDs: 10000000146, 10000000147", defaultGuardrailRules()){ findings: [{ ruleId: "tckn", match: "10000000146" }] }The checksum-valid TCKN is flagged while the failing neighbor is skipped.
Custom API-key rule
scanGuardrails("Key sk-Ab12Cd34", [...defaults, { id: "api-key", pattern: "sk-[A-Za-z0-9]{8}", strategy: "mask" }]){ redactedText: "Key ***********" }A custom regex appends cleanly and masks with same-length asterisks.
About this tool
LLM Guardrails Builder redacts sensitive text with scanGuardrails(text, rules): defaultGuardrailRules ships email, TR/international phone, T.C. identity number (checksum-validated), credit card (Luhn-validated), Turkey IBAN, IPv4, and US SSN patterns, each with mask/hash/remove strategies. Findings carry ruleId, ruleName, start/end offsets, match, and strategy, and redactedText applies non-overlapping replacements in order.
Validation is strict where it matters: TCKN candidates must pass the 11-digit checksum (leading zero rejected) and card candidates must pass Luhn, so card-like digit runs that fail the check are left untouched. Masking replaces each character with *, hashing emits a stable [HASH_xxxxxxxx] FNV-1a digest, and remove deletes the match.
Rule sets round-trip as JSON via exportGuardrailRules/importGuardrailRules (versioned { version: 1, rules }), custom rules add any { id, name, pattern, flags, strategy } regex, and invalid patterns are skipped instead of throwing while malformed rule-set JSON throws a clear error.
How to use this tool
Load the defaults
Call defaultGuardrailRules for the seven built-ins, then append custom { id, pattern, strategy } entries as needed.
Scan the text
Run scanGuardrails and read findings for offsets plus redactedText for the safe-to-log version.
Choose a strategy
Use mask for same-length redaction, hash for joinable pseudonyms, or remove for full deletion.
Persist the rule set
Export to JSON for review and re-import on load; invalid files throw an explicit error.
Use cases
Scrubbing prompts before logging
Redact emails, phones, TCKN, cards, IBANs, and IPs from LLM inputs before they hit disks or vendors.
Enforcing TR data handling
Catch T.C. identity numbers and Turkey IBANs with checksum-aware rules tuned for Turkish formats.
Sharing versioned redaction policy
Export the rule set as JSON so reviewers audit patterns and strategies in pull requests.
Common mistakes
Mistake:Assuming every 11-digit number is a TCKN.
Fix:Only checksum-passing values flag — leading-zero and failing numbers are intentionally ignored.
Mistake:Expecting card-like digits to always redact.
Fix:Card candidates must pass Luhn; 4111 1111 1111 1112 stays visible because the check digit fails.
Mistake:Using overlapping custom patterns without ordering.
Fix:Overlaps resolve by start offset, so keep the narrower rule first or widen one pattern to avoid shadowing.
Frequently asked questions
What does this tool do?
It redacts sensitive text with scanGuardrails: email, phone, checksum-validated TCKN, Luhn-validated cards, Turkey IBAN, IPv4, and SSN built-ins with mask/hash/remove strategies, plus custom regex rules and JSON export/import.
Why was one TCKN or card number skipped?
Only checksum-passing values flag — 10000000146 redacts but 10000000147 does not, and 4111 1111 1111 1112 stays visible because it fails Luhn.
Is my text uploaded or stored?
No. Pattern matching, checksum checks, and redaction run entirely in your browser.
How does masking look, and how do custom rules work?
Masking replaces each character with * at the same length. Add any { id, name, pattern, strategy } regex (e.g. sk-[A-Za-z0-9]{8}) and it scans alongside the built-ins.
Related guides
References & standards
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language