Address Normalization and Duplicate Detection

The same address can be typed dozens of ways. Without normalization, your database fills with near-duplicates that break reporting and waste postage.

Common variations

  • 123 North Main Street
  • 123 N Main St.
  • 123 n. main st

All three are the same place.

A normalization checklist

  • Convert to uppercase.
  • Remove punctuation except hyphens in ZIP+4.
  • Replace suffixes and directionals with USPS abbreviations.
  • Standardize unit designators to APT, STE, UNIT and similar.
  • Trim extra spaces.
  • Keep ZIP codes as five-character text.

Matching after normalization

Compare the normalized street line, unit, and ZIP code together. City names can vary for the same ZIP, so they are a weaker signal.

Use a validation service when it counts

For shipping and billing, a CASS-certified address validation service returns the official form of an address. Normalize locally for speed and use the service for final checks.

Test your rules

Take a batch of generated addresses, create variations by hand (spelled-out suffixes, lowercase, extra punctuation) and run them through your code. Every variation should normalize back to the original.

Generate realistic US addresses for forms, databases and design mockups, then copy or download them as CSV or JSON.

Open the address generator