US state abbreviations and capitals for address testing
How to use state names, two-letter abbreviations, capitals, and common test cities in address forms and fixtures.
Why state abbreviations matter
US address forms often display the full state name, such as California, Texas, or New York, but databases, APIs, shipping systems, and tax services usually store the two-letter abbreviation, such as CA, TX, or NY.
Those two letters affect ZIP matching, phone area-code plausibility, sales-tax rules, shipping restrictions, and CRM reporting. A wrong abbreviation can make an address look fine in the UI while producing incorrect business results downstream.
Common abbreviations, capitals, and test cities
Capitals are useful reference data, but they are not always the best default test city. In many states, the largest business city differs from the capital.
| State | Code | Capital | Common test city |
|---|---|---|---|
| California | CA | Sacramento | Los Angeles / San Francisco |
| Texas | TX | Austin | Houston / Dallas |
| New York | NY | Albany | New York City |
| Florida | FL | Tallahassee | Miami / Orlando |
| Delaware | DE | Dover | Wilmington |
| Oregon | OR | Salem | Portland |
| Alaska | AK | Juneau | Anchorage |
Capital city is not always the default city
Low-quality test data often uses the state capital as the default city because it feels official. In real products, that is not always the best choice. California's capital is Sacramento, but ecommerce, SaaS, and user-registration flows more often use Los Angeles, San Francisco, or San Diego.
If your goal is address-format testing, a capital city can work. If your goal is to simulate common user behavior, prefer larger business cities.
Implementation tips
- Store the two-letter state code and display the localized state name in the UI.
- Do not send translated state names to tax or shipping APIs.
- Validate city, state, and ZIP together instead of checking only abbreviation format.
- Keep both large-state and small-state fixtures, such as CA, TX, NY, DE, and OR.
- Mark tax-free-state fixtures separately from ordinary address fixtures.
A practical state fixture set
A useful US address test set can include CA for high-frequency addresses, TX for large-state ordinary business, NY for confusing city/state cases, DE for zero sales tax, AK for local-tax boundaries, and OR for a West Coast zero-tax path.