Language : en | de | fr | es
Back to blogs

What Is URL Encoding and Why It Is Used

What Does URL with %20 Mean?

If you have ever copied a link and noticed strange sequences like %20, %3A, or %2F, you are looking at encoded characters. The most common of these is %20, which represents a space. Understanding what does %20 in URL mean is essential for developers, SEO specialists, and anyone working with web technologies.

This article explains how URL encoding works, why %20 appears in web addresses, and how to handle it correctly in real-world scenarios.

What does %20 in URL mean: The Technical Explanation

In URLs, spaces are not allowed as literal characters. The web uses a standard called percent-encoding (also known as URL encoding) to represent special characters.

%20 is the hexadecimal representation of the ASCII space character.

Why 20?

  • Space in ASCII = decimal 32
  • 32 in hexadecimal = 20
  • Percent-encoding format = % + hex value

So:

Space → ASCII 32 → Hex 20 → %20

That is the entire logic behind %20 is space.

Example

Original text:

https://example.com/my page.html

Encoded version:

https://example.com/my%20page.html

Browsers automatically convert spaces into %20 URL Encode format to make the address valid.

URL Encoding %20: Why It Exists

URLs must follow strict standards defined by RFC 3986. Only specific characters are allowed directly. Others must be encoded.

Characters that typically require encoding:

  • Space
  • ?
  • &
  • =
  • %
  • Non-ASCII characters (e.g., é, ü)

Example: Query Parameters

Unencoded (invalid):

https://example.com/search?q=red shoes

Encoded:

https://example.com/search?q=red%20shoes

Without encoding, the browser cannot correctly interpret the URL structure.

%20 in Web Address vs Other Encoded Characters

While %20 is the most common, many characters are encoded similarly.

Character

ASCII (Dec)

Hex

Encoded

Space

32

20

%20

!

33

21

%21

"

34

22

%22

#

35

23

%23

&

38

26

%26

/

47

2F

%2F

Understanding this table helps when debugging URLs manually.

%20 Meaning in URL Paths vs Query Strings

The behavior of encoding differs slightly depending on where it appears.

1. Path Segment

https://example.com/files/My%20Document.pdf

Here, %20 represents a literal space in the filename.

2. Query Parameters

https://example.com/search?keyword=machine%20learning

Here, it represents a space inside a query value.

3. Fragment Identifiers

https://example.com/page#Section%202

Even anchors may contain encoded spaces.

Http %20 and Server Interpretation

Servers automatically decode percent-encoded values before processing requests.

For example:

GET /products/Red%20Shoes HTTP/1.1

The server receives:

/products/Red Shoes

This decoding step happens:

  1. Browser encodes unsafe characters.

  2. HTTP request is sent.

  3. Server decodes.

  4. Application processes readable string.

This is why developers rarely see %20 inside application logic unless logging raw URLs.

Practical Developer Examples

Example 1: JavaScript Encoding

encodeURIComponent("red shoes");

Output:

red%20shoes

Example 2: Decoding in JavaScript

decodeURIComponent("red%20shoes");

Output:

red shoes

Example 3: Python

import urllib.parse

encoded = urllib.parse.quote("data science")

print(encoded)

Output:

data%20science

Decoding:

urllib.parse.unquote("data%20science")

When %20 Should Not Be Used

In query strings, spaces can sometimes appear as +.

Example:

https://example.com/search?q=red+shoes

In form submissions using application/x-www-form-urlencoded, space is encoded as +, not %20.

Important difference:

  • %20 → standard percent encoding
  • + → special case for form data

This distinction matters in backend parsing.

SEO and %20 in URLs

Search engines handle encoded spaces correctly. However, best practices suggest:

  • Avoid spaces in URLs entirely.
  • Use hyphens (-) instead.

Preferred:

https://example.com/red-shoes

Instead of:

https://example.com/red%20shoes

Why?

  • Cleaner structure
  • Better readability
  • Fewer encoding steps
  • Lower risk of copy-paste issues

Common Mistakes and Debugging Tips

1. Double Encoding

Wrong:

red%2520shoes

Here %25 represents %, meaning the string was encoded twice.

2. Manual URL Construction

Avoid building URLs by string concatenation:

"/search?q=" + userInput

Instead:

"/search?q=" + encodeURIComponent(userInput)

3. Misinterpreting Encoded Slashes

%2F represents /. If incorrectly decoded, it can change path hierarchy.

Summary: Why %20 Appears in URLs

To summarize clearly:

  • %20 is space
  • It is part of percent-encoding.
  • It ensures URLs remain valid and machine-readable.
  • Browsers encode automatically.
  • Servers decode automatically.
  • It is required for safe HTTP transmission.

Understanding encoding is critical when:

  • Debugging APIs
  • Working with redirects
  • Handling user-generated content
  • Managing file downloads
  • Optimizing URLs for SEO

Whenever you see %20 in web address, it simply means a space has been safely encoded for transport across the web.

Modern frameworks handle this automatically, but knowing how it works helps prevent encoding bugs, security issues, and malformed requests in production systems.