Look closely at a URL with a space or special character in it, and you'll often see something like %20 in place of where a space should be. This isn't a glitch — it's URL encoding (also called percent-encoding), and it exists to solve a very specific technical problem.

Why URLs Can't Contain Certain Characters Directly

URLs are built using a limited, standardized set of characters. Spaces, certain punctuation marks, and non-Latin characters can be misinterpreted by the systems that parse URLs — a literal space, for instance, could be mistaken for the end of the address. URL encoding converts these problematic characters into a safe, standardized format that every system parsing the URL can interpret the same way.

How Percent-Encoding Actually Works

Each character that needs encoding is converted to its byte value, then represented as a percent sign followed by that value in hexadecimal. A space becomes %20 because its standard byte value, 32 in decimal, is 20 in hexadecimal. An ampersand (&) becomes %26, and so on for each character outside the URL-safe set.

Why This Matters Beyond Just Spaces

  • Special characters in search queries: Searching for "tools & calculators" generates a URL with the ampersand encoded, since an unencoded ampersand has a specific reserved meaning in URLs (separating query parameters).
  • Non-English characters: Characters outside basic English letters often need encoding to ensure consistent interpretation across different browsers, servers, and systems.
  • Passing data in query strings: When data is passed as part of a URL (like a search term or form value), any characters that could be misread as part of the URL's structure need to be encoded first.

What Happens Without Proper Encoding

An unencoded space or special character in a URL can cause the link to break entirely, get truncated at the problematic character, or get misinterpreted by the receiving server — leading to a broken link, a 404 error, or in the worst cases, a security vulnerability where unexpected characters interfere with how a server processes the request. This is exactly why proper encoding matters for developers building anything that constructs URLs dynamically, not just for aesthetics.

Encoding vs. Decoding in Practice

Most modern browsers and frameworks handle encoding automatically when you type a URL or submit a form, which is why most users never need to think about it directly. Developers, however, frequently need to manually encode or decode specific values when building APIs, constructing dynamic links, or debugging why a particular URL isn't behaving as expected.

Frequently Asked Questions

Why do some URLs use + instead of %20 for spaces? This is a convention specific to a particular encoding context (form submission query strings), distinct from general URL path encoding — both represent a space, but the + convention is more limited to that specific use case.

Is URL encoding the same as URL shortening? No — URL encoding makes special characters safe within a URL's existing length; URL shortening is a completely separate technique that replaces a long URL with a short redirect link.

Encode or decode any text or URL instantly with our URL Encoder/Decoder.