What's the maximum length of a URL in different browsers?

Source: Internet
Author: User
Tags rfc

Https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsersShort Answer-de facto limit of characters

If you keep URLs under to characters, they ' ll work on virtually any combination of client and server software.

If you is 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 is able to handle the URI of any resource they serve, and should is able to handle URIs of unbounded length I F 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.1 5).

That RFC had 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 is found in practice. It is RECOMMENDED this 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-the-boutell.com-to-see-What individual browser and server implementations would support. It ' s worth a read, but the executive summary is:

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

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

Internet Explorer ' s limitations ...

IE8 ' s maximum URL length is 2083 chars, and it seems IE9 have a similar limit.

I ' ve tested IE10 and the address bar would only accept 2083 chars. You can click a URL which are longer than this, but the address bar would still only show 2083 characters of this L Ink.

There's a nice writeup in the IE internals blog which goes into some of the background to this.

There is 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, have a limit of 20 Characters in a URL. If you intend to use sitemaps, a limit have been decided for you! (See Calin-andrei Burloiu ' s answer below)

There ' s also some from the to the maximum URL length that search engines would crawl and index. They found the limit is 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 Limitrequestfieldsiz E.

Browser     Address bar   document.location                            or anchor tag------------------------------------------Chrome          32779           >64k      Android          8192           >64k                         Firefox          >64k           >64k      Safari           >64k           >64k      

See also the answer from Matas Vaitkevicius below.

Is this information up to date?

This is a popular question, and as the original are years old I'll try to keep it up to Date:as of Nov 201 6, the advice still stands. Even though IE11 may possibly accept longer URLs, the ubiquity of older IE installations plus the search engine limitation s mean staying under chars is the best general policy.

What's the maximum length of a URL in different browsers?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.