The maximum URL length varies by browser and server, but here are the key limits for modern browsers and practical recommendations:
Browser-Specific Limits
Browser | Maximum URL Length (Characters) | Notes |
---|---|---|
Google Chrome | ~80,000 | Practical limit before address bar truncates (~2MB in some contexts). |
Mozilla Firefox | ~65,000 | Address bar truncates at ~64k, but supports longer via API/requests. |
Safari | ~80,000 | Similar to Chrome. |
Microsoft Edge | ~80,000 | Based on Chromium (same as Chrome). |
Internet Explorer | 2,083 | Legacy limit; obsolete since IE11 retirement (June 2022). |
Opera | ~80,000 | Chromium-based (matches Chrome). |
Server & Protocol Limits
- HTTP Specifications:
- No official maximum URL length, but servers often enforce limits.
- Apache: Default limit of 8,192 characters (configurable via
LimitRequestLine
). - Nginx: Default limit of 4,096 characters (adjustable with
large_client_header_buffers
). - Cloudflare/CDNs: Often truncate URLs over 16,384 characters.
- SEO Best Practices:
- Keep URLs under 2,000 characters for search engine compatibility (Google truncates URLs beyond this).
Practical Recommendations
- Keep URLs Short:
- Aim for < 2,000 characters for cross-browser and server compatibility.
- Avoid excessively long URLs for SEO, bookmarking, and sharing.
- Use POST for Large Data:
- For large payloads (e.g., form submissions), use
POST
instead ofGET
to avoid URL limits.
- Test Your Stack:
- Validate URL length handling in your specific browser, server, and CDN.
Why Limits Exist
- Security: Prevents buffer overflow attacks.
- Performance: Long URLs slow down parsing and caching.
- Usability: Address bars and logs truncate long URLs.
By adhering to these guidelines, you ensure compatibility and avoid unexpected truncation or errors.