URL Encoder / Decoder
Percent-encode a single value or a whole URL, and decode escaped strings back to readable text.
Percent-encoding in one paragraph
A URL may only contain a small set of ASCII characters. Anything else — a space, a Chinese character, an ampersand that is part of a value rather than a separator — has to be written as a percent-escape: a % followed by two hex digits representing the UTF-8 byte. A space becomes %20, & becomes %26, and 你 becomes the three bytes %E4%BD%A0.
encodeURIComponent vs encodeURI
These two JavaScript functions are constantly confused, and picking the wrong one is the source of most broken links:
encodeURIComponent()escapes reserved delimiters too. Use it for pieces of a URL — a query value, a path segment, a filename in a?file=parameter.encodeURI()leaves: / ? # [ ] @ ! $ & ' ( ) * + , ; =alone. Use it when you have a complete URL and only want to escape characters that are illegal anywhere in it.
Encoding a full URL with encodeURIComponent is a classic mistake: every ? and & becomes literal text and the server receives one long path instead of a path plus a query.
The plus-sign trap
In application/x-www-form-urlencoded bodies — HTML forms, and some query parsers — a + means a space. In a URL path, + is just a plus. That is why decoding with the wrong convention turns C++ into C . The Decode tab here converts + to a space, which is what form-encoded data expects; if you are decoding a path segment, swap the plus back manually.
Double-encoding
If a decoded value still contains %20, it was encoded twice — usually because a value was escaped before being placed in a query string that was then escaped again. Decode repeatedly until the output stops changing.
Frequently asked questions
Should I encode the whole URL or just the parameter?
encodeURIComponent, then join. Encoding the finished URL with encodeURI only fixes illegal characters and is a fallback, not a substitute.Why does %20 sometimes show as +?
+-for-space comes from form encoding. In paths and most modern APIs %20 is the correct form; both decode to a space in this tool.