Presidio
PackageOpen-source library for detecting and anonymizing PII in text and images
- Price
- Free, open source
- Access
- None, runs locally
About
Python framework that finds PII such as names, phone numbers, card numbers and national IDs with NER, regex and checksums, then masks, replaces or encrypts it. Runs locally or as Docker services. Now community-run by Data Privacy Stack; it can miss some PII.
What you can do with it
- Detect names, phone numbers, emails and card numbers in free text
- Redact, mask, hash or encrypt PII before text reaches an LLM or a log
- Redact PII burned into images and DICOM medical scans
Get started
- pip install presidio-analyzer presidio-anonymizer
- python -m spacy download en_core_web_lg
Example
from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine
text = "My phone number is 212-555-5555"
results = AnalyzerEngine().analyze(text=text, entities=["PHONE_NUMBER"], language="en")
print(AnonymizerEngine().anonymize(text=text, analyzer_results=results).text)
# My phone number is <PHONE_NUMBER>Details
- Hosting
- Self-hosted, Runs locally
- Available in
- Worldwide
- Official SDKs
- Python
- MCP server
- None