logoalt Hacker News

Put the zip code first

208 pointsby dsalzmanyesterday at 11:26 PM158 commentsview on HN

Comments

modelessyesterday at 11:49 PM

> From those 5 characters you can determine the city, the state, and the country

False. Many zip codes include more than one city, and some even cross multiple states. And you can't always tell the difference between codes from different countries. Now you're not just instantly filling the rest of the form, you're implementing fancy multi-country filtering logic, editable drop downs, etc. Given the obvious incompetence of the people implementing most web forms, you're asking for disaster here.

Instead, learn to use your browser's autofill feature, and design your sites with it in mind. If you do it right the user literally doesn't have to type a single character. That's even better than typing a numeric code. Sadly even this seems beyond the abilities of the people who implement web forms.

show 13 replies
loloquwowndueotoday at 1:37 AM

I like how instead of just rephrasing the website’s premise to make it clear he only cares about the US, he added some ip-based geolocation to select a snarky response based on where you are. Essentially the site argues back to you if you’re not in the US or something. Why did this person even bother creating the website if he’s so hostile and angry.

loloquwowndueoyesterday at 11:42 PM

US-centric. I typed a Mexico postal code (it’s five digits) and got routed to somewhere in Maine. So - yeah the whole “I can tell you’re in the US just by the zip code” premise is entirely flawed.

show 7 replies
stavrosyesterday at 11:41 PM

So I typed my zip code and got Winsconsin, and couldn't change the country to Greece, which is what my zip code actually is for.

Proposing UX improvements is great, but please don't forget the other 95% of the planet.

show 1 reply
zettabombyesterday at 11:44 PM

I fail to see how you can claim this to work for sites which serve areas outside the United States, but have either no ZIP code, an overlapping code, or something else entirely. Germany has 5 digit PLZs, but putting some valid ones in doesn't get a result. It really seems like the author does not think about other countries.

I don't disagree with reordering the entry by relevance, but you have to start with country. That can also be a nice search - it will be a very short lookup, even if you put every country name in every language. Only after that is postal code (of whatever kind - it's only ZIP in the US) relevant.

diathyesterday at 11:40 PM

Ok but that only fetches the codes from the US, so now a non-US resident will start with their zip code and end up with random ass place on the other side of the globe. Now not only I still have to fill in the fields, but also clear them first.

show 2 replies
sphtoday at 12:25 AM

Falsehoods US programmers believe about addresses: there are no other countries than the US of A, and if there are, they don’t really matter.

This person bought a whole domain for something that doesn’t work for 90% of the world, claiming it does, never even testing their assumption. Great job!

show 2 replies
mikehall314yesterday at 11:42 PM

It’s easy enough to say “put the zip first because that will tell you city, state and country in one input”.

What happens to customers not in the United States? They have no zip to enter. Or if they have a postal code of some stripe, it has a different format.

What about folks who are in Turkmenistan, that you’re grumpy about having to scroll past? How are they signing up?

show 1 reply
golorodenyesterday at 11:45 PM

I entered my zip code… well, wrong country: I’m living in Germany.

And even if you knew that, the only thing you could have known from the zip code is the city. At least roughly, because multiple small villages share one zip code.

Or, to cut it short: This doesn’t work at all on a general and global level, so I guess there’s a reason why websites do this differently…

aedtoday at 1:32 AM

> If you're asking for a ZIP code, use inputmode="numeric"

Does this work for zips? Some zips have a leading 0.

mttjjyesterday at 11:38 PM

I definitely agree in principle. But - without doxxing myself - I input my zip and the city is not correct. It’s a very close neighboring suburb (where the boundaries are definitely blurry) but it’s not the city on all the legal documents for my current house.

show 4 replies
YokoZaryesterday at 11:42 PM

The author complains about country selector drop-downs as part of the address flow, but if you're collecting zip codes you are already assuming United States. I don't think there's a country-inferer from completely generic postal code tool out there yet, is there?

show 1 reply
pdpitoday at 12:14 AM

In the UK, it's pretty common for the post code to be the first field in address forms, and for the form to then offer auto-completion for the whole address based on the post code. Postcodes are specific enough that the autocomplete will just give you a handful of addresses (e.g. my postcode will give you just the flats for the building I live in).

sghaztoday at 12:39 AM

The ZIP-first approach assumes a postal code can deterministically resolve the rest of the address, which is rarely true in practice since many codes map to multiple cities or large geographic areas. Making it reliable requires maintaining comprehensive, frequently updated postal datasets or integrating with external geocoding services, which introduces non-trivial operational complexity. Additionally, deviating from standard address field ordering can work against established user expectations and may degrade usability rather than improve it.

tokyobreakfasttoday at 12:05 AM

It's impressive someone went to the trouble of putting together this angry dreck, and completely ignoring the fact that ZIP codes often span multiple cities/towns, which not only completely invalidates the author's premise, it would populate the fields with wrong information that would have to be manually corrected later.

rishikeshstoday at 12:07 AM

I’m reading this from UAE where zipcodes don’t exist. I wanted to make a similar post so that when you select UAE as country remove the zip code field. Usually the workaround is to type 000000

apendletonyesterday at 11:54 PM

Zipcodes are not great for reliably describing locations. They're collections of multiple postal delivery routes, and that's it. There's no guarantee that any given zipcode lies within a single city, or a single state, or that it lies within the boundaries of the US at all, or that it's contiguous, or that it's stationary (there are some for boats), or that any given location only has one, etc., etc. People think this is a good idea because their particular case happens to work well, but zip codes are rife with edge cases.

pentagramatoday at 12:14 AM

Besides the issues of the OP approach that many point out on this thread, I also want to point out that the ZIP code input on the example, doesn't have the type=number so my mobile keyboard opens with the whole keys instead of the numeric keyboard, in this case that ZIP codes are only numbers, the type=number will improve accessibility.

djoldmanyesterday at 11:54 PM

Fun facts:

There are zip codes that map to more than one city.

There are zip codes that map to more than one state. (42223)

show 2 replies
zeehiotoday at 12:30 AM

It should be at least "Put country first, then ask for zip code".

08036 Barcelona, Barcelona, Spain

08036 Hainesport, New Jersey, USA

It does make some sense to go from most general (country) to more specific (address) instead of the opposite, so the form can implement better auto completions.

However in practice postal addresses are not that clean so simple dumb forms are usually better, because it's easy for exceptions to be missed by auto completion algorithms. I would be very pissed if I had to type the zip code above and then correct the wrong guess on every website.

Either you are helpful and guess correctly or you don't guess at all.

billforsternztoday at 12:16 AM

It's very interesting how the "you know the city, the state, the country" mantra here is really "you know the city, the state and obviously the country is the USA no other possibilities are considered or worth considering"

LeoPantheratoday at 1:05 AM

Why do we not use ZIP+4 add-on codes anymore? Some sites won't even accept them. If you put that in first, you've narrowed it down to one street at worst, in most cases.

cranky908canucktoday at 12:58 AM

Agreed, but:

JRandomCustomer enters street-number, apt-number, city, state, code ... in that order.

Also, many websites seem to have a negotiation with the browser, where, given: a street address, -> they can populate the other fields.

Definitely not perfect

kawsperyesterday at 11:52 PM

My postal code is 2200 (København N), and that form didn't do anything for me.

All zip codes are postal codes, but not all postal codes are zip codes.

At my last gig, this sentence was said a lot, and people kept confusing the two, both in code and in daily speech, so maybe colloquially they are the same :)

phippsytechyesterday at 11:52 PM

This sound like it's more efficient - however... (and ignoring the US specific stuff)

Even in forms where I've designed this it breaks my flow as a user. I'm used to suburb state postcode order (I'm an Aussie). It's how we were taught to write the address in school. It's been a pattern for a long time, and the reversal of the fields slows my brain down.

IMHO The better user experience isn't changing the order of the fields. It's honouring auto-complete so the user doesn't have to enter this data in the first place.

RASBR89yesterday at 11:46 PM

In the last couple of years in the uk, address forms ask for you street address and the rest will autocomplete from there - city, postcode. Makes things a lot easier in the way the author suggests

evrimoztamurtoday at 12:13 AM

In the Netherlands most websites use a common routing database to map a combination of a ZIP code and house number (+ suffix) to your exact address automatically. Great UX! And naturally depends on good administrative and postal services data quality.

lsaferiteyesterday at 11:42 PM

Unfortunately you still need country first. But past that, the point stands well. You'll need to adjust the form based on the country, obviously.

For the US you can use zip-5 to prefill bunch of data and zip+4 practically fills it all out for a lot of addresses.

Each country has some particular nuance though, so it's only as simple as "zip first" or "postcode first" in some locations.

lejalvtoday at 12:00 AM

Why don't we learn and use our (short) plus code?

That would have all the desired properties and then some, and would work everywhere on Earth.

https://en.wikipedia.org/wiki/Open_Location_Code

1970-01-01today at 12:31 AM

Go with 20252 when you know they're just collecting it to send junk mail. Many programmers don't even try to filter for it.

zackifytoday at 12:25 AM

I only ask for zip on our checkout. And get the email from one tap methods.

Like the author I cannot stand how stupid some checkout processes are!

conductryesterday at 11:44 PM

I know some zips covers multiple cities. I would imagine some cross state lines in places too. Doesn’t cover multiple countries either as some have similar formats (5 digits). So there are edge cases that make this infeasible

fjfaasetoday at 12:03 AM

The Dutch zipcode and the house number are unique. So, to mail something to the Netherlands anywhere from the world, it is enough to write something like: NL 1072CT 4.

senadiryesterday at 11:49 PM

The kind of takes that promote the stereotypes of self-centered americans.

smallnixyesterday at 11:44 PM

The visit Japan website for faster customs clearing does that. Zip first with auto fill. Very nice: https://www.vjw.digital.go.jp

slartibardfast0today at 12:01 AM

This works really well in Ireland. Eircodes (our late adoption postal codes) resolve to individual addresses rather than areas, so Irish sites mostly do this.

show 1 reply
altairprimeyesterday at 11:45 PM

“A postal code will belong to a single city” applies: https://news.ycombinator.com/item?id=8907301

show 1 reply
peteeyesterday at 11:47 PM

My zip covers two cities, each has a similar street name; 5-digits isn't enough.

I've encountered websites that take the zip and won't let me change the wrongly-assumed city

jmulltoday at 12:16 AM

Autofill seems like a better solution.

agnishomtoday at 12:23 AM

Somehow a lot of Japanese websites use this trick. Far more often than USian websites.

sibyesterday at 11:50 PM

ZIP codes don't uniquely identify cities / towns. (Or, in fact, States). Not to mention, they certainly don't work globally...

justaboutanyoneyesterday at 11:46 PM

This failed when I put in an australian postal code.

tokyobreakfastyesterday at 11:52 PM

The US Postal service has some of the most complex software in existence, including some of the most advanced handwriting recognition ever developed.

The fact that mail gets to its destination when it does, as soon as it does, with overall minimal error, is nothing short of amazing.

But some web dev blogger has it All. Figured. Out.

Right.

I'm sure your way is better.

This is big "I could code it in a weekend" HN energy.

The USPS owes you a debt of gratitude for buying a snarky domain and bringing this to their attention after 63 years.

throwaway0665yesterday at 11:48 PM

It doesn't take long to type your address. Plus password managers or keyboards often auto fill it. It's not that deep.

dasil003yesterday at 11:58 PM

When you create a site with a tone this self-righteous and condescending, you should really double check your thinking to make sure there is not some glaring flaw invalidating the premise for the majority of people in the world:

> A US ZIP code is 5 characters. From those 5 characters you can determine the city, the state, and the country. That's 3 fields. Autofilled. From one input.

I guess this is par for the course in Trump's America, but I still feel embarrassed for the creator.

dgeiser13yesterday at 11:42 PM

Some zip codes cover multiple cities.

show 3 replies
talkvoixyesterday at 11:43 PM

I completely agree with the premise, but if we just ask for the ZIP code first and auto-fill the rest, how am I going to justify my 2-week sprint to build a custom, React-based, fuzzy-searchable, virtualized dropdown component for the 'State' field?

Just kidding xP

morganftoday at 12:09 AM

Someone needs to write "Falsehoods programmers believe about zip codes" hahahaha ;)

PD: if you don't get the reference, a classic: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-...

🔗 View 18 more comments