Postal Code
geography.address.postal_codePostal code or ZIP code for mail delivery. Format varies by country: US ZIP codes (5 digits or ZIP+4), UK postcodes (alphanumeric), etc. Locale-specific format.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As VARCHAR | first_part |
|---|---|---|
| 10001 | 10001 | 10001 |
| 75004 | 75004 | 75004 |
| W1C 1AX | W1C 1AX | W1C |
| EC1A 1BB | EC1A 1BB | EC1A |
| AR_EG | ^\d{5}$ |
| AR_MA | ^\d{5}$ |
| AR_SA | ^\d{5}$ |
| BG | ^\d{4}$ |
| BN | ^\d{4}$ |
| CS | ^\d{3} ?\d{2}$ |
| DA | ^\d{4}$ |
| DE | ^\d{5}$ |
| DE_AT | ^\d{4}$ |
| DE_CH | ^\d{4}$ |
| EL | ^\d{3} ?\d{2}$ |
| EN_AU | ^\d{4}$ |
| EN_CA | ^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z] ?\d[ABCEGHJ-NPRSTV-Z]\d$ |
| EN_GB | ^[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}$ |
| EN_IE | ^[\dA-Z]{3} ?[\dA-Z]{4}$ |
| EN_KE | ^\d{5}$ |
| EN_NG | ^\d{6}$ |
| EN_NZ | ^\d{4}$ |
| EN_PH | ^\d{4}$ |
| EN_SG | ^\d{6}$ |
| EN_US | ^(\d{5})(?:[ \-](\d{4}))?$ |
| ES | ^\d{5}$ |
| ES_AR | ^([A-HJ-NP-Z])?\d{4}([A-Z]{3})?$ |
| ES_CL | ^\d{7}$ |
| ES_CO | ^\d{6}$ |
| ES_MX | ^\d{5}$ |
| ES_PE | ^(?:LIMA \d{1,2}|CALLAO 0?\d|[0-2]\d{4})$ |
| ET | ^\d{5}$ |
| FI | ^\d{5}$ |
| FR | ^\d{2} ?\d{3}$ |
| HE | ^\d{5}(?:\d{2})?$ |
| HI | ^\d{6}$ |
| HR | ^\d{5}$ |
| HU | ^\d{4}$ |
| ID | ^\d{5}$ |
| IS | ^\d{3}$ |
| IT | ^\d{5}$ |
| JA | ^\d{3}-?\d{4}$ |
| KO | ^\d{5}$ |
| LT | ^(?:LT-)?\d{5}$ |
| LU | ^\d{4}$ |
| LV | ^LV-\d{4}$ |
| MS | ^\d{5}$ |
| MT | ^[A-Z]{3} ?\d{2,4}$ |
| NB | ^\d{4}$ |
| NG | ^\d{6}$ |
| NL | ^[1-9]\d{3} ?(?:[A-RT-Z][A-Z]|S[BCE-RT-Z])$ |
| NL_BE | ^\d{4}$ |
| PL | ^\d{2}-\d{3}$ |
| PT | ^\d{4}-\d{3}$ |
| PT_BR | ^\d{5}-?\d{3}$ |
| RO | ^\d{6}$ |
| RU | ^\d{6}$ |
| SK | ^\d{3} ?\d{2}$ |
| SL | ^\d{4}$ |
| SR | ^\d{5,6}$ |
| SV | ^\d{3} ?\d{2}$ |
| TH | ^\d{5}$ |
| TR | ^\d{5}$ |
| UA | ^\d{5}$ |
| UR | ^\d{5}$ |
| VI | ^\d{5,6}$ |
| ZA | ^\d{4}$ |
| ZH | ^\d{6}$ |
| ZH_TW | ^\d{3}(?:\d{2,3})?$ |
Background
Origin
A postal code is a series of letters or digits or both, included in a postal address for the purpose of sorting mail.[1] Modern postal codes were first introduced in the Ukrainian Soviet Socialist Republic in December 1932, but the system was abandoned in 1939.[1] Germany was the next country to introduce postal codes, in 1941.[1] Singapore followed in 1950, Argentina in 1958, the United States in 1963 and Switzerland in 1964.[1]
The ZIP in ZIP Code stands for Zone Improvement Plan.[2] The ZIP Code was introduced on July 1, 1963, as part of the Postal Service's Nationwide Improved Mail Service plan to improve the speed of mail delivery.[2] In 1943 the postal service had implemented zones for 124 urban areas, a system that became cumbersome as population and mail volume grew.[2] Robert A. Moon, who is considered the father of the ZIP Code, proposed it in 1944 while working as a postal inspector.[3] The Postal Service's 1963 annual report described the first digit of a ZIP Code as identifying one of ten large areas of the nation.[2] In 1983 an extended code named ZIP+4 was introduced, made of the five-digit ZIP Code followed by a hyphen and four more digits.[3]
The United Kingdom began introducing its current postcode system in Norwich in 1959, but it was not used nationwide until 1974.[1] Norwich was selected because it already had eight automatic mail sorting machines in use.[4] The UK scheme was finalised in 1974 when Norwich was completely re-coded.[4]
The Universal Postal Union calls the postcode the fundamental, essential element of an address.[5]
Use
Most postal code systems are numeric, and only a few are alphanumeric.[1] A single postal code column is really many formats sharing a name, so it pays to know which country each row belongs to before judging whether a value is valid. (Meridian's view) Validate country by country rather than with one pattern for the whole column. (Meridian's view)
Many of the lowest US ZIP Codes, which begin with 0, are in the New England region.[3] Microsoft's Excel documentation lists postal codes among the values that can contain leading zeros.[6] Excel automatically removes leading zeros from numbers so that formulas and maths work on them.[6] Excel offers Special number formats named Zip Code and Zip Code + 4.[6] Excel's Get & Transform (Power Query) can format individual columns as text when data is imported.[6] Read postal codes as text from the first step, and treat a four-digit value in a US ZIP Code column as a code that has probably lost its leading zero. (Meridian's view) Keep any ZIP+4 add-on in its own column if you need to join on the five-digit code. (Meridian's view)
Each UK postcode is divided into two parts separated by a single space: the outward code and the inward code.[4] The UK outward code comprises the postcode area followed by the postcode district.[4] The UK inward code comprises the postcode sector followed by the postcode unit.[4] A regular expression for validating UK postcodes is specified in the British Standards document BS 7666.[4] Normalise letter case and the space before comparing or joining UK postcodes. (Meridian's view)
The USPS assigns ZIP Code ranges to regional post offices, which in turn assign ZIP Codes to delivery routes.[7] The US Census Bureau describes ZIP Codes, stored as components of addresses tied to delivery points, as a point-based dataset unsuitable for mapping and many analysis applications.[7] The Census Bureau's ZIP Code Tabulation Areas (ZCTAs) are generalised areal representations of the point-based ZIP Codes, built from census tabulation blocks.[7] Not all valid ZIP Codes are represented by a 2020 ZCTA.[7] Treat a join from ZIP Codes to census areas as an approximation, and expect some codes to find no match. (Meridian's view)
Where you'll meet it
The Office for National Statistics' ONS Postcode Directory relates current and terminated UK postcodes to statutory administrative, electoral, health and other geographies.[8] The ONS Postcode Directory is issued quarterly.[8] The ONS Postcode Directory is published in CSV and ASCII text formats.[8]
Sources
- [1]Postal code - Wikipediasecondary source
- [2]“Zip-a-Dee-Doo-Dah” – the ZIP Code is 50 | Inside Adamssecondary source
- [3]ZIP Code - Wikipediasecondary source
- [4]Postcodes in the United Kingdom - Wikipediasecondary source
- [5]Addressing Solutionsorganisation
- [6]Keeping leading zeros and large numbers | Microsoft Supportdocumentation
- [7]ZIP Code Tabulation Areas (ZCTAs)documentation
- [8]ONS Postcode Directory (November 2025) for the UK - Dataset - data.gov.ukdataset
Detection notes
v1 migration: Was address.postal_code (and address.zip_code). Highly locale-specific: US (5-9 digits), UK (6-7 alphanumeric), DE (5 digits), FR (5 digits), etc.
Use it
$ finetype infer -i "10001" --mode column
→ geography.address.postal_code
SELECT ft_infer('10001');
-- → 'geography.address.postal_code'CAST({col} AS VARCHAR)Schema
https://meridian.online/schemas/geography.address.postal_code · Frictionless type string
finetype taxonomy geography.address.postal_code -o json-schema