What is the maximum size of a URL? Does it depend on the browser being used?

The general rule (and most direct possible answer to the question without going into too much detail) is that if a URL has less than 2,000 characters then it should work in both the client side (browsers) and on the server side as well.

URL size limit according to the HTTP protocol

In case you don’t already know, HTTP is the protocol used as the foundation for communication on the Internet. The fact that HTTP is a protocol means that it provides a framework for how to communicate on the web. For this reason, if a maximum length for URL’s had to be defined it would be defined in the specification that defines the HTTP protocol. So, what does the HTTP protocol say about the URL size limit? Well, the HTTP protocol specification actually does not define any maximum length or size limit for URL’s. But, web browsers and servers do enforce limits to keep the size of URL’s reasonable.

What does the HTTP specification say about the max size of URL’s?

Well, according to an excerpt from the HTTP 1.1 specification (located here), the “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.” Remember that URL’s are just a subset of URI’s – so the term URL’s is pretty much interchangeable with the term URI’s in the prior statement.

The URL size limit in Internet Explorer versions 8 and 9

According to this article, the maximum URL length in Internet Explorer version 8 is 2,083 characters. IE 9 also has the same limit.

The URL size limit in other browsers

The URL size limit is actually much higher in some other browsers like Safari and Firefox (as mentioned here, but for the purpose of cross browser compatibility it makes sense to have your URL’s be as short as the “lowest common denominator”, which in this case would be Internet Explorer’s length of 2,083.

The Sitemaps protocol

Sitemaps are simple XML files used for websites to allow search engines to gather information about which URL’s on the site are available for crawling. There is actually a sitemap protocol, which says that only URL’s that are 2,048 characters or less will be supported. This is also a very important consideration if you want to work with SEO best practices.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.