Guide

World Postal Code Formats — Complete Reference for Address Forms

March 25, 2026 11 min read CountryDataAPI Team

Reference guide to postal code formats around the world. Learn how zip codes vary by country, common validation patterns, and how to fetch them via REST API.

If you've ever built an international address form, you know that "zip code" doesn't mean the same thing in every country. Postal code formats vary wildly: the US uses 5 digits, the UK mixes letters and numbers, Canada has alphanumeric codes with a space in the middle, and some countries don't use postal codes at all. This guide is a complete reference to postal code formats around the world, with validation patterns and a programmatic source you can use.

Why Postal Code Validation Is Hard

The biggest mistake developers make is writing a single regex like /^\d{5}$/ and applying it globally. That works perfectly for US addresses and breaks immediately for everywhere else.

The reality is:

  • About 60 countries use a 5-digit numeric format (US, France, Germany, Spain, Italy, Mexico, Turkey, etc.)
  • About 30 countries use 4-digit numeric (Australia, Belgium, Switzerland, Norway, etc.)
  • About 20 countries use alphanumeric formats (UK, Canada, Netherlands, Argentina, etc.)
  • About 20 countries use 6 or more digits (India PIN, China, Russia)
  • About 10 countries have no postal code system at all (Hong Kong, UAE, Ireland traditionally — although Ireland now has Eircode)

Postal Code Formats by Country

Here's a reference table for the most common formats:

CountryISOFormatExampleRegex
United StatesUS5 digits, optional +494103 or 94103-1234^\d{5}(-\d{4})?$
United KingdomGBAlphanumeric with spaceSW1A 1AA^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$
CanadaCAA1A 1A1 (letter-digit-letter)K1A 0B1^[A-Z]\d[A-Z] ?\d[A-Z]\d$
GermanyDE5 digits10115^\d{5}$
FranceFR5 digits75001^\d{5}$
SpainES5 digits28001^\d{5}$
ItalyIT5 digits (CAP)00100^\d{5}$
NetherlandsNL4 digits + 2 letters1011 AB^\d{4} ?[A-Z]{2}$
BelgiumBE4 digits1000^\d{4}$
SwitzerlandCH4 digits8001^\d{4}$
AustriaAT4 digits1010^\d{4}$
AustraliaAU4 digits2000^\d{4}$
New ZealandNZ4 digits6011^\d{4}$
BrazilBR8 digits with hyphen (CEP)01310-100^\d{5}-?\d{3}$
MexicoMX5 digits06600^\d{5}$
JapanJP7 digits with hyphen100-0001^\d{3}-?\d{4}$
IndiaIN6 digits (PIN)110001^\d{6}$
ChinaCN6 digits100000^\d{6}$
RussiaRU6 digits101000^\d{6}$
South KoreaKR5 digits04524^\d{5}$
ArgentinaARLetter + 4 digits + 3 letters (CPA)C1425CLA^[A-Z]\d{4}[A-Z]{3}$
SwedenSE5 digits with space113 30^\d{3} ?\d{2}$
NorwayNO4 digits0150^\d{4}$
PolandPL2 digits + hyphen + 3 digits00-001^\d{2}-\d{3}$
PortugalPT4 digits + hyphen + 3 digits1000-001^\d{4}-\d{3}$

Countries Without Postal Codes

Some countries do not use postal codes at all. You should not require a postal code for addresses in:

  • Hong Kong
  • United Arab Emirates (uses P.O. Box system instead)
  • Qatar (P.O. Box system)
  • Yemen
  • Jamaica (no formal system; some districts use codes)
  • Most Pacific Island states (Fiji, Tonga, Samoa, Vanuatu)
  • Several African countries (Angola, Burkina Faso, Côte d'Ivoire, etc.)

Your address form should make the postal code field optional or hidden when one of these countries is selected. Forcing users to enter "00000" or "N/A" leads to bad data and form abandonment.

Special Cases You Should Know

UK postcodes are highly structured. A UK postcode like "SW1A 1AA" encodes the area (SW), district (1A), sector (1) and unit (AA). The first half (the "outward" code) identifies the post town and the second half identifies the delivery point. UK postcodes can have variable-length outward codes.

Canadian postal codes use a checksum-like alternation. They follow A1A 1A1 where A is a letter and 1 is a digit. The first letter identifies a province or sub-region (K = Eastern Ontario, M = Toronto, V = British Columbia).

Brazilian CEP includes a hyphen. The Brazilian Código de Endereçamento Postal is 8 digits commonly written with a hyphen after the 5th: "01310-100". Both formats (with and without hyphen) should be accepted.

Argentinian CPA replaced the older format. Argentina switched from a 4-digit numeric code to the alphanumeric CPA (Código Postal Argentino) in 1999. Some legacy systems still use the old 4-digit format, but new applications should accept the CPA.

Irish Eircode is relatively new. Ireland introduced Eircode in 2014. Before that, the Republic of Ireland had no postal code system. Eircode is "Routing Key + Unique Identifier" — for example "D02 X285" identifies a specific address, not just an area.

Fetching Postal Codes via REST API

Country Data API provides postal code data through the /v1/zipcode endpoints. To get all zip codes in a country:

GET https://api.countrydataapi.com/v1/zipcode/by-country?country=US
Authorization: Bearer YOUR_API_KEY

To get zip codes for a specific state:

GET https://api.countrydataapi.com/v1/zipcode/by-state?country=US&state=CA
Authorization: Bearer YOUR_API_KEY

To look up which country a zip code belongs to:

GET https://api.countrydataapi.com/v1/countries/by-zipcode?zipcode=10115
Authorization: Bearer YOUR_API_KEY

See the zip code endpoint documentation for full details.

Best Practices for Address Forms

  • Make the postal code field dynamic. Show or hide it based on the selected country, and update the regex/placeholder accordingly.
  • Auto-format on input. Insert the hyphen in Canadian or Brazilian postcodes automatically.
  • Don't validate too aggressively. Accept common variations (with or without spaces, uppercase or lowercase) and normalize on the server.
  • Use the API to autocomplete the city. When the user enters a postal code, query /v1/countries/by-zipcode to verify and pre-fill the city/state.

Get Started

Start integrating postal code data into your application: create a free account at CountryDataAPI. Plans start at $9.99/month with 10,000 monthly requests including 500,000+ postal codes worldwide.

See also the related guides on ISO country codes and address form validation.

Related Guides