What is the maximum length of a URL in different browsers? Stack Overflow,


answer any question

If you keep URLs under 2000 characters, they’ll work in virtually any combination of client and server software.

If you are targeting particular browsers, see below for more details specific limits.

Longer answer – first, the standards.

RFC 2616 (Hypertext Transfer Protocol HTTP/1.1) section 3.2.1 says

The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

That RFC has been obsoleted by RFC7230 which is a refresh of the HTTP/1.1 specification. It contains similar language, but also goes on to suggest this:

Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.

. and the reality

That’s what the standards say. For the reality, see this research over at boutell.com to see what individual browser and server implementations will support. It’s worth a read, but the executive summary is:

Extremely long URLs are usually a mistake. URLs over 2,000 characters will not work in the most popular web browsers. Don’t use them if you intend your site to work for the majority of Internet users.

(Note: this is a quote from an article written in 2006, but in 2015 IE’s declining usage means that longer URLs do work for the majority. However, IE still has the limitation. )

Internet Explorer’s limitations.

I’ve tested IE10 and the address bar will only accept 2083 chars. You can click a URL which is longer than this, but the address bar will still only show 2083 characters of this link.

There’s a nice writeup on the IE Internals blog which goes into some of the background to this.

There are mixed reports IE11 supports longer URLS – see comments below. Given some people report issues, the general advice still stands.

Search engines like URLs 2048 chars.

Be aware that the sitemaps protocol, which allows a site to inform search engines about available pages, has a limit of 2048 characters in a URL. If you intend to use sitemaps, a limit has been decided for you! (see Calin-Andrei Burloiu’s answer below)

There’s also some research from 2010 into the maximum URL length that search engines will crawl and index. They found the limit was 2047 chars, which appears allied to the sitemap protocol spec. However, they also found the Google SERP tool wouldn’t cope with URLs longer than 1855 chars.

Additional browser roundup

I tested the following against an Apache 2.4 server configured with a very large LimitRequestLine and LimitRequestFieldSize.

See also this answer from Matas Vaitkevicius below.

Is this information up to date?

This is a popular question, and as the original research is

9 years old I’ll try to keep it up to date: As of Sep 2017, the advice still stands. Even though IE11 may possibly accept longer URLs, the ubiquity of older IE installations plus the search engine limitations mean staying under 2000 chars is the best general policy.

Answer any question

WWW FAQs: What is the maximum length of a URL? has its own answer based on empirical testing and research. The short answer is that going over 2048 characters makes Internet Explorer unhappy and thus this is the limit you should use. See the page for a long answer.

Answer any question

The longest URLs I came across are data URLs

Example image URL from Google image results (11747 characters)

I wrote this test that keeps on adding ‘a’ to parameter until the browser fails

On Chrome I got:

It then blew up with:

HTTP Error 404.15 – Not Found The request filtering module is configured to deny a request where the query string is too long.

Same on Internet Explorer 8 and Firefox

I went easy mode and added additional limits to IISExpress applicationhost.config and web.config setting maxQueryStringLength=”32768″ .

after 7744 characters.

which didn’t help at all. I finally decided to use fiddler to remove the referrer from header.

Which did nicely.

Chrome: got to 15613 characters. (I guess it’s a 16K limit for IIS)

And it failed again with:

Internet Explorer 8 failed with iexplore.exe crashing.

Answer any question

Answer any question

There is really no universal maximum URL length. The max length is determined only by what the client browser chooses to support, which varies widely. The 2,083 limit is only present in Internet Explorer (all versions up to 7.0). The max length in Firefox and Safari seems to be unlimited, although instability occurs with URLs reaching around 65,000 characters. Opera seems to have no max URL length whatsoever, and doesn’t suffer instability at extremely long lengths.

The URI RFC (of which URLs are a subset) doesn’t define a maximum length, however, it does recommend that the hostname part of the URI (if applicable) not exceed 255 characters in length:

URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately apparent, and should limit these names to no more than 255 characters in length.

As noted in other posts though, some browsers have a practical limitation on the length of a URL.

URIs in HTTP can be represented in absolute form or relative to some

known base URI [11], depending upon the context of their use. The two

forms are differentiated by the fact that absolute URIs always begin

with a scheme name followed by a colon. For definitive information on

URL syntax and semantics, see “Uniform Resource Identifiers (URI): Generic Syntax and Semantics,” RFC 2396 [42] (which replaces RFCs 1738 [4] and RFC 1808 [11]). This specification adopts the definitions of “URI-reference”, “absoluteURI”, “relativeURI”, “port”,

“host”,”abs_path”, “rel_path”, and “authority” from that

The HTTP protocol does not place any a priori limit on the length of

a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs.* A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.


About Author:

Leave A Comment

Your email address will not be published. Required fields are marked *