💙 Supporting healthcare non-profits: Metadataloop is free for 6–12 months. Contact Us to get started.
Developer Utility

PII Detector & Masking SQL Generator

Paste a CREATE TABLE schema — detect likely personally-identifiable columns (emails, names, SSNs, cards, addresses, health data) by name heuristics, and get ready-to-run UPDATE masking SQL for your dialect.

Dialect
Input · CREATE TABLE SQL
Detected PII & Masking SQL
Detected PII columns will appear here.
-- Masking SQL will appear here.

Detect PII columns and generate masking SQL automatically

Before copying production data into a staging or dev environment, sensitive columns should be masked or anonymized. This tool scans your CREATE TABLE schema for 15+ categories of likely-PII columns by name heuristics, then generates dialect-aware UPDATE statements to mask them.

Detected categories

  • Direct identifiers: email, phone, SSN, passport, driver's license.
  • Financial: credit card numbers, bank account / IBAN / routing numbers.
  • Personal: first/last/full name, username, date of birth, gender, street address.
  • Technical: IP address.
  • Sensitive: health/medical fields, passwords and other stored secrets.

Masking strategy per category

  • Names / emails: one-way hashed with MD5() (HASHBYTES('MD5', ...) on SQL Server).
  • Phone / SSN / cards / accounts: partially masked, keeping only the last 4 digits for referential usefulness in testing.
  • Address / IP / gender: replaced with a fixed placeholder value.
  • Secrets / health data: fully redacted to [REDACTED].
  • Date of birth: set to NULL to avoid re-identification via age.

FAQ

Does this run against my real database? No — it only analyzes the schema text you paste and returns SQL for you to review and run yourself.

Is name-based detection reliable? It catches the vast majority of conventionally-named columns, but always review the report — a human check is required before running masking SQL against real data, especially for compliance (GDPR/CCPA/HIPAA) purposes.

Can I customize the masking expressions? Yes — copy the generated SQL and adjust the SET clauses to match your organization's specific anonymization policy.

⚠ Confirm Delete