Random US State Generator
Use our random US state generator for quizzes, travel ideas, or quick lists. Generate multiple picks and narrow results with letter filters.
Random US State
How this random US state generator works
Press Generate and you get a state and its two-letter code. Turn up the Number box for several at once, no repeats. Copy takes them.
Alabama (AL). Wyoming (WY). Guam (GU). Palau (PW).
There are fifty states. The codes come from somewhere else entirely, and once you know where, the whole apparatus of American addressing rearranges itself in front of you.
Palau has a US postal code, and Palau is a country
Not a territory. Not a commonwealth. Not a possession.
Palau, the Marshall Islands and the Federated States of Micronesia are independent sovereign states. They have their own governments, their own foreign policy, and seats at the United Nations. Palau has an embassy in Washington. Nobody in Koror thinks they live in America.
And yet the United States Postal Service assigns each of them a two-letter code, in the same table as Alabama: PW, MH, FM.
The reason is the Compacts of Free Association. Under those agreements, mail between the United States and those three countries moves at ordinary US domestic rates, using US ZIP codes.
If a letter is going to travel through the American postal system at American prices, the American postal system needs a two-letter box to put it in. So it assigned one. That is the entire explanation.
Publication 28 is a routing table, not a roll of states
The codes are set out in USPS Publication 28, Postal Addressing Standards, Appendix B. Fifty states, one federal district, five territories, and three foreign countries.
Nothing in that document claims to enumerate the United States. It is a table of destinations that the Postal Service delivers to, which is a different question with a different answer.
The same codes were later adopted as an American national standard for data processing. That is how they escaped the post office and spread into every dropdown menu, every address form, and every spreadsheet in the country.
So a great many systems that believe they are asking "which state?" are in fact asking "which postal destination?", and are quietly prepared to accept a sovereign Pacific nation as an answer.
The mistake, when people make it, is not in the table. It is in assuming that a list of two-letter state codes contains states.
Why two letters, and not three
Here is the constraint that shaped the whole thing, and it is beautiful.
Publication 28 explains that the last line of an address needs to fit in 28 characters. The budget is: thirteen for the city, one space, two for the state, two spaces, and ten for the ZIP+4 code.
Thirteen plus one plus two plus two plus ten. Twenty-eight.
Alabama did not become AL because AL is elegant. It became AL because a machine reading an envelope had twenty-eight character positions to work with, and the state got two of them. The two-letter codes arrived in October 1963 alongside the ZIP code.
Every American address you have ever written is the shape it is because of a line length.
Nebraska is NE because Canada asked
Nebraska's original postal code was NB.
In 1969 it was changed to NE, at the request of the Canadian postal administration, because NB was New Brunswick and mail was going to the wrong continent.
The Northern Mariana Islands had the code CM. It was changed to MP in 1988 so that it would match the international standard.
These are not the decisions of a body contemplating the nature of statehood. They are the decisions of people trying to stop letters going astray, and the result is a table that half the internet now treats as the definitive enumeration of the United States.
What the other nine actually are
They sit in the table beside the fifty, and they are worth knowing apart.
- District of Columbia (DC). A federal district. Not a state, and not in one.
- Puerto Rico (PR) and the Northern Mariana Islands (MP). Commonwealths, and unincorporated territories.
- Guam (GU), the US Virgin Islands (VI) and American Samoa (AS). Unincorporated territories.
- Palau (PW), the Marshall Islands (MH) and the Federated States of Micronesia (FM). Sovereign countries in free association with the United States.
If you are building a quiz, a form, or a dataset, the difference between the last group and the rest is not a footnote. It is the difference between a place and a nation.
Ways people actually use this
- Quizzes. Show the code, ask for the state. Then hand somebody PW and watch.
- Test data. This is the correct set for validating a US address form, because it is the set the post office uses.
- Teaching. The best worked example anywhere of how an administrative table acquires entries that have nothing to do with its name.
- Travel and trivia. Several of these are places most Americans could not find.
- Picking somewhere at random. Just be prepared for Micronesia.
Getting more out of the filters
- Every entry ends with a bracketed code, so Contains lets you search by code as well as by name. Type (N for the codes beginning with N.
- Type Islands and you pull three of the non-states in one go: Marshall, Northern Mariana, Virgin.
- Ends with reads the last character of the whole entry, which is always a closing bracket, so it does nothing useful here.
- Starts with takes a single character. M and N are the crowded letters.
Questions people ask
How many US states are there?
Fifty. The Postal Service's table of abbreviations also covers the District of Columbia, five territories, and three sovereign countries in free association with the United States, which is why lists built from it run longer.
Why does Palau have a US state code?
Because under the Compacts of Free Association its mail travels through the US postal system at domestic rates with US ZIP codes, so the Postal Service assigns it a two-letter code. Palau is an independent country and a member of the United Nations.
Why are state abbreviations two letters?
Because the last line of a US address must fit in 28 characters: thirteen for the city, one space, two for the state, two spaces, and ten for ZIP+4. The two-letter codes were introduced in October 1963 with the ZIP code.
Why is Nebraska NE and not NB?
It was NB until 1969, when it was changed at the request of Canada's postal administration to avoid confusion with New Brunswick.
Is Washington DC a state?
No. It is a federal district, created to be the seat of government and deliberately not part of any state. It has a postal code because it receives mail.
References
Skanda Aryal is a full stack engineer focused on accessible web experiences, with personal interests in time zones, travel, hiking, and geography. His enjoys playing with utilities tied to movement, schedules, places, and time based coordination. At Eon Tools, he reviews geography, transportation, times now, and date and time tools.