Address line 1 vs line 2: what to enter
Put the house number and street in line 1, and a unit in line 2 when needed. See fictional examples, autofill markup and end-to-end field tests.
AI summary
Line 1 usually holds the street and number; line 2 adds a unit when needed. Keep locality fields separate, retain optional data, and test autofill and exports without assuming deliverability.
What goes in address line 1 and line 2?
In a typical street-address form, line 1 holds the house number and street; line 2 holds an apartment, suite or other secondary detail when needed. City, region, postal code and country belong in their own fields if the form provides them. This is a practical field mapping, not a universal postal rule. A building name or a destination-specific format may need a different arrangement. The example below is fictional and is not a verified delivery address.
addressLine1: "123 Example St" addressLine2: "Apt 4B" city: "Boston" region: "MA" postalCode: "02108" country: "US"
How should an apartment be printed?
Keep the unit information even when line 2 is optional. For a US mailing label, USPS Publication 28 section 213 prefers a known unit designator at the end of the delivery address line. If it will not fit there, section 213.3 places it immediately above that line. A web form’s second input is therefore not necessarily the second printed line. The interface fields and the final mailing label solve different problems; use the destination’s postal convention when rendering.
Leave an unused second line empty
A house without a secondary unit does not need an invented apartment, N/A or a repeat of the street. Let the second field be empty, omit the blank line in a printed label, and preserve the original value when transforming input. Do not split every address at the first comma: commas can be part of building and locality names. If a receiving API permits only one street field, join the non-empty street lines at that integration boundary and keep structured values internally.
Use address autocomplete tokens consistently
For separate inputs, use address-line1 and address-line2. For one multiline street field, use street-address instead of those individual line tokens. City, region and postal code remain separate. Shipping and billing token prefixes distinguish the two purposes; section-* can separate multiple addresses. These attributes guide the browser rather than validate postal data, and actual autofill behavior varies by browser and stored profile. MDN documents the tokens and their grouping.
<input name="line1" autocomplete="shipping address-line1"> <input name="line2" autocomplete="shipping address-line2"> <input name="city" autocomplete="shipping address-level2"> <input name="region" autocomplete="shipping address-level1"> <input name="postal" type="text" autocomplete="shipping postal-code">
Test the complete round trip
Run the cases below from input through validation, storage, export and the final label. Check both the visible value and the submitted payload. Preserve Unicode and punctuation rather than stripping meaningful characters; treat postal codes as text so leading zeros survive. For a failed case, record the expected and actual fields instead of assuming the address itself is invalid. Passing these tests proves field handling, not delivery.
line1="123 Example St", line2="" → line2="" line1="123 Example St", line2="Apt 4B" → line2="Apt 4B" line1="8 Rue de l’École", line2="Étage 2" → Unicode preserved postalCode="02108" → "02108", not 2108 line2="Building A, floor 2" → no comma split
Test the fields with generated address data
Generate a sample in the US address tool, copy its street, city, region and postal fields into the appropriate inputs, then add a clearly marked fictional unit when that case is needed. The generator does not certify the house, the apartment or mail delivery. For repeatable tests keep the same seed, filters, quantity and data version; test a real shipping destination separately through an authorized postal or carrier service.