On the UI there is a searchbox and right now there is no limit a user can enter the text in it. Any guidelines and best practices you are aware are much helpful.

I have checked this .. but this related to the text box, but not search box. Your insights are really helpful

  • 2
    Why are you trying to limit the amount of characters in a search box if I may ask? Commented Oct 23, 2017 at 14:56
  • Having no text limit to the search box sounds a bit different to me, and not sure if i am visualising the feature right for my UI. Off-course having no limit is no harm, but i would like to understand the best practice.
    – A user
    Commented Oct 23, 2017 at 15:02
  • 1
    "Best practices" always makes me think that you need to go check out some sites similar to your own and see how they handle things. Commented Oct 23, 2017 at 17:37
  • What exactly people are searching for?
    – Izhaki
    Commented Oct 23, 2017 at 21:01
  • @Izhaki The UI is Ebook. Student will search a text from the ebook.
    – A user
    Commented Oct 24, 2017 at 9:11

5 Answers 5


The limit for your search box should be as long as possible, and no longer. For example, if your search engine only supports 256 characters, then don't allow users to enter in 257 characters. You should not make your text limit any shorter than that supported by the engine, because there will always be a small, but possibly significant, number of users that need to search for really long phrases. You should not make it any longer than supported by the search engine, because it will result in unnecessary error messages or unexpected search results.


Don't make it any shorter than what the system can support. You never know what input a user may provide that may not fit within a limit you think is sufficient but is not for someone out there using your system for something you didn't foresee (this is yet another moment to revisit the old adage of 'you are not your user').

I generally use a small number of important keywords, but sometimes, when looking for direct quotes, my searches can run fairly long (relatively speaking), so that's surely one use case I can imagine where having more space would be useful.


First of all, referring to real search cases is important. If you are in possession of any data you can analyze, that would be awesome.

Based on the above, you'll be able to say what is "normal" and what is "a lot". I believe for many systems the "normal" searches are within 5 to 20, maybe 30 characters (or maybe... 40?) but it's easy to imagine a situation when someone needs to enter this very very long name of a computer maker, model name, ten different parameters etc. This will require more characters of course.

Additionally, even within systems with 99% of short searches, edge cases happen. Especially, advanced users may just need some extra characters, maybe even use an advanced syntax to exclude some words, e.g. !green or -green. This may require extra input space.

Note that if there is just a small percentage of these extreme cases, it makes sense to allow entering them while not actually optimizing the visual interface to them (for example if 99% of users enter 10 characters, and 1% of them enter 100 characters, it would make sense to keep the search bar relatively narrow while allowing to enter longer texts). It's not that obvious, though, when these long searches sum up to e.g. 15% of the searches.

Finally, mind what the search engine can cope with, especially when it comes to these two topics:

  • If there is a limit on the search engine side, it would be nice to actually have the same limit on the UI side. Why? Because if you let User enter 100 characters and the search engine will only use 50 to perform the search, search results will not adhere to User intention.
  • If, on the other hand, there is no such limit on the backend side and you could possibly enter thousands of characters in the search field, this might, in theory, affect the system stability for all users. In theory because that would mean that such a search mechanism doesn't have any backend limitations, which I don't believe is a common situation.

What Google has recently introduced works really well:

enter image description here

For short search strings, there is space for one short line as usual, but when that length is exceeded, the input box grows. (When the cursor is moved elsewhere, the box reverts to its original size.)

I'd suggest:

  • Allow as much input as the ultimate user of that data can handle.
  • Start with a small box that will handle most common cases.
  • Grow the box vertically, but only as needed.
  • Provide a remaining-characters countdown if there is a limit.

Links have limits by the way, 2048 your link can be. And since the search bar will be using a link you have less than 2048 characters to work with. Set your search limit to 2000, since I'm not seeing your domain name taking up that many characters.

Also the user even getting close to your typing limit will not be the easiest thing for them to do. This feels like you are programming for an edge case.

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.