Postal Code Formats Around the World, Explained
ZIP code vs postal code: what the difference is, and the postal code format in the UK, Canada, Germany and more, with examples.
By Vincent RuanPublished July 13, 2026Last updated October 1, 20268 min read

Every address form eventually meets a postal code it did not expect. It may have letters where digits should be, four characters instead of five, a space in the middle, or no code at all. Postal codes are among the least standardized parts of an address, because each country built its own scheme for its own sorting machines. This guide tours the major formats and what their characters encode. It ends with what that means for validating addresses and generating realistic test addresses.
What a postal code actually encodes
Whatever the format, nearly every system reads left to right, from coarse to fine. The first character or two selects a broad region, such as a numbering zone, a province or a postcode area. Each following character narrows toward a sorting office and then a delivery area. The Universal Postal Union, whose 192 member countries carry international mail, promotes this kind of structured addressing. A machine can route an envelope most of the way on the code alone [upu]. The differences are the alphabet each country chose, digits only or letters too, and how fine the last characters go.
| Country | Local name | Format | Example | Leading part encodes |
|---|---|---|---|---|
| United States | ZIP Code | NNNNN (+4 optional) | 90210 | National zone 0–9, east to west [zip-wiki] |
| United Kingdom | Postcode | 1–2 letters + digit(s), space, N + 2 letters | EC1A 1BB | Postcode area (121 geographic areas) [uk-postcodes] |
| Canada | Postal code | ANA NAN | K1A 0B1 | Province/region letter [ca-postal] |
| Germany | PLZ | NNNNN | 10115 | Leitzone (broad region) |
| France | Code postal | NNNNN | 75001 | Département (first two digits) |
| Japan | Yūbin bangō | NNN-NNNN | 100-0001 | Prefecture-level area |
| India | PIN code | NNNNNN | 110001 | One of nine postal zones |
| Brazil | CEP | NNNNN-NNN | 01310-100 | Macro-region |
| Australia | Postcode | NNNN | 2000 | State or territory |
| Netherlands | Postcode | NNNN AA | 1012 AB | City and district digits [nl-postal] |
| Spain | Código postal | NNNNN | 28001 | Province (first two digits) |
| Ireland | Eircode | Routing key + unique ID | D02 AF30 | Post town routing area [eircode] |
The all-digit family: ZIP, PLZ, PIN and friends
Digit-only systems are the most common, and the US ZIP Code is the model. It has five digits and dates from 1963. The first digit sweeps from 0 in New England to 9 in the Pacific states, and the next ones narrow through a sectional center to a delivery post office [zip-wiki]. The optional +4 extension points at a block face or a large building. We cover the American system digit by digit in what a ZIP code means, and its place in a full address in the US address format guide.
- Germany switched to five-digit PLZ codes in 1993. The change merged West and East Germany's clashing four-digit systems after reunification.
- France encodes the département in the first two digits: 75 is Paris, 13 is Bouches-du-Rhône, 06 is Alpes-Maritimes.
- India rolled out six-digit PIN codes in 1972. The first digit selects one of nine zones, and 9 is reserved for Army Post Offices.
- Japan moved to seven digits (NNN-NNNN) in 1998, precise enough to identify a neighborhood or a single large building.
- Brazil's eight-digit CEP adds a three-digit suffix that can single out a stretch of a long street.
The alphanumeric family: more addresses per character
Letters multiply capacity. A position that takes 26 letters instead of 10 digits packs far more combinations into the same length. That is how six or seven characters can pinpoint a handful of houses. The United Kingdom's system, rolled out between 1959 and 1974, is the classic example. It has about 1.7 million postcodes in shapes like SW1A 2AA or M1 1AE [uk-postcodes].
Every UK postcode splits into an outward code, which routes mail to the right district, and an inward code, which walks it to a street segment. The two inward letters never use C, I, K, M, O or V, because they are easy to confuse with digits or each other when handwritten [uk-postcodes].
| Piece | Value | Name | What it selects |
|---|---|---|---|
| Area | EC | Postcode area | One of ~120 letter codes (EC = London East Central) |
| District | 1A | Postcode district | A sorting district within the area |
| Sector | 1 | Postcode sector | A neighborhood-scale slice of the district |
| Unit | BB | Postcode unit | A street segment or small group of addresses [uk-postcodes] |
Canada alternates letters and digits: letter, digit, letter, space, digit, letter, digit, as in K1A 0B1. The first three characters form the Forward Sortation Area, and its first letter maps to a province or region. The last three form the Local Delivery Unit. Canada Post never uses the letters D, F, I, O, Q or U, which machines and people misread too easily, and W and Z never start a code [ca-postal].
The Netherlands takes a hybrid route: four digits, then two letters, as in 1012 AB. Three letter pairs, SA, SD and SS, are never issued because of their association with Nazi organizations [nl-postal].
The precision spectrum: from region to front door
How much does a code tell you? It depends on the system. A US ZIP averages about four thousand delivery points, and a full UK postcode unit covers roughly fifteen. The newest systems go all the way to one.
Ireland went straight to that end point with Eircode, issued to every address in 2015. A three-character routing key, such as D02 for central Dublin, comes first. A four-character unique identifier follows, so D02 AF30 is one building. Two neighboring houses have different Eircodes [eircode]. Singapore's six digits also identify a single building. This matters for data modeling: in some countries a postal code describes a region, and in others it is effectively a primary key.
Places with no postal code at all
Plenty of mail arrives every day with no code at all. Hong Kong, Macau and the United Arab Emirates run their postal systems without one. Dozens of smaller territories, many in the Caribbean and the Pacific, rely on town names and PO boxes [list-postal]. Ireland managed without codes until 2015. The lesson for form builders: a mandatory postal-code field makes it impossible for some customers to enter their real address correctly.
Generating format-valid international addresses
Test data has to respect all of this variety, or forms pass tests they should fail. A believable generated address pairs a real city with a postal code that is valid for that exact place. A London address needs a London postcode, a Toronto address an M-prefixed code, and a Berlin address a 1xxxx PLZ. Our city pages for London, Toronto, Paris, Berlin and Sydney work that way. Only the street and house number are random, so each address points at no real home.
Checking that claim for this post found a bug in our own generator. The geographic half of each UK and Canadian code came from real data, but the invented half drew from all 26 letters. In a run of 500 Toronto codes on 1 October 2026, 121 contained a letter Canada Post never uses. London inward codes broke Royal Mail's rule the same way. We fixed the generator that day. Every generated letter now follows the national rules above, and a test checks each country's codes against those rules. For the full picture per country, start at the address generator or browse all supported countries.
The patterns, as an open dataset
Everything above is also published as data. postal-code-formats is an open, MIT-licensed dataset covering 31 countries. It holds each format, its validation regex and 9,000 real sample codes, as JSON, as CSV and as a zero-dependency npm package [postal-code-formats].
It exists because of a weakness shared by most postal-code regex tables. They descend from a Wikipedia scrape or from Google's unmaintained libaddressinput metadata, and none can tell you when a pattern has gone wrong. So every pattern in the dataset is tested against every real code held for its country, on every change. A regex that has never met a real postal code is a guess. The dataset also records which countries have no postal code, and which sample codes are whole codes rather than the geographic half of one.
Reading a postal code like a local
Postal codes all answer one question: where should this go? Each country answers with an alphabet and a precision that reflect its history. America has coast-to-coast digits, Britain a dense letter grid, Germany a renumbering after reunification, and Ireland one code per front door. Read the leading characters and you know the region. Respect the differences in your forms and fixtures, and addresses from anywhere will fit.
References & sources
- postal-code-formats — formats, regexes and verified sample codes — GitHub
- Addressing solutions — Universal Postal Union
- ZIP Code — Wikipedia
- Postcodes in the United Kingdom — Wikipedia
- Postal codes in Canada — Wikipedia
- Postal codes in the Netherlands — Wikipedia
- Eircode — Ireland's postcode system — Eircode
- List of postal codes — Wikipedia
Frequently asked questions
Is a ZIP code the same thing as a postal code?
A ZIP code is the United States' name for its postal code. ZIP stands for Zone Improvement Plan, which USPS introduced in 1963. Every ZIP code is a postal code. 'Postal code' is the umbrella term that also covers the UK's postcodes, Canada's postal codes, Germany's PLZ and India's PIN.
Why do British and Canadian codes contain letters?
Capacity and precision. A position that can hold letters as well as digits gives far more combinations than a digit alone. So a six-character UK or Canadian code can point at a much smaller area without getting long. A UK postcode unit covers about one street segment or a handful of houses, and a Canadian local delivery unit is similar.
Do all countries have postal codes?
No. Hong Kong, Macau and the United Arab Emirates run without them, and Ireland only issued Eircodes in 2015. Dozens of smaller territories rely on town names or PO boxes. So an international form should never require a postal code for every country. A required field makes a correct address impossible to enter.
Which postal codes identify a single address?
Ireland's Eircode is the clearest case. Its three-character routing key and four-character unique identifier point at exactly one delivery point. Singapore's six-digit codes identify a single building, and a full UK postcode usually covers a handful of neighboring addresses. At the other extreme, one US ZIP can cover tens of thousands of addresses, and ZIP+4 narrows it to a block face or building.
How should a form validate international postal codes?
Validate per selected country, not with one global rule. Store codes as text so leading zeros survive: New Jersey's 07030 must not become 7030. Allow letters and spaces where the country uses them, and convert to uppercase. Make the field optional for countries without codes. A per-country pattern table and a text column beat any clever universal pattern.
Update history
- Corrected the UK postcode count and the Eircode example, added Canada's full letter rule, fixed a generator bug that put forbidden letters in UK and Canadian codes, and rewrote the prose in shorter sentences.
- Added the open postal-code-formats dataset, now also an npm package.
- Retitled for the query people search, 'postal code formats by country'.
- Replaced an invented author persona in the byline with the site's real author.
- Published, covering 12 countries' formats and the places with no code.