Maximum URL lengths
Posted by jpluimers on 2010/04/20
A client recently asked me what space should reserve to store URLs in their DBMS.
The plurality in the topic title is a hint: different systems have different limits on URL lengths.
Don’t use long URLs
If you use long URL’s (longer than say a coupe of 100 characters), then usually you have a problem.
First of all: short URL’s are easier to remember, index and search.
Second: long URL’s can pose problems.
It might be that your browser and server support them.
But a user might be behind an intercepting proxy (sometimes invisible to both you and your user) that imposes a URL limit.
Maximum URL lengths
Stackoverflow has a nice topic on URL lengths, some sites did research on this a while ago, and here is some more information I collected.
Let’s start with the official standard on this:
It warns though about URI’s longer than 255 characters, because back then (1999!) some older clients and proxy systems don’t support that.
Then there is RFC 3986 (Uniform Resource Locator (URI): Generic Syntax) which does not impose a limit on the total length of the URL, but indicates in section 2.3.3 the hostname is limited to 255 characters (because of DNS limitations).
Boutell did some research on URL lengths in 2006.
Their recommendation is to be careful with URL’s longer than 2000 characters.
ASP FAQ did some research back in 2001.
The odd thing back then was that Netscape 3-4 supported 8k URLs, but Netscape 6 only supported 2000 characters.
Some specific products (partly from Boutell and ASP FAQ, partly from my own research):
General: there is no theoretical limit on the URL length
If you need to reserve space in your DBMS, make it large or unlimited.
Let’s start with the client side.
Internet Explorer 4-8 have a maximum URL length of 2083 characters, but a practical limit of 2048 characters.
There is report of a bug in Internet Explorer 6 and 7 when exporting URL shortcuts: they are being truncated to about 259 characters.
This looks too much like the MAX_PATH value of 260 described here.
FireFox seems to have no practical limit.
It stops displaying after 64k characters, but can server more than 100k characters.
This holds for FireFox 1.5 up until the current FireFox version.
Danny Thorpe found out the hard way that the internal limit some FireFox versions is about 40k.
See the comment he made.
WebKit: Chrome, Safari
I could not find any limits on Chrome and Safari. Both are based on WebKit and it seems to have similar limits as FireFox has.
Though Opera has their own codebase, they don’t have a practical URL length limit, about 200-thousand still works.
Internet Information Server
For IIS version 6 and 7, the default limit is 16 kilobytes, with a maximum of 16 megabytes.
SharePoint imposes some extra limits on the fixed part of a URL and some explanation is in this Microsoft forum thread and this one.
The query string portion can be larger, but the fixed part is dynamic.
The above ling also has a reference to a URL Length Checker that you can use for SharePoint.
From version 6.5.3 on, the maximum URL length can be set in kilobytes. The default is 4 kilobytes.
NCT Research reports that older versions have a limit of 2048 characters (version 5.0.10 and up, including 6.x until 6.5.3), and versions below have a 1024 character limit.
SEOmofo did some research on the maximum URL length of search engines.
They both researched the length for indexing URL’s and the length for displaying them in search results.
Their winner is BING: it supports up to 2047 characters.
Google supports up to 1855 characters.