%20 is the URL-encoded space.

In a URL, %20 stands for the space. Here is when to encode it, what it does in each part of a URL, and what every major language outputs.

Quick facts

Characterspace (invisible)
NameSpace
UnicodeU+0020
UTF-8 bytes20 (1 byte)
Percent-encoded%20
Lowercase form%20 — identical meaning
Double-encoded%2520
HTML form encoding+
RFC 3986 classNot allowed in URLs

What it means in a URL

A space can never appear raw in a URL — the HTTP request line uses spaces to separate the method, the path and the protocol version. Under RFC 3986 a space is %20 everywhere; under HTML form encoding (query strings built by forms and URLSearchParams) it is written as +.

RFC 3986 class: Not allowed in URLs. It is outside the characters RFC 3986 permits, so it must always be percent-encoded.

When to encode it

Where it appearsWhat to do
Path segmentEncode as %20
Query valueEncode as %20 or +
FragmentEncode as %20
Form bodyEncode as +

The mistake to watch for

Writing + for a space inside a path. Only query strings decode + as a space; in /my+file.pdf the server sees a literal plus sign.

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)%20encoded
JavaScript encodeURI(s)%20encoded
JavaScript URLSearchParams++
Python urllib.parse.quote(s)%20encoded
Python quote(s, safe="")%20encoded
Python urllib.parse.quote_plus(s)++
PHP rawurlencode($s)%20encoded
PHP urlencode($s)++
Java URLEncoder.encode(s, UTF_8)++
Go url.QueryEscape(s)++
Go url.PathEscape(s)%20encoded
Ruby URI.encode_www_form_component(s)++
Ruby ERB::Util.url_encode(s)%20encoded
C# / .NET Uri.EscapeDataString(s)%20encoded

Decoding it

decodeURIComponent('%20') returns a space. Python: urllib.parse.unquote('%20'); PHP: rawurldecode('%20'). Paste any string into the URL decoder to decode it in your browser.

← %C3%A9 Latin small letter e with acute (é)  ·  Full URL encoding table  ·  %21 Exclamation mark →

Common questions.

%20 is the percent-encoded form of the space, whose byte value is 0x20. Decoding the URL turns it back into the character.

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

%20 works everywhere. + means a space only in query strings and form bodies (HTML form encoding); in a path, + is a literal plus sign.

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.