I am designing a form where the client wants to required a 5 digit zip code, with 9 digits being optional. I can think of a couple ways to deal with this.

1) Just plain old regex accepting 5 digit codes, 9 digit codes, and formatted 9 digit codes (eg. 12345, 123456789, and 12345-6789)

2) Two side-by-side text boxes, the first for 5 digits and the second for the last 4 digits. side by side fields

Which pattern is more clear to the user? If it's the second pattern, how would I best indicate that the second field is optional?

3 Answers 3


Adam Silver has recently written an excellent article regarding multiple inputs versus one input.

Short summary:

While using multiple inputs can be helpful, most of the time it’s completely unnecessary and it has a number of drawbacks.

  • They stop users from pasting easily
  • They require more effort to use
  • They can be difficult to label meaningfully

I would recommend to use only one input, that accepts both 5 and 9 numbers, and ignores extra spaces or dashes.


First one is simple use that.

  • Using the schemes that already exist we reduce cognitive load.
  • Developers needs less coding on designing and validation part.
  • 50% Less DOM interactions.

If planning to use 2nd pattern make sure you are adding helper text saying 9 digit are optional.

  • Can you provide some explanation as to why the first option is simpler? A lot of user experience is based on context, so is this something that you see more often?
    – Michael Lai
    May 24, 2020 at 2:05

I think Adam Silver made a good point but it wasn't researched (I think). It came out of creativity. Shouldn't someone research why phone numbers are 7 numbers?

I'll tell you the answer via a hopefully, not-so-boring story and you, guys can consider what to do with the info.

When the telephone was first invented, phone numbers started with 4 numbers (this is important). Apparently, 4 numbers were the largest number easiest to memorize. But, as the population grew exponentially, they need to increase the number of numbers. Eventually, they made it 7 numbers because they ran a test and determined that most people could at most memorize 7 numbers at once. Due to this experiment, neuroscientists and psychologists concluded that the average brain had only 7 working memory "slots". In other words, we could only think of 7 things at once. Doesn't seem that much, no?

As time passed, they soon noticed something interesting happening. People, trying to memorize these phone numbers, had a tendency to arrange the telephone numbers into 3 or 4 groups. Why? Did our brains have some fascination with grouping? Scientists eventually figured out that our brain didn't have 7 working memory slots at all. Our brain actually only had on average 3-4 working memory slots and it was using a "trick" to increase the numbers we could memorize (eventually 10). People would unknowingly actually memorize the entire visual picture of 3 numbers into 1 working memory slot. Then, 3 numbers into another working memory slot. And, the final 4 into their last one.

So...if these zip codes are something that people need to memorize quickly at once, I would definitely not use a group of 5 and 4 numbers. The 5 initial numbers are too big for most people. I would group them into groups of 4 numbers and make sure the numbers are less than 4. Something like that. You get the idea, right?

  • Thank you for your insights. According to Miller's law, the number of objects an average human can hold in short-term memory is 7 ± 2. I think this supports Adam Silver's points: (a) Users may want to paste long numbers, instead of writing them, and (b) may want separate a long number in chunks, by adding spaces or dashes.
    – haugsand
    May 24, 2020 at 8:54
  • nice explanation but in this input field first five digits of the zip code indicates the destination post office or delivery area. The last 4 digits of the nine-digit ZIP Code represents a specific delivery route within that overall delivery area. They are logically grouped.
    – Codesigner
    May 24, 2020 at 10:53
  • Haugsand, it's totally ok but I caught you cheating! 😊 You only read the 1st paragraph of that Wikipedia page, didn't you? You know what's even funnier. You unluckily happened to pick the one paragraph on that page that mangles the facts. It not only misstates Miller's Law but also the paper was published in 1956 and scientists have rejected it long ago. Read my answer. 5 digits-in-a-row makes it hard. If it's 9, most won't be able to memorize it on the spot. They will have to stand there for a bit to memorize it. At least, help them by grouping the numbers so it easier for them. May 25, 2020 at 0:26
  • Codesigner, I typed up the above comment before I read yours. I just reread your original question. You definitely need to break it up. Aesthetically, I think the 2nd way is the prettiest and issues of memorization don't apply here I think, no? People are inputting their own zip codes so it's not like they have to look it up. Just go 2nd way with the words optional in small print beneath it. May 25, 2020 at 0:33
  • Sorry. The third sentence should say that you definitely don't need to break it up. May 25, 2020 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.