%5B is the URL-encoded left square bracket ([).

In a URL, %5B stands for the left square bracket ([). Here is when to encode it, what it does in each part of a URL, and what every major language outputs.

Quick facts

Character[
NameLeft square bracket
UnicodeU+005B
UTF-8 bytes5B (1 byte)
Percent-encoded%5B
Lowercase form%5b — identical meaning
Double-encoded%255B
HTML form encoding%5B
RFC 3986 classReserved — general delimiter

What it means in a URL

Square brackets are gen-delimiters reserved for IPv6 addresses in the host (http://[::1]/). Elsewhere they should be encoded as %5B. PHP and Rails-style array parameters (ids[]=1) are where they appear most.

RFC 3986 class: Reserved — general delimiter. It marks the structure of a URL (scheme, authority, path, query, fragment), so as data it must be encoded.

When to encode it

Where it appearsWhat to do
Path segmentEncode
Query valueEncode
FragmentEncode
Form bodyEncode

The mistake to watch for

Sending ids[]=1&ids[]=2 raw: many clients accept it, but strict parsers and some proxies reject unencoded brackets. Encode as ids%5B%5D=1.

What each language produces

Every function in this table encodes it. Output for the single character, UTF-8 input, tested against the real runtimes (see the encoding comparator for your own strings).

FunctionOutput
JavaScript encodeURIComponent(s)%5Bencoded
JavaScript encodeURI(s)%5Bencoded
JavaScript URLSearchParams%5Bencoded
Python urllib.parse.quote(s)%5Bencoded
Python quote(s, safe="")%5Bencoded
Python urllib.parse.quote_plus(s)%5Bencoded
PHP rawurlencode($s)%5Bencoded
PHP urlencode($s)%5Bencoded
Java URLEncoder.encode(s, UTF_8)%5Bencoded
Go url.QueryEscape(s)%5Bencoded
Go url.PathEscape(s)%5Bencoded
Ruby URI.encode_www_form_component(s)%5Bencoded
Ruby ERB::Util.url_encode(s)%5Bencoded
C# / .NET Uri.EscapeDataString(s)%5Bencoded

Decoding it

decodeURIComponent('%5B') returns the left square bracket ([). Python: urllib.parse.unquote('%5B'); PHP: rawurldecode('%5B'). Paste any string into the URL decoder to decode it in your browser.

← %40 At sign  ·  Full URL encoding table  ·  %5C Backslash →

Common questions.

%5B is the percent-encoded form of the left square bracket ([), whose byte value is 0x5B. Decoding the URL turns it back into the character.

Yes. Hex digits in percent-encoding are case-insensitive, so %5b and %5B mean the same thing. RFC 3986 recommends uppercase, and mixing cases can make caches and analytics count one URL as two.

Use your language’s encoder on the value: encodeURIComponent in JavaScript gives %5B, Python’s quote(s, safe="") gives %5B, PHP’s rawurlencode gives %5B.

More from the toolkit.

About this page. Written and maintained by Sri Murugan Systems, the developer of urlencodedecode.com. Character classes follow RFC 3986 §2; language outputs were generated by running each function in its real runtime.