Menu

US Address Structure: Street, Unit, State and ZIP

US address structure is a house number, a street name, an optional unit, a two-letter state abbreviation and a ZIP code. Here is how the parts fit together.

Published

  • test data
  • address
  • United States

US address structure looks simple from the outside: a number, a street, a town, a state abbreviation and a postal code. That simplicity is why so many forms handle it badly — the parts that look fixed are precisely the parts that carry rules, and the parts that vary are the ones nobody leaves room for.

This article breaks the structure down field by field, covers the unit number and the postal code extension, and explains why military and territorial addresses exist outside the pattern most engineers expect.

The parts of a US address

A domestic mailing address is built from a small set of components, usually arranged over three or four lines.

Component What it holds Notes
Street line House number, street name, street type, direction The street type is part of the name, not decoration
Unit line Apartment, suite, floor, building Optional, and conventionally on its own line
City, state, postal code Town or city, two-letter state code, ZIP code The state code is standardised; do not invent one
Country Only on international mail Omitted inside the country

The street line itself has an internal order worth knowing: a directional prefix, the street name, the street type, and a directional suffix where one exists. The house number leads. That ordering is a convention of the country, not a universal one, which is why the same building appears with the number at the end in other countries, as the guide to international address format sets out.

House numbers, street types and directions

The house number is a leading integer, and it is genuinely a number in the sense that odd and even sides matter to delivery — but it is not a quantity, and treating it as one produces its own class of bug. Ranges exist, alphanumeric suffixes exist, and a single street can carry numbers that are not contiguous as it crosses municipal boundaries.

Street types are words like street, avenue, road, boulevard, drive, lane or court, and they normally follow the name. Directional elements such as north, south, east and west can appear before the name, after the type, or both. Written out in full and abbreviated, the same address has several correct spellings, which is exactly why postal operators maintain abbreviation tables and why a form should normalise rather than demand one particular rendering.

For test data the useful consequence is that the street line is the field most likely to exceed expected length, because it accumulates a directional prefix, a multi-word name, a street type and sometimes a unit qualifier in one string.

How do you write an apartment or suite number?

Put it on a line of its own, or after the street line separated by a clear marker, and label it with the local word: apartment, unit, suite, floor, building. The abbreviation style follows the same convention tables as the street type, so consistency matters more than brevity.

The modelling question is whether the unit belongs in the street field or in a field of its own. Keep it separate. A unit detail appended to the street line makes the street harder to match against any address list and impossible to search reliably, and it is the first thing to be lost when a field is truncated. It also creates ambiguity in the other direction: a building number and a unit number written one after another look like part of a longer street address to anything that parses from the left.

For delivery-relevant test cases, both variants deserve a fixture: an address with no unit at all, and one with a long unit detail. Many systems quietly fail the second.

What the state abbreviation and ZIP code mean

The state component is a two-letter abbreviation drawn from an official standard, and it is not a free-text field. Inventing an abbreviation, spelling the state name in full where a code is expected, or using a code that belongs to a different place all produce data that looks plausible and fails later. The wider family of country and subdivision codes, and the difference between the international standard and local code lists, is covered in the guide to ISO country and subdivision codes.

The postal code is five digits, optionally followed by a four-digit extension that narrows the code to a smaller delivery group. Both forms are valid; the extension is optional in practice, and forms that require it annoy users who do not know theirs. Treat the whole thing as text. A postal code is an identifier, and the leading zeros that some parts of the country use disappear the moment a numeric column gets hold of it, as the guide to postal code formats by country explains at length.

The classic consistency test pairs the two. A state abbreviation that does not match the range of postal codes for that state is one of the most common data-entry errors in US address data, and it is cheap to detect.

Do territorial and military addresses follow the same rules?

Partly. Addresses in US territories use the same general shape but with their own state-equivalent codes and their own postal code ranges, so a validation list built only from the fifty states will reject them despite being perfectly deliverable. Military mail has its own structure as well, with a routing designation and a code that plays the role of a city and state in domestic mail.

The correct conclusion is not to build a longer list of hard-coded special cases and hope it is complete. It is to accept that the set of valid codes is larger than the familiar one, to source the list from an authoritative reference rather than typing it by hand, and to make validation fail in a way the user can correct.

For developers: validating the pieces in the right order

Check the pieces, not the whole line. A single regular expression that tries to validate an entire US address string is the most common mistake in this area, because the variation lives in the street line and the certainty lives in the state code and postal code.

A practical order: require a country so the rule set is known, check that the state code exists in the official list, check that the postal code matches its shape, then check the pairing between them. Leave the street line to length and character checks, and let a human override a failure, because a genuinely correct address that a checker does not recognise should not be uneditable.

Two fixtures cover most of the risk: one address that is valid in every respect, and the same address with a single deliberate inconsistency between state and postal code. That pair makes it obvious when a validation change accidentally starts accepting everything.

Next steps

Take one US address from your staging data and split it into its fields by hand; if you cannot say unambiguously which text belongs to the unit and which to the street, your fixtures are hiding a modelling problem. Then produce a small set of US samples in the address generator and run them through your form, including one with a long unit detail and one whose state and postal code disagree on purpose. Remember what the passing samples are: placeholder values for software testing, not deliverable mail and not evidence of where anyone lives.

Keep reading

Fake Address Generator guides