tags:

views:

316

answers:

4
+3  Q: 

Maximal URL length

Hello,

which is the maximum length of an URL? does it depend on the browser? its max length is specified by a RFC?

Thanks.

Duplicate of What is the maximum length of an url?

+3  A: 

Here are some info, guess it comes from bored people testing ;)

also, see this

kender
+1  A: 

It depends on the browser.

I think it's around 2048 characters in IE. Much longer in Firefox and others.

If you're asking the question for real practical need, then your url is probably too long :-)

Sam Meldrum
+2  A: 

URIs are defined in RFC 3986, and the ABNF syntax is in Appendix A.

There's no limit defined therein for the whole URI, although various parts are constrained in length - e.g. the hostname part is limited by DNS's limit of 255 characters.

However various web servers may barf if you send data that's too long. Similarly web clients may simply be unable to send request strings that are too long.

Alnitak
+1  A: 

(see this answer, copied here)

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).

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.

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 browser. Don't use them if you intend your site to work for the majority of Internet users.

Paul Dixon
Note that the latest editor's draft of the revised HTTP specification drops the cited Note.
Julian Reschke