# Presidio

> Detect and de-identify PII in text, images, and structured data

- Category: Evaluation & Production Ops / Guardrails & Security
- Language: Python
- Licence: MIT
- Repository: https://github.com/data-privacy-stack/presidio
- Website: https://presidio.dataprivacystack.org
- Canonical page: https://ai-tldr.dev/tools/microsoft-presidio/
- Updated: 2026-06-24

## In short

Presidio is an open-source SDK for finding and removing personal data (PII) such as names, phone numbers, credit card numbers, locations, and social security numbers. It splits the job into two main packages: an Analyzer that identifies where PII appears in a piece of text, and an Anonymizer that replaces, masks, or redacts those spans. It sits in the Guardrails & Security category of the Evaluation & Production Ops tools and is open-source, written in Python and licensed MIT.

## Overview

Presidio is an open-source SDK for finding and removing personal data (PII) such as names, phone numbers, credit card numbers, locations, and social security numbers. It splits the job into two main packages: an Analyzer that identifies where PII appears in a piece of text, and an Anonymizer that replaces, masks, or redacts those spans. Separate packages handle redacting PII in images (including DICOM medical images) and in structured data.

It is aimed at teams that need to keep sensitive data out of logs, datasets, or model prompts. Detection combines Named Entity Recognition (NER) models, regular expressions, rule-based logic, and checksums, and you can add your own custom recognizers when the built-in ones do not cover an entity you care about.

As a guardrails and PII-security tool, Presidio fits into data pipelines and pre-processing steps. It runs from Python or PySpark and can be deployed with Docker or Kubernetes. Started at Microsoft, the project is transitioning to community governance under the Data Privacy Stack organization, staying MIT-licensed. The maintainers note that automated detection has no guarantee of finding every piece of sensitive data, so it should be paired with other safeguards.

## What it does

- Predefined and custom PII recognizers built on NER, regular expressions, rule-based logic, and checksums, with context awareness in multiple languages
- Anonymizer module to replace, mask, redact, or otherwise transform detected PII spans using configurable operators
- Image redaction for standard image formats and DICOM medical images
- Support for structured and tabular data through the presidio-structured package
- Options to connect to external PII detection models instead of, or alongside, the built-in ones
- Multiple deployment paths: Python or PySpark workloads, Docker containers, and Kubernetes

## Getting started

Presidio is distributed as separate pip packages. Install the analyzer and anonymizer, download a spaCy model for NER, then detect and de-identify PII in a string.

1. Install the packages and NLP model

   Install the analyzer and anonymizer, then download the default spaCy English model used for named-entity recognition.

```bash
pip install presidio_analyzer
pip install presidio_anonymizer
python -m spacy download en_core_web_lg
```

2. Detect PII with the Analyzer

   Create an AnalyzerEngine and call analyze() with the text, the entities to look for, and the language.

```python
from presidio_analyzer import AnalyzerEngine

analyzer = AnalyzerEngine()

results = analyzer.analyze(text="My phone number is 212-555-5555",
                            entities=["PHONE_NUMBER"],
                            language='en')
print(results)
```

3. Anonymize the detected spans

   Pass detection results to the AnonymizerEngine and supply operators that decide how each entity type is transformed.

```python
from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import RecognizerResult, OperatorConfig

engine = AnonymizerEngine()

result = engine.anonymize(
    text="My name is Bond, James Bond",
    analyzer_results=[
        RecognizerResult(entity_type="PERSON", start=11, end=15, score=0.8),
        RecognizerResult(entity_type="PERSON", start=17, end=27, score=0.8),
    ],
    operators={"PERSON": OperatorConfig("replace", {"new_value": "BIP"})},
)

print(result)
```

## When to use it

- Scrub PII from application logs, support transcripts, or datasets before they are stored or shared
- Pre-process prompts and documents to remove personal data before sending them to an LLM
- Redact names, IDs, and other identifiers from images and DICOM medical scans
- De-identify columns in structured or tabular data as part of a data pipeline

## Version history

- 2026-06-24: Presidio moved from Microsoft to community governance under the Data Privacy Stack GitHub organization, staying open source under the MIT license. New Docker images publish to ghcr.io/data-privacy-stack/presidio-*; the legacy mcr.microsoft.com/presidio-* images remain for older tags but are no longer updated.
