browsermaxquery-string

What is the maximum possible length of a query string?


Is it browser dependent? Also, do different web stacks have different limits on how much data they can get from the request?


Solution

  • RFC 2616 (Hypertext Transfer Protocol — HTTP/1.1) states there is no limit to the length of a query string (section 3.2.1). RFC 3986 (Uniform Resource Identifier — URI) also states there is no limit, but indicates the hostname is limited to 255 characters because of DNS limitations (section 2.3.3).

    While the specifications do not specify any maximum length, practical limits are imposed by web browser and server software. Based on research which is unfortunately no longer available on its original site (it leads to a shady seeming loan site) but which can still be found at Internet Archive Of Boutell.com:


    Additionally, the URL Length section of the Chromium Docs Guidelines for URL Display states the following:

    In general, the web platform does not have limits on the length of URLs (although 2^31 is a common limit). Chrome limits URLs to a maximum length of 2MB for practical reasons and to avoid causing denial-of-service problems in inter-process communication.

    On most platforms, Chrome’s omnibox limits URL display to 32kB (kMaxURLDisplayChars) although a 1kB limit is used on VR platforms.

    We can also confirm that kMaxURLDisplayChars size in the Chromium source code:

    const size_t kMaxURLDisplayChars = 32 * 1024;