Policy to Define URL String Maximum Length Validation at 2,000 Characters

Tadashi Shigeoka ·  Tue, June 8, 2021

I’ll introduce the policy of “defining URL string validation with a maximum length of 2,000 characters or less.”

URL 2000文字

Background: Want to Define URL Validation

I researched the maximum character count to define URL validation.

Conclusion: Validate URLs with Maximum 2,000 Characters

As you can see from the information below, there are variations such as:

  • No limit
  • 2,083 characters
  • 2,048 characters

Since there are fluctuations, I decided there’s no need to push the limits.

I define validation with roughly 2,000 characters or less.

RFC: "The HTTP protocol does not place any a priori limit on the length of a URI"

3.2.1 General Syntax

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

Source: ハイパーテキスト転送プロトコル — HTTP/1.1

sitemaps.org: "Must be specified within 2,048 characters"

The page URL. Some web servers require this to start with the protocol (such as http) and end with a trailing slash. This value must be specified within 2,048 characters.

Source: sitemaps.org - プロトコル

Internet Explorer: "Maximum URL length is 2,083 characters"

Maximum URL length is 2,083 characters Internet Explorer

Source: URL の最大長は、2,083 文字Internet Explorer

That’s all from the Gemba about system design with URL string maximum length around 2,000 characters.

Reference Information