Developer

URL Encoding Explained: %20 vs +, Reserved Characters & Rules

Percent encoding (also known as URL encoding) is how the internet transmits non-ASCII characters, spaces, and reserved syntax safely through web addresses. Complete guide to percent encoding in URLs: learn when to use %20 vs +, how reserved characters like & and ? work, and how to avoid encoding bugs.

Awais 3 min readPublished
URL Encoding Explained: %20 vs +, Reserved Characters & Rules

Percent encoding (also known as URL encoding) is how the internet transmits non-ASCII characters, spaces, and reserved syntax safely through web addresses. From query strings to API endpoints and OAuth redirects, percent encoding ensures your parameters arrive without corruption or broken parsing.

Despite being fundamental to web development, mixing up %20 vs +, forgetting to encode reserved characters like & or #, or double-encoding (%25) are among the most common bugs in web applications.

How percent encoding works

Under RFC 3986, characters permitted in a URI are divided into unreserved and reserved characters. Any character outside the unreserved set must be represented by a percent sign (%) followed by the two-digit hexadecimal representation of its byte value in UTF-8.

  • Unreserved characters (never encoded): A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), tilde (~).
  • Reserved characters (encoded when used as data): !, *, ', (, ), ;, :, @, &, =, +, $, ,, /, ?, %, #, [, ].
  • Space character: %20 (or + in HTML form query strings).
Need to encode a URL parameter or decode an analytics link? Use our free URL Encode / Decode tool to convert text with instant live output.

%20 versus +: Which should you use for spaces?

One of the most frequent points of confusion is whether to represent spaces as %20 or +:

  • Use %20: In URL path segments (/docs/user%20guide), modern REST APIs, and whenever adhering strictly to RFC 3986.
  • Use +: Only in standard application/x-www-form-urlencoded form POST bodies and traditional browser query strings (?search=web+tools).
# Valid path with %20:
https://example.com/files/my%20document.pdf

# Valid query with %20:
https://example.com/search?q=free%20tools

The reserved character trap: Why & and = break URLs

Suppose you have a parameter value "Ben & Jerry". If you concatenate it into a query string without percent-encoding, the URL becomes:

https://example.com/api?brand=Ben & Jerry

The server interprets "brand=Ben " as parameter 1, and "Jerry" as an empty parameter 2. By properly percent-encoding the ampersand as %26, the server receives the complete value intact: "?brand=Ben%20%26%20Jerry".

How to avoid double encoding bugs

Double encoding occurs when an already-encoded string is passed through an encoder a second time. The % sign itself (%25) gets encoded, turning "%20" into "%2520". Always encode at the moment of constructing query components, and decode once when extracting.


Frequently asked questions

Percent encoding (URL encoding) is a mechanism for converting characters not allowed in standard ASCII URI syntax into safe %XX hexadecimal byte sequences (e.g., space becomes %20).

%20 is the standard RFC 3986 percent-encoding for spaces in URL path and query components. The plus sign (+) is only valid for spaces in application/x-www-form-urlencoded query strings and HTML forms.

Characters like &, =, ?, and # have structural meaning in URLs. If a search query contains "rock & roll", an unencoded & will split the value into two separate unintended query parameters.

You can use ToolOrbit's free URL Encode / Decode tool to encode individual parameters (component mode) or entire URLs safely in your browser.


Tools mentioned

More reading

View all guides
Free Developer Tools Online: 2026 Developer Toolkit & Guides
Developer

Free Developer Tools Online: 2026 Developer Toolkit & Guides

Explore 30+ free browser-based developer tools: JSON formatters, Base64 converters, cron generators, regex testers, SQL formatters, and hash generators.

3 min readPublished
CSS Border Radius: 15 Copy-Paste Examples
Developer

CSS Border Radius: 15 Copy-Paste Examples

15 modern CSS border radius examples: rounded cards, pills, circle avatars, asymmetrical organic blobs, and fancy 8-value border radius shapes.

3 min readPublished
Percent Encoding Reference Table (Every Character)
Developer

Percent Encoding Reference Table (Every Character)

Complete percent encoding ASCII reference table: quick lookup for spaces, slashes, ampersands, punctuation, and UTF-8 special characters in URLs.

3 min readPublished
Cron Every Hour, Day & Midnight: All Daily Schedules
Developer

Cron Every Hour, Day & Midnight: All Daily Schedules

Master standard daily cron schedules: cron every hour, every day at midnight, twice a day, and custom hourly intervals with copy-paste examples.

4 min readPublished
Cron Expression Cheat Sheet — Copy-Paste Schedule Examples
Developer

Cron Expression Cheat Sheet — Copy-Paste Schedule Examples

Free cron expression cheat sheet with copy-paste examples for every 5 minutes, hourly, daily at midnight, weekdays only, and more.

5 min readPublished
Cron Every 10 Minutes — Syntax, Examples and Best Practices
Developer

Cron Every 10 Minutes — Syntax, Examples and Best Practices

Use the cron expression */10 * * * * to run jobs every 10 minutes, plus examples for common schedules and troubleshooting tips.

3 min readPublished
Why CSV Is Tricky to Parse: Delimiters, Quotes and Headers
Developer

Why CSV Is Tricky to Parse: Delimiters, Quotes and Headers

Why CSV files are harder to read correctly than they look, how to choose the right JSON shape, and the mistakes to avoid.

2 min readPublished
YAML vs JSON: Differences That Matter When Converting
Developer

YAML vs JSON: Differences That Matter When Converting

Why YAML is not just indented JSON, the types the two formats disagree on, and best practices for converting config files.

2 min readPublished