webfilteringdatabase.com
Home Find Your Solution
Features
Domain Categorization API Real-Time Classification 59 Filtering Categories Offline Database (100M) ML Classification Content Classification
Industries
K-12 Schools Corporate Healthcare Government ISPs
Tools
Domain Lookup Bulk Categorization Category Explorer
Resources
Pricing API Documentation Login / Sign Up
How-To Guide

How to Redact Physical Addresses

Learn how to automatically detect and redact street addresses, cities, zip codes, and location data from text and documents. Protect personal location information while maintaining data utility for geographic analysis.

11 min read Code examples included Updated Jan 2025
In This Guide Overview Why Redact Quick Start Address Types & Formats Techniques Code Examples Best Practices FAQ
Overview

Location Data Is Identifying Data

Physical addresses are critical personally identifiable information (PII) that can pinpoint where individuals live, work, or conduct business. An address can be used to locate someone physically, send unwanted communications, or combine with other data for identity theft.

Geographic Intelligence Meets NLP

Anonymization API uses advanced natural language processing combined with geographic databases to detect addresses with 98.5% accuracy across multiple countries and formats.

  • Our system recognizes full street addresses, partial addresses, PO boxes, apartment/unit numbers, and international address formats.
  • The API understands context to distinguish between addresses and similarly formatted non-address text.
  • Under many privacy regulations, addresses are classified as personal data requiring protection.

Before Anonymization

Patient resides at 123 Oak Street, Apt 4B, San Francisco, CA 94102

After Anonymization

Patient resides at [ADDRESS]

Whether you're processing medical records, customer databases, legal documents, or survey responses, our API ensures that location information is properly redacted while preserving the data's analytical value. We support multiple anonymization techniques from complete redaction to geographic generalization that maintains regional insights.

50+ Countries

Detect addresses in US, UK, EU, Asia, and more

Component Detection

Identify street, city, state, zip separately

Generalization

Preserve regional data while hiding specifics

Why Redact Physical Addresses

Privacy and Personal Safety at Stake

Physical addresses present significant privacy and safety risks. An address reveals where a person can be physically located, potentially exposing them to harassment, stalking, home invasion, or targeted crimes.

Combined with other information like names or schedules, addresses create serious personal safety concerns.

HIPAA (Healthcare)

Geographic data smaller than a state is one of the 18 HIPAA identifiers. Street address, city, and zip code must be removed for Safe Harbor de-identification. Only the first 3 digits of zip code may be retained (if population exceeds 20,000).

GDPR (Europe)

Home addresses are personal data under GDPR. Processing requires lawful basis and appropriate safeguards. Location data that can identify individuals requires explicit consent.

CCPA/CPRA (California)

Physical address is personal information that consumers have the right to know about, delete, and opt-out of sale.

FERPA (Education)

Student addresses in education records are protected and require consent for disclosure.

FCRA (Credit)

Address information in credit reports requires permissible purpose for access.

VAWA (Domestic Violence)

Address confidentiality programs protect survivors; improper disclosure can endanger lives.

Industry-Specific Use Cases

  • Healthcare: Patient addresses in medical records, appointment confirmations, and clinical notes must be de-identified for research, analytics, or sharing.
  • Real Estate: Property records and transaction data containing buyer/seller addresses need redaction before public analysis.
  • E-commerce: Order histories and shipping records contain customer addresses that should be anonymized for analytics.

 

  • Legal Services: Court documents, depositions, and case files often contain witness and party addresses requiring redaction.
  • Insurance: Claims data with policyholder addresses needs protection for actuarial analysis and third-party sharing.
  • Research: Survey responses and study data with participant addresses must be anonymized before publication.
Quick Start

Redact Addresses in a Few Lines of Code

Get started with address redaction in just a few lines of code. This example demonstrates the simplest way to detect and redact physical addresses from text using our API.

from anonymization import Client

client = Client(api_key="your_api_key")

result = client.anonymize(
    text="Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101",
    entity_types=["ADDRESS"]
)

print(result.anonymized_text)
# Output: Ship to: [ADDRESS]
const { AnonymizationClient } = require('@anonymization/api');

const client = new AnonymizationClient('your_api_key');

const result = await client.anonymize({
    text: "Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101",
    entityTypes: ["ADDRESS"]
});

console.log(result.anonymizedText);
// Output: Ship to: [ADDRESS]
curl -X POST https://api.anonymizationapi.com/v2/anonymize \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101",
    "entity_types": ["ADDRESS"]
  }'

The API response includes detailed information about the detected address and its components:

{
  "anonymized_text": "Ship to: [ADDRESS]",
  "entities": [
    {
      "type": "ADDRESS",
      "text": "456 Elm Avenue, Suite 200, Boston, MA 02101",
      "start": 9,
      "end": 51,
      "confidence": 0.97,
      "metadata": {
        "street": "456 Elm Avenue",
        "unit": "Suite 200",
        "city": "Boston",
        "state": "MA",
        "zip": "02101",
        "country": "US"
      }
    }
  ]
}
Address Types and Formats

From Main Street to Shibuya-ku

Addresses appear in many different formats depending on country, context, and writing style. Our API recognizes and handles all common variations.

US Address Formats
123 Main Street, New York, NY 10001 456 Oak Ave, Apt 2B, Los Angeles, CA 90210 789 Pine Road, Suite 100, Chicago, Illinois 60601 1010 Maple Dr., Houston TX 77001 P.O. Box 1234, Miami, FL 33101
International Address Formats
10 Downing Street, London SW1A 2AA, UK 123 Rue de Rivoli, 75001 Paris, France Hauptstrasse 45, 10115 Berlin, Germany 1-2-3 Shibuya, Shibuya-ku, Tokyo 150-0002, Japan Level 5, 123 Collins Street, Melbourne VIC 3000, Australia

Address Components

The API can detect and redact individual address components separately:

# Detect full addresses (default)
result = client.anonymize(text, entity_types=["ADDRESS"])

# Detect specific components
result = client.anonymize(text, entity_types=[
    "STREET_ADDRESS",   # Street number and name
    "CITY",              # City/town name
    "STATE",             # State/province
    "ZIP_CODE",          # Postal/zip code
    "COUNTRY"            # Country name
])

# Keep city/state, redact only street-level detail
result = client.anonymize(
    text="Lives at 123 Oak St, Boston, MA 02101",
    entity_types=["STREET_ADDRESS", "ZIP_CODE"]
)
# Output: Lives at [STREET_ADDRESS], Boston, MA [ZIP_CODE]

Special Address Types

The API recognizes various special address formats:

  • PO Boxes: P.O. Box 123, PO Box 456, Post Office Box 789
  • Rural Routes: RR 1 Box 234, Rural Route 2
  • Military Addresses: APO, FPO, DPO formats
  • Care Of: c/o John Smith, 123 Main St
  • Building Names: Empire State Building, 350 Fifth Avenue
Anonymization Techniques

Five Ways to Anonymize an Address

Choose the appropriate address anonymization technique based on your privacy requirements and analytical needs.

1

Full Redaction (Default)

Completely replaces the entire address with a placeholder. Maximum privacy protection, suitable for most compliance requirements.

Patient lives at 123 Oak Street, Boston, MA 02101
Patient lives at [ADDRESS]
2

Geographic Generalization

Preserves broader geographic information while removing specific location details. Useful for regional analysis while protecting individual addresses.

Patient lives at 123 Oak Street, Boston, MA 02101
Patient lives at [STREET], Boston, MA
3

Zip Code Truncation (HIPAA-Compliant)

Keeps only the first 3 digits of zip codes (for areas with population over 20,000), meeting HIPAA Safe Harbor requirements.

Patient lives at 123 Oak Street, Boston, MA 02101
Patient lives at [STREET], [CITY], MA 021**
4

State-Level Generalization

Reduces address to state level only. Provides maximum geographic generalization while maintaining basic regional classification.

Patient lives at 123 Oak Street, Boston, MA 02101
Patient lives in Massachusetts
5

Pseudonymization

Replaces with a fake but realistic-looking address. Useful for test data or when maintaining address format is important.

Patient lives at 123 Oak Street, Boston, MA 02101
Patient lives at 789 Maple Drive, Springfield, IL 62701
# Full redaction (default)
result = client.anonymize(text, entity_types=["ADDRESS"], mode="redact")

# Geographic generalization - keep city/state
result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize",
    options={"address_keep": ["city", "state"]})

# HIPAA-compliant zip truncation
result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize",
    options={"address_hipaa_zip": True})

# State-level only
result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize",
    options={"address_keep": ["state"]})

# Pseudonymization
result = client.anonymize(text, entity_types=["ADDRESS"], mode="pseudonymize")
Detection at a Glance

Location Privacy by the Numbers

98.5%Address detection accuracy on benchmark datasets
50+Countries with supported address formats
3Zip digits retained under HIPAA Safe Harbor truncation
5Anonymization techniques from redaction to generalization
Even partial addresses can be identifying. A street name combined with a unique first name, or a zip code combined with age and gender, may be enough to identify individuals in sparse populations. Consider your full data context when choosing anonymization levels.
Code Examples

Practical Recipes for Address Redaction

Processing Medical Records

HIPAA-compliant address redaction for healthcare data:

medical_records = [
    "Patient John Smith, 123 Oak St, Boston MA 02101, DOB: 03/15/1980",
    "Home visit scheduled at 456 Elm Ave Apt 2B, Chicago IL 60601",
    "Send prescriptions to P.O. Box 789, New York, NY 10001"
]

# HIPAA Safe Harbor compliant redaction
results = client.batch_anonymize(
    items=[{"text": record} for record in medical_records],
    entity_types=["PERSON", "ADDRESS", "DATE_OF_BIRTH"],
    options={"address_hipaa_zip": True}
)

for r in results:
    print(r.anonymized_text)

Regional Analysis with Generalization

Keep geographic regions while protecting specific addresses:

customer_data = """
Customer: Jane Doe
Address: 789 Pine Road, Suite 100, San Francisco, CA 94102
Delivery Notes: Leave at back door
"""

# Keep city and state for regional analysis
result = client.anonymize(
    text=customer_data,
    entity_types=["PERSON", "ADDRESS"],
    mode="generalize",
    options={"address_keep": ["city", "state"]}
)

print(result.anonymized_text)
# Customer: [PERSON]
# Address: [STREET], San Francisco, CA
# Delivery Notes: Leave at back door

Multi-Country Address Detection

Handle international addresses with country-specific formatting:

international_text = """
US Office: 100 Broadway, New York, NY 10005
UK Office: 10 Downing Street, London SW1A 2AA
Germany Office: Friedrichstrasse 123, 10117 Berlin
"""

result = client.anonymize(
    text=international_text,
    entity_types=["ADDRESS"],
    options={"address_countries": ["US", "GB", "DE"]}
)

print(result.anonymized_text)
# US Office: [ADDRESS]
# UK Office: [ADDRESS]
# Germany Office: [ADDRESS]

Preserving Business Addresses

Redact residential addresses while keeping business locations:

# Allow-list known business addresses
result = client.anonymize(
    text="Customer at 123 Oak St, Boston. Visit us at 1 Infinite Loop, Cupertino",
    entity_types=["ADDRESS"],
    options={
        "allow_list": ["1 Infinite Loop, Cupertino"]
    }
)

print(result.anonymized_text)
# Customer at [ADDRESS]. Visit us at 1 Infinite Loop, Cupertino
Best Practices

Get Address Redaction Right in Production

Consider Re-identification Risk

Even generalized address data can be identifying when combined with other fields:

# Combine address redaction with other PII for complete protection
result = client.anonymize(
    text=text,
    entity_types=[
        "ADDRESS",
        "PERSON",
        "DATE_OF_BIRTH",
        "PHONE",
        "EMAIL"
    ]
)

# In sparse populations, zip code + age + gender can be identifying
# Consider more aggressive generalization for sensitive datasets

Handle Partial Addresses

Addresses may appear incomplete or spread across multiple fields:

# Detect partial addresses and components
result = client.anonymize(
    text="Lives in 02101",  # Just a zip code
    entity_types=["ADDRESS", "ZIP_CODE"]
)

# Enable aggressive partial detection
result = client.anonymize(
    text=text,
    entity_types=["ADDRESS"],
    options={"address_detect_partial": True}
)

Use Context-Aware Detection

Enable context analysis to distinguish addresses from similarly formatted text:

# Context helps distinguish "123 Main St" from "123 main points"
result = client.anonymize(
    text=text,
    entity_types=["ADDRESS"],
    options={"use_context": True}
)

HIPAA Safe Harbor Compliance

For healthcare data, ensure addresses meet Safe Harbor requirements:

  • Remove street address, city name, and full zip code
  • First 3 digits of zip may be retained if population exceeds 20,000
  • Geographic unit smaller than state must be removed

HIPAA Note: Use options={"address_hipaa_zip": True} to automatically apply Safe Harbor zip code rules. This will truncate to 3 digits for high-population areas and fully redact for low-population areas.

Test with Diverse Address Formats

Before production, test with addresses in various formats you expect to encounter:

  • Standard US addresses with variations (Ave, Avenue, Av.)
  • Apartment and suite numbers in different positions
  • PO Boxes and rural routes
  • International formats if applicable
  • Addresses with typos or OCR errors
FAQ

Frequently Asked Questions

How accurate is address detection?

Our address detection achieves 98.5% accuracy on benchmark datasets covering US and international formats. Accuracy is highest for complete, well-formatted addresses and may be lower for partial addresses or unusual formats. Context-aware detection significantly reduces false positives.

Can I detect addresses in different languages?

Yes, the API supports address detection in multiple languages and scripts. For non-Latin scripts (Chinese, Arabic, Japanese), specify the language for better accuracy: options={"language": "ja"}.

How do I handle addresses spanning multiple lines?

The API handles multi-line addresses by default. It recognizes address components that span line breaks and treats them as a single address entity.

What about GPS coordinates?

GPS coordinates (latitude/longitude) can be detected with: entity_types=["ADDRESS", "COORDINATES"]. Coordinates are often more precise than street addresses and should be treated as sensitive location data.

Can I detect landmark names as addresses?

Landmark names (Empire State Building, Eiffel Tower) are detected when they appear as addresses or locations. Pure landmark mentions without address context can be detected with: entity_types=["LOCATION"].

How do I handle address verification needs?

If you need to verify addresses before redacting (e.g., for shipping validation), process the address first, then redact for storage. The API can return parsed address components without redacting, which you can use for validation.

What's the difference between ADDRESS and LOCATION?

ADDRESS refers to specific postal addresses (123 Main St). LOCATION includes broader geographic references (downtown Boston, near Central Park). For maximum protection, enable both: entity_types=["ADDRESS", "LOCATION"].

Related Guides

Keep Building Your Redaction Pipeline

Start Redacting Addresses Today

Protect location data with 98.5% accurate address detection. Support for 50+ countries and HIPAA-compliant options.

Get Started Free