Why a Space Needs a Code in a URL

A space is ordinary punctuation in writing, but it is awkward inside a web address. Software often uses spaces to separate items—for example, to mark where one command-line argument ends and the next begins. If a URL contained a literal space, different systems could disagree about whether it belonged to the address or marked a break. The standard solution is to encode it rather than leave it raw.

What `%20` Means

`%20` is a form of percent-encoding: the percent sign introduces two hexadecimal digits that stand for a byte. The hexadecimal number `20` represents the space character in the ASCII character set. A browser or server can therefore read `%20` as “put a space here” while keeping the address itself continuous.

This is not the same as replacing every space with a hyphen. A hyphen is an actual character in the address, so `red-shoes` and `red%20shoes` are different text. A site may choose hyphens when creating tidy, readable page names, but that is a naming choice, not the technical encoding of a space.

Why You May Not See the Code

When someone types or pastes an address containing a space, a browser may convert it to `%20` before sending the request. Other tools may reject the raw space or handle it differently, which is why correctly encoded links travel more reliably between browsers, messages, and software. The small code keeps the address unambiguous: machines see one uninterrupted string, while the encoded character still carries the meaning of a space.