Are square brackets permitted in URLs?

RFC 3986 states

A host identified by an Internet
Protocol literal address, version 6
[RFC3513] or later, is distinguished
by enclosing the IP literal within
square brackets (“[” and “]”). This
is the only place where square bracket
characters are allowed in the URI
syntax.

So you should not be seeing such URI’s in the wild in theory, as they should arrive encoded.

Leave a Comment