How Long Can a URL Be? The Limits at Each Layer
There is no single maximum length for a URL. The standards set limits on some parts and recommendations for the rest. The hostname can be at most 253 characters, with 63 per label, under the DNS rules. For the whole URL, the HTTP specification, RFC 9110, recommends that all senders and recipients support URIs of at least 8,000 octets, but does not set an upper limit. In practice the limit you meet is set by software: web servers, proxies and content delivery networks have configurable caps on request-line or header size, browsers have their own limits, and some formats set firm rules, such as the 2,048-character limit for URLs in XML sitemaps. Keeping URLs well under 2,000 characters avoids almost all of these.
The limits, layer by layer
| Layer | Limit | Source or where it is set |
|---|---|---|
| Each hostname label | 63 octets | RFC 1035 |
| Full hostname | 253 characters as written (255 octets on the wire) | RFC 1035 |
| URI syntax | No maximum defined | RFC 3986 |
| HTTP | Support at least 8,000 octets recommended | RFC 9110 |
| Web servers and proxies | Configurable request-line or header buffer limits | Server configuration; defaults vary by product and version |
| Browsers | Implementation limits, usually far above everyday URLs | Each browser's own behaviour |
| XML sitemaps | Fewer than 2,048 characters per URL | The sitemaps.org protocol |
The hostname rows are the same limits listed in our reference table of domain numbers, and the reasons for 63 and 253 are set out in why the label limit is 63.
Why the standards avoid a hard maximum
RFC 3986 defines what a URI may contain, not how long it may be, because different schemes and systems have different needs. HTTP's newer specification takes a practical position instead: it recommends that implementations support at least 8,000 octets, so that ordinary URLs, even long ones with tracking or search parameters, work everywhere. A server that receives a request target longer than it is willing to handle should respond with status 414, URI Too Long, which RFC 9110 also defines.
Where long URLs actually break
- Servers and proxies. Web servers limit the size of the request line and headers to protect memory. When a URL exceeds the configured buffer, the request fails, often with a 414 or 400 error. The exact numbers depend on the product, version and configuration, so check the documentation of the software you run rather than relying on a figure from someone else's setup.
- Content delivery networks and load balancers. These sit in front of your server and apply their own limits, which may be lower than the origin server's.
- Browsers and apps. Modern browsers handle very long URLs, but address bars, bookmarks, chat apps and email clients may truncate or break them when shared.
- Logs and analytics. Long URLs can be cut off in log lines or analytics reports, which hides the parameters you wanted to see.
- Sitemaps. The sitemaps protocol requires each listed URL to be under 2,048 characters, so longer addresses cannot be submitted that way.
A note on fragments and query strings
Not every part of a URL travels to the server. The fragment, the part after #, stays in the browser and is never sent in the HTTP request, so it does not count against server limits, although it still counts for anything that stores or displays the full link. The query string, after ?, does travel with the request and is usually where long URLs come from: search filters, encoded state and tracking parameters add up quickly. When a query string grows, that is often a sign the data belongs in a request body or in server-side state instead.
Counting a URL's length correctly
Lengths are counted after encoding. Characters outside the allowed set, such as spaces or non-ASCII letters in a path, are percent-encoded, so one character can become three, six or more octets on the wire. An internationalised hostname is converted to its ASCII A-label form, beginning xn--, which is usually longer than the Unicode form. Our encoded length arithmetic and walk-through from Unicode to xn-- show how to do the count. A URL that looks short in an address bar can be much longer when sent.
Practical guidance for site owners and developers
- Keep page URLs short and readable. Descriptive paths of a few words are easier to share and less likely to be cut off.
- Send large data in the request body. If a form or API call would put a lot of data in the query string, use POST with a body instead of GET.
- Watch tracking parameters. Stacked campaign parameters can make shared links surprisingly long.
- Check every layer you control. Server, proxy and CDN limits should all comfortably exceed your longest legitimate URL.
- Check hostname length early. If you generate hostnames automatically, validate them against the label and total limits before creating DNS records; see how to check a long hostname before creating it.
Capitalisation also matters for how URLs are matched; that is covered in which parts of a URL are case-sensitive.
Frequently asked questions
What is the maximum length of a URL?
No standard sets one. HTTP recommends supporting at least 8,000 octets, the hostname is limited to 253 characters, and real limits are set by servers, proxies, browsers and formats such as sitemaps.
Is 2,048 characters a URL limit?
It is the sitemaps.org limit for URLs listed in a sitemap, and a sensible upper target for shareable links, but it is not a limit in the HTTP or URI standards.
What error does a server return for a URL that is too long?
Status 414, URI Too Long, is defined for this case. Some software returns 400 Bad Request instead.
For more limits with their sources, return to the Learn hub.