Skip to main content

What is a ZIP Code and how is it structured?

The US ZIP Code is the most influential postal code system in the world — not because it is the best, but because US-origin address data dominates geocodinggeocodingThe process of converting an address into geographic coordinates (latitude and longitude). Mailwoman geocodes in a multi-tier cascade: exact address-point match → street interpolation → locality centroid. Each tier is progressively coarser but more widely available. trainingtrainingThe process of adjusting a model's parameters so its predictions match labeled examples, by repeatedly measuring error and nudging the weights to reduce it. Distinct from inference, when the trained model is run on new input. sets and shapes what parsers expect. Understanding its structure is essential for understanding why US-trained parsers fail on international addresses.

The full 11-digit code

A ZIP Code is properly 11 digits. Most people know the 5-digit form. Most geocoders use the 5-digit form. The full structure:

1 2 3 4 5 - 6 7 8 9 10 11
│ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ └── Delivery point (last 2 digits of street number or PO box)
│ │ │ │ │ │ │ │ │ └──── Delivery point
│ │ │ │ │ │ └─┴──────── Delivery sector (block face, one building, small group)
│ │ │ │ │ └─────────── Delivery sector
│ └─┴─┴───────────────── Sectional center or post office
└─────────────────────── National area (0=East, 9=West)

The 5-digit ZIP (12345)

  • Digit 1: National area. 0 = Northeast (New England, Puerto Rico), 9 = West Coast, Pacific territories.
  • Digits 2-3: Sectional Center Facilitysectional center facility (SCF). A USPS regional mail-processing hub. The first three digits of a 5-digit ZIP identify the SCF, of which there are roughly 900 nationwide. (SCF). A regional processing center that sorts mail for a cluster of post offices. There are about 900 SCFs.
  • Digits 4-5: Delivery area within the SCF — typically a single post office, a group of post offices, or a large-citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. delivery zone.

The 5-digit ZIP gets a letter to the right post office. That's all. It does not get it to the right streetstreetThe named linear feature along which house numbers are ordered. Decomposes into a name plus street affixes; one of the Tier 2 fine labels., building, or mailbox.

The +4 extension (-6789)

  • Digits 6-7: Delivery sector. In urban areas, this is a block faceblock faceOne side of a street between two intersections. Several postal systems specify delivery to block-face granularity — e.g. the USPS ZIP+4 extension. (one side of one streetstreetThe named linear feature along which house numbers are ordered. Decomposes into a name plus street affixes; one of the Tier 2 fine labels. between two cross-streetsintersectionAn address that names a location by two crossing streets ('5th & Main') rather than a number and street. Mailwoman tags the two streets as intersection_a and intersection_b — a negative-space format that starved the early model.). In large buildings, it's the building. In rural areas, it's a cluster of boxes or a segmentsegmentA punctuation-bounded chunk of the normalized input — the comma-separated parts of 'Portland, OR' — used to give downstream stages structural context. of a rural route.
  • Digits 8-9: Delivery segmentsegmentA punctuation-bounded chunk of the normalized input — the comma-separated parts of 'Portland, OR' — used to give downstream stages structural context.. A smaller unitunitA subdivision of a building — apartment, suite, floor — that refines a street address. Mailwoman's unit component; a designator plus identifier forms a subpremise. within the sector — a few addresses on the block faceblock faceOne side of a street between two intersections. Several postal systems specify delivery to block-face granularity — e.g. the USPS ZIP+4 extension., or a specific floor of a large building.

The +4 narrows the delivery to roughly 10-20 addresses. It is not unique to a building — the Empire State Building has multiple +4 codes for different floors and tenants.

The delivery point code (-67890)

  • Digits 10-11: The last two digits of the streetstreetThe named linear feature along which house numbers are ordered. Decomposes into a name plus street affixes; one of the Tier 2 fine labels. address or PO boxPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise. number. 123 Main St, Apt 4B with ZIP+4 12345-6789 becomes delivery point 12345-6789-23 (from "123").

The full 11-digit code uniquely identifies a delivery point. The USPS calls this the DPBC (Delivery Point Bar Code). It is what the OCR sprays on the envelope as a barcode. When the barcode is present, the letter does not need to be read again — it sorts automatically to the carrier's walk sequence.

ZIP code types

Not all ZIP codes are geographic:

TypeDescriptionExampleGeocodinggeocodingThe process of converting an address into geographic coordinates (latitude and longitude). Mailwoman geocodes in a multi-tier cascade: exact address-point match → street interpolation → locality centroid. Each tier is progressively coarser but more widely available. implication
StandardStreetstreetThe named linear feature along which house numbers are ordered. Decomposes into a name plus street affixes; one of the Tier 2 fine labels. addresses90210 (Beverly Hills)Resolves to a post office delivery area — approximate, not exact
PO BoxPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise. onlyServes only PO boxesPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise. at a specific post office10001 (part of NYC)Centroid at the post office, not at residents' locations
UniqueSingle high-volume mailer20260 (USPS HQ)Point location, correct
MilitaryAPO/FPOAPO/FPO (Army Post Office / Fleet Post Office). US military postal addresses for personnel stationed overseas or aboard ship. They route through military postal hubs rather than geographic locations, so they break geographic parsing assumptions. addresses09012 (APOAPO/FPO (Army Post Office / Fleet Post Office). US military postal addresses for personnel stationed overseas or aboard ship. They route through military postal hubs rather than geographic locations, so they break geographic parsing assumptions. AE)Not geographic — routing to military postal hub

A geocoder that treats a PO BoxPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise. ZIP the same as a standard ZIP will place a pin on the post office building for every resident who uses a PO boxPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise.. In small towns where the post office IS the center of town, this is approximately correct. In cities where thousands of people use PO boxesPO boxA numbered mailbox at a post office used as a delivery address instead of a physical street location. Mailwoman tags it as the po_box component; structurally the same family as a subpremise. at one facility, it is catastrophically wrong.

What changes and how often

The USPS changes approximately 5,000 ZIP codes per year:

  • Additions: When a growing area exceeds one post office's capacity, a new ZIP is assigned. The new ZIP typically splits an existing one.
  • Deletions: When a post office closes or routes consolidate, the ZIP is retired. Former residents get reassigned to a neighboring ZIP.
  • Boundary adjustments: When carrier routescarrier routeThe delivery path one postal carrier covers on a shift. A ZIP code is fundamentally a set of carrier routes, not a geographic polygon, which is why ZIP boundaries are fuzzy and shift over time. redesign, ZIP boundaries shift. These are the most common and the hardest to track — the ZIP code didn't change, but the set of addresses it covers did.

ZIP code changes are published in the USPS ZIP+4 Product, a monthly update file. Commercial address verification services subscribe to this. Open-source geocoders typically do not — they rely on annual or less-frequent snapshots.

The ZIP-to-place mapping problem

There is no authoritative table of "ZIP code → citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy.." The USPS publishes a City State ProductCity State ProductThe USPS file mapping each ZIP to its 'preferred' and 'acceptable' city names. One ZIP can carry several city names because a post office serves multiple neighbourhoods and adjacent municipalities. that maps ZIP codes to "preferred" and "acceptable" citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. names. But:

  • A single ZIP code can map to multiple citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. names (the "preferred" name for the post office plus "acceptable" names for neighborhoods and adjacent municipalities served by the same post office).
  • A single citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. can have multiple ZIP codes. New York City has about 170.
  • The mapping changes with ZIP code boundary adjustments.

This is why geocoders that maintain their own "ZIP to citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy." lookup tables go stale: the mapping changes whenever ZIP boundaries do, so there is no fixed version to cache.

What this means for a parser

A parser trained primarily on US addresses will learn that a 5-digit number after a stateregionThe first-level administrative subdivision of a country — a US state, a French region, a province. The component between country and locality. abbreviation is a ZIP code — correct for the US, but a liability once it meets a 5-digit postcodepostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. in a different position (before the localitylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy., as in French formatting) or one that doesn't match the 5-digit pattern (Canadian A1A 1A1, UK SW1A 1AA).

The ZIP code format is not a universal postcodepostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. format. A parser that treats it as one will:

  • Mislabel non-5-digit postcodespostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. as something else (house numberhouse numberThe numeric or alphanumeric identifier of a building on a street. Mailwoman's house_number component; its position relative to the street name flips between locales., localitylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. fragment).
  • Mislabel 5-digit numbers that are not postcodespostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. (French postcodespostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. before the localitylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy., building numbers in non-US formats).
  • Fail silently on international addresses that use the same digit count for a different purpose.

The staged pipelinestaged pipelineMailwoman's runtime architecture: a sequence of pure-function stages (normalize → query-shape → locale-gate → kind-classifier → phrase-grouper → classifier → decoder) connected by typed handoffs. Each stage is published as its own npm package. addresses this through localelocaleThe combination of language and country an address comes from. en-US and fr-FR are the locales Mailwoman ships weights for. detection (StagestageOne of the dataflow stages in the runtime pipeline (normalize, locale gate, kind classify, phrase group, token classify, sequence correct, reconcile, resolve). Distinct from tier (model vocabulary) and phase (plan milestone). 2): before the classifier runs, the locale gatelocale gateStage 2 of the runtime pipeline: rule-based locale detection from the query shape's script and known-format signals. Returns a LocaleHint with the top candidate and alternatives, surfacing disagreement with an explicit --locale flag. identifies the address as US or non-US and biases the classifier's expectations accordingly. A 5-digit number after a US stateregionThe first-level administrative subdivision of a country — a US state, a French region, a province. The component between country and locality. abbreviation is a postcodepostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one.. A 5-digit number before a French localitylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. name is also a postcodepostcodeThe country-specific postal code (US ZIP, French code postal, etc.). Mailwoman handles postcode parsing entirely by rule classifier — a regex problem, not an ML one. — just in a different position. The parser needs to know which context it is in before it classifies the tokentokenOne word or subword in the tokenized input. For the neural classifier, tokens come from SentencePiece (subword units); for the rule classifiers, tokens are whitespace- and punctuation-separated words..

See also