Digital & Text Tools

Why a Space in a URL Can Break Things

A literal, unencoded space in a URL is technically invalid, and different software handles it inconsistently — some browsers silently auto-correct it, while other tools, scripts, or older systems may cut the URL off at the space entirely, treating everything after it as separate, unrelated text, which is exactly the kind of broken-link bug percent-encoding the space as %20 reliably prevents.

This is one of the most common real-world causes of a link that works when clicked casually in a browser but fails when passed through another script, email client, or system.

Why inconsistent handling is the real danger

The unpredictability is the actual problem — a modern browser is often forgiving enough to auto-encode a stray space, masking the underlying issue, but a script, an older application, or a different browser might not be, silently truncating or mangling the URL instead of failing loudly with a clear error.

Why %20 is the reliable fix

As covered in the percent-encoding guide, %20 is the standard, universally recognized encoding for a space, understood consistently by every compliant system — encoding a space this way removes the ambiguity entirely, rather than relying on each individual tool's own guesswork to handle a raw space correctly.

Frequently asked questions

Should I manually add %20 every time I write a URL with a space in it?

For a URL you're constructing programmatically or including a variable in, yes — use a proper encoding function (or this tool) rather than typing %20 by hand, since it also correctly handles every other character that needs encoding, not just spaces.

Why do some website URLs use a hyphen instead of a space in their addresses?

Many websites deliberately replace spaces with hyphens in their page URLs (a common SEO and readability convention) specifically to avoid needing percent-encoding at all in that part of the address, keeping the URL clean and human-readable.