URL encoding explained: what %20 really means
URLs can only carry a small set of characters safely. Everything else — spaces, ampersands inside values, non-ASCII text — gets percent-encoded: each byte becomes a % followed by two hex digits. A space turns into %20, an ampersand into %26, and readable URLs turn into alphabet soup.
The detail that trips everyone: encoding a whole URL is different from encoding one component. encodeURI leaves URL punctuation like / and ? intact; encodeURIComponent encodes them too, because inside a query value they are data, not structure. Using the wrong one either breaks the URL or double-encodes it.
Open the free URL Encode/Decode — no signup, runs entirely in your browser.
How to use it
- Paste the text to encode, or the encoded string to decode.
- Pick the mode: component (encodeURIComponent) or full URL (encodeURI).
- Copy the result — malformed percent sequences are flagged instead of crashing.
Why this one
- Both modes: component-level and full-URL encoding and decoding.
- Full Unicode support — emoji and any script encode correctly.
- Malformed sequences produce clear errors, not silent mojibake.
- Runs locally in your browser, tokens and all.
Frequently asked questions
What is the difference between + and %20?
Both mean space, but in different places. In query strings (the form-urlencoded convention) a plus means space. Everywhere else in a URL a plus is a literal plus — only %20 always means space.
When should I use encodeURIComponent vs encodeURI?
Component mode for values going into a URL: query parameters, path segments, form fields. Full-URL mode only for encoding a complete URL while preserving its structure. When in doubt, component mode is the safe choice.
Why do I see %2520 in a URL?
That is double encoding: %25 is the percent sign itself, so %2520 is an encoded %20. Something encoded the value twice — usually a bug in whatever built the URL. Decode once to get %20, twice to get the space.