On an HTML form, What is the maximum amount of characters that should be allowed for:

  • Street Address 1
  • Street Address 2
  • Town/Suburb
  • State/Province (I would have drop downs for main countries, but I can't list every one in the world)
  • Postal Code/Zip Code

I have left off country because it would be a drop down.

  • 5
    is there a reason why you want to restrict the number of characters?
    – Igor-G
    Commented Feb 18, 2013 at 13:38
  • Hi Igor, that is a good thought point. One use-case I can think of is where a user copies and pastes an address from another sources and might accidentally collect additional text that is not required for the field without noticing it. Commented Feb 18, 2013 at 13:47
  • 1
    "State/Province" - please, do make sure to indicate this is optional, depending on the country. It annoys the hell out of me every time I am seemingly asked for my state when entering my address for something and I have to type in my state name because I'm not sure the website will correctly process my request if I leave that field blank, even though the state is irrelevant for postal addresses in my country. Commented Jul 13, 2019 at 10:03
  • The street Address Line 1 should must be not more than 30 characters Commented Jun 24, 2020 at 9:02

4 Answers 4


I think you should not restrict it at all (meaning: setting the limit at a very high level). It is hard, if not impossible, to determine how long the fields should be, but they cannot be too short, that's for sure. Names, cities, streets can be really long. Just check these to get some perspective:

Longest place names in the world: http://en.wikipedia.org/wiki/List_of_long_place_names

For the longest surname check: http://www.museumofhoaxes.com/hoax/weblog/permalink/worlds_longest_surname/ There is a world record on it!

The argument of not letting users paste too much is important to some extent, but I don't really think it is going to cause more problems than too short fields to enter data.


I think the UK Government Data Standards Catalogue can be a good read for this:


" International Postal Address:

  • Max 35 characters per line;
  • Minimum of 2 lines and maximum of 5 lines for the postal delivery point details, plus 1 line for country and 1 line for postcode/zip code.


  • The Outward code can be 2, 3 or 4 characters followed by a space and the inward code, which is 3 characters and is always NAA
  • The outward code has seven valid formats, AN, ANN, AAN, AANN, ANA, AANA, and AAA
  • The letters I and Z are not used in the second alpha position (except GIR 0AA)
  • The second half of the code never uses the letters C, I, K, M, O, and V".

Anyway, just because the information is common on applications, doesn't mean that your website uses the data in the same way that other webites use it.
What are you going to do with the address? You need a fully standardized address?

  • 1
    Big fan of standards like this. The idea of allowing infinate length fields anywhere in a project fills me with terror tbh. Commented Oct 30, 2020 at 18:06

I'd make it more flexible.

Some countries do not have zip codes, or they are generally not used.

Some countries require more for location, others less (in some countries, many people don't even know the name of their own state or county).

P. O. Box needs to be separate in some cases.

In countries with other writing systems, it's sometimes necessary to have two lines for each part - because otherwise the sender's courier won't know how to get it to the courier of the recipient, or the recipient's courier can't read it.

The order of items is also different from country to country. Some have the number first and then the street name, or the opposite. Some have the zip code in front or after the city, not after the state. And so on.

There need to be fields for c/o, business name, instructions, house names (yes, some places don't have street numbers) and many more.

Banks and such usually have an easy to find address. Check the formats of the addresses for at least your most important countries.

As the number of lines is limited, make sure your form doesn't encourage people to fill something in for each option.

I'd make it like this

[             ]
[             ]
[             ]
Option4 Option5
[     ] [     ]
Option6 Option7
[     ] [     ]
Option8 Option9
[     ] [     ]
[             ]

Options to choose from would be business, name, house, P.O. Box, street1, street2, instructions (only if delivery), suburb, county, city, state, postcode, P.O. Postcode. If some turn out to be universal (Business name always on top, Name always in one of the first two lines, and so on, you can limit the choices accordingly. You can also limit them even more by letting the user choose the country first. And prefill the most likely options.

However, you probably find some address formats for which you need to add even more flexibility...

  • "In countries with other writing systems, it's sometimes necessary to have two lines for each part" - usually, the sender's courier just needs to know the destination country, the rest needs to be handled once it's there. +1 for all the other points you list. Commented Jul 13, 2019 at 9:59

Just to add to the conversation after reading the comments, USPS very clearly states that:

The Postal Service and commercial MLOCR equipment can read a maximum of 40 characters per line within a maximum of 8 separate words per line. If either parameter is exceeded, the MLOCR ignores the entire line

That governs all the address lines. As for the city input specifically, Pitney Bowes adds:

Maximum length of a City name according to the USPS

The maximum length of a long city name is 28 characters. The maximum length of a short city name is 13 characters

You should want this to work, because:

Letters that are not barcoded by the sender get a barcode from an MLOCR if the address is clearly printed and placed in a “readable” position on the envelope.

When a letter has been barcoded, it can travel all the way to the addressee’s mailbox before being touched by another human hand, avoiding a lot of manual labor and potential for human error.

Non-barcoded letters must be processed manually, slowing the delivery time and increasing costs.

So while being all user-friendly and letting them enter arbitrary values is a nice liberal idea, in reality these e-commerce users are mainly customers, which they immediately realise (and come back shouting at you, or Trustpilot) once their order doesn't show up in time,

  • because it couldn't be sorted and routed automatically and had to be handled manually,

    • because they entered their university name, city name, country name, company name, c/o or recipient name, their dog's name, or simply pasted the address twice (and didn't double-check before submitting, because why would you) all in Address Line 1,

      • because you didn't restrict the input length limit.

I say all of this because I looked at our actual orders database after having the same question.

So as of now, I can think of these ways to solve this:

  • Quick and easy. Restrict every address line to 40 characters.
  • Better, but more complex. Show a warning pop-up if the address exceeds the limits, with an option to edit the exceeding lines in-place or let them take the risk, but assuming the responsibility (so if it doesn't show up, it's on them).
  • Complex and expensive, with privacy concerns. Use an external, 3rd party address validation API before letting them submit, show warning on failure. There are SaaS services, you can see their commercials disguised as 'answers' to most questions on address-validation all over Stackoverflow.
  • I'm kind of surprised USPS limits it at 40, seems rather short. They would have an issue with streets like "De Laan van de landinrichtingscommissie Duiven-Westervoort", or "Ir. Mr. Dr. van Waterschoot van der Grachtstraat", or "Burgemeester Baron van Voerst van Lyndenstraat" if they use the same standards for international shipping. Extreme examples, but these are real street names in the Netherlands. Commented Jun 8, 2020 at 10:03
  • Yep, I guess it's because the equipment is really old. So for exactly this reason they came up with Address Data Element Compression Guidelines with abbreviations, word ending substitutions, and even vowel removal. So you can get e.g. ENGR instead of ENGINEER Commented Jun 8, 2020 at 10:16

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