TextDeveloperConvertersGeneratorsBlogAboutContact

URL Encoding Explained: Why %20 Appears in Your Links

Development · 7 min read

If you have ever noticed odd sequences like %20 or %3D in a web address, you have seen URL encoding in action. Far from being random noise, these codes are a carefully designed system that lets URLs carry any kind of text safely. For developers, understanding URL encoding is essential, because getting it wrong leads to broken links, failed API calls, and mysterious bugs that are hard to track down.

Why URLs need encoding

URLs are only allowed to contain a limited set of characters: letters, digits, and a handful of symbols. Many characters, including spaces, ampersands, question marks, and slashes, have special meaning within a URL or are simply not permitted. If you tried to put a space or an ampersand directly into a link, it could break the address or be misinterpreted. URL encoding solves this by replacing unsafe characters with a percent sign followed by their hexadecimal code.

How percent-encoding works

The mechanism is straightforward. Each problematic character is converted to its byte value and written as a percent sign followed by two hexadecimal digits. A space becomes %20, an ampersand becomes %26, and an equals sign becomes %3D. This is why encoded URLs look cryptic; every reserved or unsafe character has been swapped for its safe percent code so the whole address can travel intact.

What URL encoding is

URL encoding, also called percent-encoding, is the process of converting characters into a format that can be safely transmitted in a web address. Because URLs can only contain a limited set of characters, anything outside that set, such as spaces, accented letters, or symbols like ampersands, must be represented in an encoded form. This ensures that a link works reliably across browsers, servers, and systems around the world.

How it works

The encoding scheme replaces unsafe characters with a percent sign followed by two hexadecimal digits representing the character's value. A space, for example, becomes the sequence percent twenty, and other reserved characters follow the same pattern. When a server receives the encoded URL, it decodes these sequences back into the original characters, so the meaning is preserved even though the transmitted text looks different.

Why it matters

Without URL encoding, characters that have special meaning in a web address would break links or be misinterpreted. An ampersand, for instance, separates parameters in a query string, so an ampersand that is meant to be part of your data must be encoded to avoid confusion. Encoding keeps the structure of a URL unambiguous, which is essential for search parameters, form submissions, and shared links to work correctly.

When you encounter it

You meet URL encoding constantly, often without noticing. Search queries, tracking links, and any address containing spaces or special characters rely on it. Developers encode data before placing it in a URL and decode it on the other side, while everyday users see it in the sometimes cryptic-looking links they copy and paste. Our encoder and decoder let you convert text either way instantly, which is handy for debugging links or preparing data for the web.

Frequently asked questions

What is URL encoding?

It converts characters that are not safe in a web address into a percent-encoded form so links work reliably.

Why does a space become percent twenty?

Spaces are not allowed in URLs, so they are replaced with their encoded representation, percent twenty.

When do I need to encode a URL?

Whenever a URL contains spaces, special characters, or reserved symbols that would otherwise break the link.

Advertisement

When you need to encode

The most common time you need URL encoding is when building query strings, the part of a URL after the question mark that carries parameters. If a parameter value contains a space, an ampersand, or any reserved character, it must be encoded, or it will corrupt the rest of the query. This is especially important when passing user input, search terms, or data with punctuation into a URL.

When you need to decode

Decoding is the reverse process, turning percent codes back into readable characters. You will need it when reading parameters from a URL, debugging a request, or displaying a link in a human-friendly form. Doing this by hand is tedious and error-prone, which is exactly why a URL encoder and decoder tool is so useful; it handles the conversion in both directions instantly and correctly.

Avoiding common mistakes

A frequent error is encoding a whole URL when you should only encode the individual parameter values, which can break the structural characters that are supposed to stay as they are. Another is forgetting to encode user input at all, leading to broken links when someone enters unusual characters. The safe habit is to encode each value as you assemble a URL, and to use a reliable tool to check your work whenever a link is not behaving as expected.

Try our free tools

URL Encoder · Base64 Encoder

← Back to all articles