Blog
Custom Print on Demand Apparel — Free Storefront for Your Business
Wild & Free Tools

URL Encoding Cheat Sheet — Every Special Character, Code & Rule in One Place

Last updated: April 20269 min readEncode & Decode Tools

URL encoding converts unsafe characters into percent-encoded values that work in any URL. A space becomes %20, an ampersand becomes %26, and a hash becomes %23. This cheat sheet covers every character code, the encoding rules, and when you actually need to encode.

If you have ever seen %20 or %26 in a URL and wondered what it means, this is the complete reference. Every special character, its encoded value, and the rule that determines whether it needs encoding or not.

Essential URL Encoding Table — Most Common Characters

These are the characters you will encode most often. Bookmark this table:

CharacterNameURL EncodedNotes
(space)Space%20Use %20 everywhere. + works only in form data.
!Exclamation%21Unreserved in RFC 3986 but some APIs require encoding
"Double Quote%22Always encode in URLs
#Hash / Pound%23Reserved — starts fragment. Always encode in data.
$Dollar Sign%24Reserved sub-delimiter
%Percent%25Always encode — otherwise looks like an encoding prefix
&Ampersand%26Reserved — separates query params. Always encode in values.
'Single Quote%27Encode to prevent injection issues
(Open Paren%28Sub-delimiter, encode in strict contexts
)Close Paren%29Sub-delimiter, encode in strict contexts
*Asterisk%2ASub-delimiter
+Plus%2BReserved in form data (means space). Encode to send literal +.
,Comma%2CSub-delimiter, often left unencoded
/Forward Slash%2FReserved path delimiter. Encode when slash is data, not path.
:Colon%3AReserved — separates scheme, port. Encode in data.
;Semicolon%3BReserved sub-delimiter
<Less Than%3CAlways encode — HTML injection risk
=Equals%3DReserved — separates key=value pairs. Encode in values.
>Greater Than%3EAlways encode — HTML injection risk
?Question Mark%3FReserved — starts query string. Encode in data.
@At Sign%40Reserved — separates user@host. Encode in data.
[Open Bracket%5BReserved for IPv6 addresses
\\Backslash%5CNot valid in URLs — always encode
]Close Bracket%5DReserved for IPv6 addresses
^Caret%5EUnsafe — always encode
`Backtick%60Unsafe — always encode
{Open Brace%7BUnsafe — always encode
|Pipe%7CUnsafe — always encode
}Close Brace%7DUnsafe — always encode
~Tilde%7EUnreserved — never needs encoding

Characters That Never Need Encoding

RFC 3986 defines these as unreserved characters — they are safe to use anywhere in a URL without encoding:

Everything else — every other character including spaces, symbols, and non-ASCII characters — should be percent-encoded when used as data in a URL.

Reserved vs Unreserved — The Core Rule

URL encoding rules come down to one question: is this character being used as a delimiter (its reserved meaning) or as data?

CategoryCharactersRule
UnreservedA-Z a-z 0-9 - _ . ~Never encode. These are always safe.
Reserved (delimiters): / ? # [ ] @ ! $ & \' ( ) * + , ; =Do NOT encode when used as URL structure (path separator, query marker, etc.)
Reserved (as data)Same characters as aboveMUST encode when the character appears inside a data value (query parameter value, path segment data)
Unsafe / Otherspace " < > { } | \\ ^ ` and all non-ASCIIAlways encode. These characters are never valid in raw URLs.

Example: In https://example.com/search?q=tom&jerry, the & is a delimiter separating query parameters. But if the search term is literally "tom&jerry" (one value), the & must be encoded: ?q=tom%26jerry.

Non-ASCII Characters (Unicode, Emoji, Accents)

Characters outside the ASCII range — accented letters (e, u), Chinese/Japanese/Korean characters, emoji — are encoded by first converting to UTF-8 bytes, then percent-encoding each byte.

Modern browsers display the decoded characters in the address bar for readability, but the actual HTTP request uses the percent-encoded form.

URL Encoding in Different Programming Languages

Every language handles URL encoding slightly differently. Here is the correct function to use in each:

LanguageEncode FunctionEncodes Spaces AsNotes
JavaScriptencodeURIComponent()%20Encodes everything except A-Z a-z 0-9 - _ . ! ~ * \' ( )
Python 3urllib.parse.quote()%20Use quote_plus() if you need + for spaces (form encoding)
JavaURLEncoder.encode()+ (plus)Returns + for spaces. Replace + with %20 if needed for path encoding.
C#HttpUtility.UrlEncode()+ (plus)Use Uri.EscapeDataString() for %20 instead of +
PHPurlencode()+ (plus)Use rawurlencode() for %20 instead of +
Gourl.QueryEscape()+ (plus)Use url.PathEscape() for %20 instead of +
RubyCGI.escape()+ (plus)Use ERB::Util.url_encode() for %20

Notice the pattern: most languages default to + for spaces (form encoding). If you need %20 (path encoding), look for the "raw" or "component" variant of the function.

Common URL Encoding Mistakes

Pair These Tools Together

Honest Limitations

This cheat sheet covers standard URL encoding per RFC 3986. Some APIs and platforms have additional encoding requirements — for example, OAuth 1.0 requires encoding of all characters except unreserved ones using uppercase hex digits. Amazon S3 URLs have specific encoding rules for object keys. Always check the specific API documentation for edge cases beyond the standard.

Encode or decode any URL right now — paste your text and get the result instantly.

Open URL Encoder Decoder
Launch Your Own Clothing Brand — No Inventory, No Risk