Zoven

Why Links Break: URL Encoding and %20 Explained

Explainers · 6 min read · 2026-10-26

You have met %20. It appears the moment a link contains a space, and it is the visible edge of a rule that governs every URL on the internet: a URL is a strictly limited character set, and everything else must be percent-encoded. The space is simply the most common offender, followed by the ampersand, the hash, the plus sign and - increasingly - emoji.

A URL is a machine reading a form

Every URL has structure: scheme, host, path, then optionally a query string after "?", made of key=value pairs joined by "&", then optionally a fragment after "#". Those special characters are DELIMITERS - the grammar of the address. The moment your data contains one of them, the parser cannot tell grammar from content. A search for "tom & jerry" produces ?q=tom & jerry, which the server reads as a search for "tom " plus a mysterious parameter called " jerry". The ampersand got eaten by the structure.

How percent-encoding works

The fix is simple and universal: any character outside the allowed set is replaced with a percent sign followed by its two-digit hexadecimal byte value. A space is byte 0x20, so it becomes %20. An ampersand is %26, a hash is %23, a plus is %2B (important because in query strings a plus ALSO traditionally means space - a legacy of form encoding that causes real confusion). Non-Latin alphabets and emoji are encoded as their UTF-8 bytes, one triplet per byte: the snowman emoji is %E2%98%83.

The double-encoding bug

The classic production incident: a value that is already encoded gets encoded again, so %20 becomes %2520 (the percent sign itself encoded as %25). The user sees broken output, someone "fixes" it by decoding twice, and now unencoded input breaks instead. The rule that prevents the whole mess: encode exactly once, at the boundary where the value enters the URL, and never decode-and-re-encode in a loop. When a link misbehaves, decode it fully and read what actually arrived - the story is always in the bytes.

Slugs: the human-friendly branch

The path segment of a URL carries a different constraint: it should be readable, typable and safe to speak aloud. That is why publishing platforms convert titles into slugs - lowercase letters, digits and hyphens only, spaces collapsed into single hyphens. "10 Tips: Coffee & Code!" becomes "10-tips-coffee-code". Beyond aesthetics it is practical: percent-free URLs survive chat apps, QR codes, print and verbal handoff without a single escaping question, and they display unbroken in search results. If you are building URLs that humans will see, slugify first and encode only what remains.

A URL is a sentence with grammar characters as its punctuation. Percent-encoding is how you put punctuation INSIDE the sentence without ending it.

Tools mentioned in this article