496+ Tools Comprehensive Tools for Webmasters, Developers & Site Optimization

Postal Code Validator - ZIP Code Format Validation

Postal Code Validator

Validate postal codes for different countries

Enter a postal/ZIP code

About Postal Codes

Postal codes (also known as ZIP codes in the United States, postcodes in the United Kingdom, and postal codes in Canada) are alphanumeric codes used by postal services to identify geographic regions for mail delivery. These codes help postal services efficiently sort and deliver mail by dividing countries into smaller geographic areas. Different countries use different formats, lengths, and conventions for their postal code systems, making validation an important step in address verification and data quality management.

United States ZIP Codes

ZIP (Zone Improvement Plan) codes were introduced by the United States Postal Service (USPS) in 1963:

  • ZIP Code (5-digit): Basic format, identifies a delivery area (e.g., 90210)
  • ZIP+4: Extended format, identifies a specific delivery route (e.g., 90210-1234)
  • First Digit: Identifies a national area (0-9)
  • Second/Third Digits: Identify a region or large city
  • Fourth/Fifth Digits: Identify a local delivery area
  • Plus 4: Identifies a specific delivery segment (block, building, or group of apartments)

ZIP Code Regions (First Digit)

First Digit Region
0 Connecticut, Massachusetts, Maine, New Hampshire, New Jersey, Rhode Island, Vermont
1 Delaware, New York, Pennsylvania
2 District of Columbia, Maryland, North Carolina, South Carolina, Virginia, West Virginia
3 Alabama, Florida, Georgia, Mississippi, Tennessee
4 Indiana, Kentucky, Michigan, Ohio
5 Iowa, Minnesota, Montana, North Dakota, South Dakota, Wisconsin
6 Illinois, Kansas, Missouri, Nebraska
7 Arkansas, Louisiana, Oklahoma, Texas
8 Arizona, Colorado, Idaho, New Mexico, Nevada, Utah, Wyoming
9 Alaska, California, Hawaii, Oregon, Washington

United Kingdom Postcodes

UK postcodes consist of two parts separated by a space:

  • Outward Code: First part, identifies the postal district (e.g., SW1A)
  • Inward Code: Second part, identifies the delivery point (e.g., 1AA)
  • Format Variations: A9 9AA, A99 9AA, AA9 9AA, AA99 9AA, A9A 9AA, AA9A 9AA
  • Area Code: 1-2 letters identifying the postal area (e.g., SW for South West London)
  • District: 1-2 digits identifying the district within the area
  • Sector: Single digit in the inward code
  • Unit: Two letters identifying the delivery point (usually about 15 properties)

UK Postcode Examples

Format Example Location
AA9A 9AA SW1A 1AA Buckingham Palace, London
A9A 9AA W1A 0AX BBC Broadcasting House, London
A9 9AA M1 1AE Manchester city center
A99 9AA B33 8TH Birmingham
AA9 9AA CR2 6XH Croydon, South London
AA99 9AA DN55 1PT Doncaster

Canadian Postal Codes

Canada Post uses a six-character alphanumeric format:

  • Format: A9A 9A9 (letter-digit-letter space digit-letter-digit)
  • FSA (Forward Sortation Area): First three characters identify region
  • LDU (Local Delivery Unit): Last three characters identify delivery area
  • First Character: Identifies province or territory
  • Second Character: Identifies urban (0) or rural (non-zero) area
  • Examples: K1A 0B1 (Ottawa), M5H 2N2 (Toronto), V6B 4Y8 (Vancouver)

Canadian Postal Code Regions

First Letter Province/Territory
A Newfoundland and Labrador
B Nova Scotia
C Prince Edward Island
E New Brunswick
G, H, J Quebec
K, L, M, N, P Ontario
R Manitoba
S Saskatchewan
T Alberta
V British Columbia
X Northwest Territories, Nunavut
Y Yukon

When to Use Postal Code Validation

  • E-commerce: Validate shipping addresses during checkout
  • Address Forms: Ensure postal codes match selected country
  • Geographic Analysis: Filter and analyze data by postal code regions
  • Delivery Planning: Optimize routes based on postal codes
  • Marketing Campaigns: Target specific geographic areas
  • Data Quality: Clean and standardize address databases

Postal Code Systems Worldwide

Country Format Example
United States 99999 or 99999-9999 90210, 10001-5432
United Kingdom AA9A 9AA (varies) SW1A 1AA
Canada A9A 9A9 K1A 0B1
Germany 99999 10117
France 99999 75001
Australia 9999 2000
Japan 999-9999 100-0001
Netherlands 9999 AA 1012 JS

Special Postal Codes

  • US 00000: Invalid, not assigned
  • US 20500: The White House, Washington DC
  • UK SW1A 1AA: Buckingham Palace, London
  • Canada K1A 0B1: Canada Post headquarters, Ottawa
  • Santa Claus: H0H 0H0 (Canada), 99705 (Alaska, US)

Test Postal Codes

Country Valid Test Codes
United States 12345, 90210, 10001-5432
United Kingdom SW1A 1AA, W1A 0AX, M1 1AE
Canada K1A 0B1, M5H 2N2, V6B 4Y8

Limitations

Important: This validator checks format only. It does NOT:
  • Verify if the postal code actually exists
  • Check if the postal code matches the city/state
  • Validate against postal service databases
  • Determine delivery points or mail routing
  • Check for recently added or changed postal codes

Best Practices

  • Always validate postal codes based on the selected country
  • Accept both with and without spaces/hyphens in input
  • Store postal codes in a consistent format (uppercase, with standard spacing)
  • Provide clear format examples in form labels
  • Consider using autocomplete for postal codes with city/state
  • Implement server-side validation in addition to client-side
  • Use postal code APIs for comprehensive validation
  • Handle international addresses appropriately

Address Autocomplete

Many services offer postal code-based address autocomplete:

  • Google Maps Places API: Autocomplete and validation
  • USPS Address API: US address validation
  • Loqate (PCA Predict): International address validation
  • SmartyStreets: US and international address verification

Additional Resources