On this page
A US address has a fixed order: recipient, street address, optional secondary unit, then city, two-letter state, and ZIP code on one line. That is the whole format. Almost every bug in a US address form comes from moving one of those pieces, inventing a field for it, or treating the ZIP as a number instead of a string.
This guide walks the block line by line, then covers the parts that cause real incidents: state and territory codes, ZIP versus ZIP+4, military and territorial addresses, and the difference between what USPS accepts on mail and what a web form should accept. Every rule below is something you can assert in a test.
The five-line US address block
Domestic mail uses a simple block. The recipient name goes first, the street address second, the secondary unit third when it exists, and the city, state, and ZIP share the fourth line. The country line is omitted for domestic mail and added only when the item leaves the United States.
Sorting equipment reads the block from the bottom up: ZIP, then state, then city, then street. That is why the ZIP belongs on the same line as the city and state rather than on a line of its own, and why a stray line between the city and the street can break automated reading. A web form does not have to mirror the mail block exactly, but the values it stores should map cleanly onto it.
| Line | Contents | Example |
|---|---|---|
| 1 | Recipient name | Dana Whitfield |
| 2 | Street address or PO box | 1420 SW Alder St |
| 3 | Secondary unit, if any | Apt 7B |
| 4 | City, state code, ZIP | Portland, OR 97205 |
| 5 | Country, international only | United States |
Address line 1 versus address line 2
Line 1 is the delivery line: building number, street name, and any directional or street-type suffix. Line 2 is the secondary unit designator: apartment, suite, floor, room, unit, building, or department. A PO box is a delivery line when it is the delivery point, so it goes on line 1, not line 2.
The rule that prevents most defects is simple: never put two different concepts on one line. "123 Main St Apt 4" is two fields pretending to be one, and it forces every downstream consumer to re-parse. Conversely, do not put the city on line 2 because the street line ran long. If the form must cap line 1 at 100 characters, that is a UI constraint, not permission to relocate data.
- Line 1: house number, predirectional, street name, suffix, postdirectional
- Line 2: Apt, Ste, Unit, Fl, Rm, Bldg, Dept, followed by the identifier
- Line 2 stays blank when there is no secondary unit; never write N/A or a dash
- A PO box is line 1 when the box is the delivery point
- Keep a company or attention line separate from the street line
The city, state, ZIP line
These three values belong together, comma-separated, with a single space between the state code and the ZIP. The state is always the two-letter USPS code, uppercase, with no period. "Oregon" belongs in a database region name column if you keep one, but the mail line uses OR.
The ZIP is a string. It is five digits, optionally followed by a hyphen and four more for ZIP+4. Leading zeros are real: 02134 is Boston, and an integer column stores it as 2134. If your schema already has an integer ZIP column, the migration to text is worth doing before the first New England customer, not after.
USPS prefers the city name in uppercase on mail, but a form should store mixed case and uppercase only at print time. One more reason not to validate the city against the ZIP: a single delivery area can recognize several acceptable city names, so a mismatch is common and does not make the submitted address malformed. Validate the shape of each field, render the mail block, and leave city-to-ZIP agreement to a reference dataset you have actually licensed.
| Value | Format | Example |
|---|---|---|
| City | Free text, mixed case | Portland |
| State | Two uppercase letters | OR |
| ZIP | 5 digits | 97205 |
| ZIP+4 | 5 digits, hyphen, 4 digits | 97205-2515 |
| State plus ZIP | One space between | OR 97205 |
State, district, and territory codes
The USPS publishes 50 state codes plus the District of Columbia and the inhabited territories. Forms that only list 50 states reject Puerto Rico, Guam, the US Virgin Islands, American Samoa, and the Northern Mariana Islands, which is a real conversion bug for a meaningful share of US-citizen addresses.
Use the USPS codes rather than ANSI or ISO subdivisions where they differ. The USPS code is what appears on mail, and it is what address validation services return. Do not accept full state names in the region field unless you normalize them first, and do not assume the code is always two letters for every US-adjacent territory: military mail uses AA, AE, and AP, which are not states at all.
| Code | Name | Notes |
|---|---|---|
| DC | District of Columbia | Not a state; still a valid region code |
| PR | Puerto Rico | Five-digit ZIPs, 006xx to 009xx |
| VI | US Virgin Islands | ZIPs 008xx |
| GU | Guam | ZIPs 969xx; often shipped internationally |
| AS | American Samoa | ZIP 96799 |
| MP | Northern Mariana Islands | ZIPs 9695x |
| AA | Armed Forces Americas | Military mail, ZIPs 340xx |
| AE | Armed Forces Europe | Military mail, ZIPs 09xxx |
| AP | Armed Forces Pacific | Military mail, ZIPs 96xxx |
ZIP and ZIP+4 structure
A five-digit ZIP identifies a delivery area, usually a group of blocks, a building, or a rural route. ZIP+4 adds four digits that narrow it to a block face, a floor of a large building, or a specific carrier route. Both are strings; the hyphen in ZIP+4 is part of the conventional presentation and should be preserved when the value round-trips through a form.
You cannot infer a ZIP range for a city from first principles, and you should not build a full ZIP-to-city table by hand. What you can assert cheaply is shape: five digits, optional hyphen and four digits, no letters, no leading country prefix. If you need existence, this site checks US ZIPs against a 40,979-row dataset, which is an existence check and nothing more.
| Input | Valid | Why |
|---|---|---|
| 97205 | Yes | Plain five-digit ZIP |
| 97205-2515 | Yes | ZIP+4 with hyphen |
| 02134 | Yes | Leading zero is significant |
| 9720 | No | Four digits |
| 97205 2515 | No | Space instead of hyphen in ZIP+4 |
| 97205-251 | No | Three digits after the hyphen |
International mail and the country line
For mail leaving the United States, the country name is written in uppercase on its own final line, and the US address keeps its domestic shape above it. "USA" is acceptable on inbound international mail but the full country name is the safer choice for automated sorting.
Inside a web form the country field should also drive formatting. If a user selects Canada, the state list must become provinces, the ZIP label must become postal code, and the pattern must change. If it selects the United States, the form should reject a six-character postal code rather than truncating it. Country is not a decorative dropdown.
- Country line goes last and in uppercase for outbound mail
- Do not add "United States" to the middle of a domestic address
- Changing country must reset the region field, not keep the old value
- Changing country must re-run postal validation with the new pattern
Apartment, PO box, rural route, and military addresses
Secondary units use standard designators: APT, STE, UNIT, FL, RM, BLDG, DEPT. USPS prefers the abbreviation with a space and then the identifier, as in "STE 200". Long-form words like "Suite" are accepted but are more likely to be truncated by a 30-character line-2 limit.
Rural and highway addresses may use "RR 2 BOX 145" or a street-style number assigned by the local 911 authority. Military mail uses the AA, AE, or AP code plus a ZIP in the 340xx, 09xxx, or 96xxx range, and the city field carries the APO or FPO designation, for example "APO AE 09021". None of these should be reordered by a formatter that assumes "number then street name".
| Address type | Example | Gotcha |
|---|---|---|
| Apartment | 1420 SW Alder St Apt 7B | Unit identifier is alphanumeric |
| Suite | 600 Congress Ave Ste 1400 | Do not merge into line 1 |
| PO box | PO Box 4421 | Valid line 1, no street required |
| Rural route | RR 2 Box 145 | No house number in the usual sense |
| Military | Unit 2050 Box 4190, APO AE 09021 | AA, AE, AP are not states |
Questions
- Recipient, street address, optional apartment or suite, then city, two-letter state, and ZIP on one line. The country line is added only for international mail.
- No. Five digits are valid for mail and for most forms. Accept ZIP+4 when supplied, keep the hyphen, and store the whole value as text.
- Fifty states, plus DC, plus territory codes such as PR, VI, GU, AS, and MP, plus the military codes AA, AE, and AP. A 50-item dropdown is incomplete.
- Yes, when it is the delivery point. It belongs on line 1, and the form should not demand a street number alongside it.
- No. Leading zeros matter and ZIP+4 contains a hyphen. Store the value as a string with a length limit and validate the shape, not the numeric value.
What order does a US address go in?+
Should ZIP+4 be required?+
How many state codes are there?+
Is a PO box a valid street address?+
Can I store a ZIP code as an integer?+
Examples are synthetic. Do not use a generated address for identity checks, account registration, or delivery.