You’ve seen %20 in links and wondered if the URL is broken. It’s not — it’s URL encoding, also called percent-encoding, and it’s how the web smuggles spaces and special characters through addresses that were never designed for them.
Why it exists
A URL can only contain a limited set of characters safely: letters, digits, and a handful of symbols (- _ . ~). Everything else — spaces, &, ?, #, non-Latin scripts — must be converted to % followed by two hex digits.
- Space →
%20 &→%26#→%23- A Chinese character → a sequence like
%E4%B8%AD
The alternative would be ambiguity: & and ? have structural meaning in URLs, so a literal one inside a value has to be disguised.
When you need it
- Building query strings —
?q=coffee & cakebreaks;?q=coffee%20%26%20cakeworks. - Pasting non-ASCII text into URLs — Chinese, emoji, accents all get percent-encoded.
- Reading an encoded URL — decoding shows you the human-readable original.
The classic mistake
Double-encoding. If a value is already encoded (%20) and you encode it again, the % becomes %25, and the URL now contains %2520 — which decodes to the literal text %20, not a space. The rule: encode once, at the boundary where you build the URL; decode once, when you read it.
Doing it correctly
The URL encoder/decoder converts in both directions in your browser — paste on either side, get the other instantly. It handles full strings, so you can safely encode an entire query parameter without breaking the URL’s own structure.
When in doubt about whether a value needs encoding: if it contains anything that isn’t a letter, digit, or -_.~, encode it.