URL encoder/decoder · Guide

URL Encode a Space: %20 vs + and When Each Is Correct

A space cannot appear literally in a URL, so it has to be encoded — but there are two encodings in circulation, %20 and +, and they are not interchangeable everywhere. Picking the wrong one produces values with stray plus signs or missing spaces.

The short answer

%20 is correct everywhere in a URL — path, query string, fragment. If you only remember one rule, use %20.

+ means a space only inside an application/x-www-form-urlencoded body, and by convention inside query strings that servers parse with form rules. In a path segment, + is a literal plus character, not a space.

Where the two encodings came from

Percent-encoding is defined by RFC 3986 and applies to URIs generally. The plus-for-space shortcut comes from the older HTML form submission format, which predates that spec and stayed for compatibility.

Most web frameworks decode + as a space in query strings, so both usually work there. That "usually" is what makes it worth being deliberate: a signature check, a CDN cache key, or a strict API parser may treat them as different strings.

Encoding a literal plus sign

This is where it bites. If your value genuinely contains +, such as a phone number +380501234567 or an email alias user+tag@example.com, you must encode it as %2B.

Sent unencoded in a query string, the server decodes it to a space and you receive " 380501234567". This is a classic source of "why did my email plus-alias break" bug reports.

Avoiding double encoding

Encode each value exactly once. A space encoded twice becomes %2520, because the % of %20 gets encoded to %25. If you see %25 in your URLs, something ran the encoder twice.

The usual cause is encoding a value in application code and then encoding the assembled URL again in a client library or template helper. Encode at one layer only, and log the final URL to confirm.

Frequently asked questions

Is %20 or + better for a query string?

Both are typically accepted, but %20 is valid in every part of a URL and is the safer default. Use + only when the receiver expects form encoding.

Why does my URL show %2520?

The value was encoded twice. %20 became %2520 when the percent sign itself was re-encoded. Remove the extra encoding step.

How do I send a real plus sign in a URL?

Encode it as %2B. Left as-is, most servers decode it to a space.

Ready to try it?

Open the free browser-based URL encoder/decoder and apply what you just read — no sign-up, runs locally.

Open the URL encoder/decoder tool