URL Encoding Cheat Sheet

Which characters need percent-encoding, what each one becomes, and which function to use in your language.

Cheat sheetPrintableFree, no login

Updated 28 October 2026

Encode or decode text, and split a URL's query string into an editable table.

Open the URL encoder

How percent-encoding works

URL encoding (percent-encoding) replaces a character with % followed by two hex digits for each of its UTF-8 bytes. A space becomes %20; Γ©, which is two bytes in UTF-8, becomes %C3%A9.

Percent-encoding table

CharacterEncodedNote
space%20Space. In form data and query strings often written +
!%21
"%22
#%23Starts the fragment
$%24
%%25Must always be encoded when it's data
&%26Separates query parameters
'%27
(%28
)%29
*%2A
+%2BMeans space in form data, so encode a real +
,%2C
/%2FPath separator
:%3AAfter the scheme and before the port
;%3B
<%3C
=%3DBetween a parameter's name and value
>%3E
?%3FStarts the query
@%40Separates user info from the host
[%5B
\%5C
]%5D
^%5E
`%60
{%7B
|%7C
}%7D
~%7EUnreserved β€” normally left as ~

Click an encoded value to copy it. Hex digits are case-insensitive, but uppercase (%2F) is recommended.

Non-ASCII characters

CharacterUTF-8 bytesEncoded
Γ©2%C3%A9Try β†—
ΓΌ2%C3%BCTry β†—
€3%E2%82%ACTry β†—
ζ—₯3%E6%97%A5Try β†—
πŸ˜€4%F0%9F%98%80Try β†—

encodeURI vs encodeURIComponent

JavaScript functionLeaves unencodedUse it for
encodeURIComponent()A–Z a–z 0–9 - _ . ! ~ * ' ( )A single query value or path segment. The right choice most of the time
encodeURI()The above plus ; , / ? : @ & = + $ #A whole URL that is already put together
new URLSearchParams()A–Z a–z 0–9 * - . _, space β†’ +Building query strings and form bodies
escape()β€”Nothing. Deprecated; it doesn't handle UTF-8 correctly

For strict RFC 3986, also encode ! ' ( ) * after encodeURIComponent().

URL encoding in other languages

LanguageQuery value (space β†’ %20)Form data (space β†’ +)
JavaScriptencodeURIComponent(s)new URLSearchParams({ q: s }).toString()
Pythonurllib.parse.quote(s, safe='')urllib.parse.quote_plus(s) or urlencode(dict)
PHPrawurlencode($s)urlencode($s)
JavaURLEncoder.encode(s, StandardCharsets.UTF_8).replace("+", "%20")URLEncoder.encode(s, StandardCharsets.UTF_8)
Gourl.PathEscape(s)url.QueryEscape(s)
C#Uri.EscapeDataString(s)WebUtility.UrlEncode(s)
curlcurl -G --data-urlencode 'q=a b' URLsame (curl uses %20 for spaces)

Common mistakes

Frequently asked questions

What is %20 in a URL?
%20 is an encoded space. Spaces aren't allowed in URLs, so they're replaced with % plus the hex code 20.
Should spaces be %20 or +?
Use %20 in paths and in most APIs. + is only a space in form data (application/x-www-form-urlencoded) and query strings built that way. Decoders for query strings usually accept both.
What is the difference between encodeURI and encodeURIComponent?
encodeURI keeps characters that give a URL its structure (: / ? & = #), so use it on a complete URL. encodeURIComponent encodes those too, so use it on a single value you are putting into a URL.
Why do I see %2520 in my URL?
The URL was encoded twice: % became %25, so %20 turned into %2520. Encode once, just before building the URL.
Does URL encoding work with emoji and other languages?
Yes. The character is converted to UTF-8 bytes and each byte is encoded, so πŸ˜€ becomes %F0%9F%98%80.
βœ“ Copied!