Put the ZIP code first.

It's 2026. A ZIP code is 5 characters. From those 5 characters you get city, state, and country. 3 fields. Autofilled. Put it first, you animals.

@tg I've been thinking about this for 20 years, every time I need to enter a form. Also when I have to scroll and scroll to enter a date instead of typing!
@tg it seems to be a standard thing when supplying a UK address to start with the post code (zip code equivalent) and then to select the address (there are only a few houses that have the same post code). I've done the same in Canada too.
@nxskok @tg I'm not surprised. The US is the most hostile to unconventional innovations that make life easier, yet docile when it comes to accepting any outlandish change that makes a rich man richer.

@nxskok @tg My favourite forms are the ones where you just start typing the street address and it very quickly works out the rest.

I live on a street with about 100 houses sharing the same UK postcode.... starting postcode first usually means I end up scrolling through 50 ā€œhouse numbersā€ before I find mine.

@nxskok @tg same in Brazil. It's pretty standard for forms to ask for the equivalent of zip code and prefill almost the full address.
I wonder if using this strategy breaks down when you have people from multiple countries entering their respective zip codes that all have their idiosyncrasies?

@tg

This is _so_ good. I think roughly this _every_ single time I fill out my address online.

@tg this is pretty cool but I don’t follow the claim that zipcode can determine country, the 5 digit code from US overlaps with other countries’ postal codes.
@tg

> I type 90210. (...) You didn't need me to scroll past Turkmenistan.

Turkmenistan also has zip codes. It seems they are a digit longer, though. However, e.g. Germany has 5 digit zip codes.
@robryk @tg From a quick glance at Wikipedia, at least 58 states and countries have the same zip code format as the USA. And there are 61 where they don't use zip codes at all.
@tg this has been almost standard for Dutch sites as long as I can remember but for some reason fails to catch on in the US.
@tg
I agree with the intention of making the form more usable, but the advice seems a bit US-centric. If you follow this advice completely, you'll make your form inaccessible to some people. If you do want to go in this direction, at least confirm the country first, and don't use `inputmode="numeric"` for the postal code unless you know that's true for that country

@fnohe @tg I inputted mine and it gave me a US place despite not living in that country, so zip codes clearly aren't unique to determine country.

I can't remember a shipping form that doesn't put country first

@tg
Nice idea, but my zip code has four digits. Make sure the form doesn't block while waiting for the fifth.
@tg Consider: ZIP code first, but it's a dropdown
@annika @tg
... just be the flat earth map and you have to keep clicking to zoom in until you get to the exact long/lat for you pobox/slot/box/reception
@EndlessMason Ironically, that would be faster than some of the forms I had to fill because I know how to find my house on a map
@Gabriel
This is one of those off-the-cuff silly ideas that the longer you sit in them the longer you wonder if you're doing too good of a job for the room you're in or too bad of a job for the room you're in.

@tg As others have said, there are problems with international addresses, but those are solvable I think.

The worst is when I enter my address and city and country and then the zipcode, and then it tells me that my city is wrong and wants me to fix it. Like if I put "Brookline" and it wants "Brookline Hills" (not my actual city).

But yes, if you know all that data from the zipcode, just enter it for me.

@tg Anyway, in the future, it will just take a picture of our face and automatically fill out our name, address, city, state, country, zipcode, social security number, mother's maiden name, age, height, weight, annual salary, name of first pet, etc.
@tg
it pisses me off þat þese þings are not standardized

@tg This just straight up automatically hits at least two of these incorrect assumptions. The biggest one is there's vast swaths of the western US that have no ZIP code. Also, ZIP codes correspond to postal routes, not cities: 97229 covers Portland, Beaverton, Aloha and Bethany in Oregon. And that's just on one street!

https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/

Falsehoods programmers believe about addresses

@BalooUriza @tg I came here to say this, it’s a nice idea but it straight up doesn’t work and can’t be adjusted when it doesn’t. I’m not in the US and it doesn’t even run the query on my input.

@bnut Don't get me wrong, still put the ZIP first, but _only_ to ballpark things. It shouldn't fail just because someone changes the city, state, county, province or country. Could be improved further by putting the country first, then the ZIP. That _probably_ covers all bases unless there's some stateless addresses I'm oblivious to.

@tg

@BalooUriza @tg I think you could put the zip first, then country, and filter every field’s suggested values based on the previously entered data. That minimises typing. Although importantly: don’t assume those suggestions are sufficient and allow manual entry.

@bnut Where my thinking's at on putting the country first is that it narrows down the assumptions somewhat, since that immediately narrows down if postcodes are numeric, alphabetic, or alphanumeric, and how long. Especially since I know that the US is *bizarre* in that our postcodes correspond to postal routes, not geographically compact areas, and having both 5 and 9 digit ZIPs.

@tg

@BalooUriza yeah, I get it, but the post code is still less typing (if you have one).

In theory entering any field first is fine, just some are better than others. For example, if you put suburb first then ę–°å®æåŒŗ is probably going to narrow down the countries to one option.

@bnut No such luck in the US, which has 19,495 cities and (only a slight exaggeration) 350 place names between them. Canada has similar issues on a smaller scale for similar reasons.
@tg don’t use the number pad. That eliminates Canadians from tearing there code.