What is URL encoding?
URLs may only contain a limited set of characters. Non-ASCII text, spaces and characters with a special meaning in URLs, such as &, = and ?, must be encoded before they go into a URL parameter. URL encoding (percent-encoding) converts each character to UTF-8 bytes and writes them as % followed by two hex digits; the Chinese character 中, for example, becomes %E4%B8%AD.
How to use
- Click "Encode" or "Decode" to choose the direction; the selected button stays highlighted.
- Type in the Input box. With "Auto convert" on, the result appears as soon as you stop typing.
- "Use result as input" moves the result to the left and flips the direction.
Should spaces become %20 or +?
- %20 (default): follows the URL standard RFC 3986 and works anywhere in a URL.
- +: the format used when HTML forms are submitted (
application/x-www-form-urlencoded). Turn on "Space as +"; when decoding,+is then treated as a space.
Example
a b&c=中文 encodes to:
a%20b%26c%3D%E4%B8%AD%E6%96%87
How does this differ from JavaScript's encodeURIComponent?
The results are almost the same. Following RFC 3986, this tool also encodes the five characters !, ', (, ) and *, keeping only letters, digits, -, _, . and ~. That is less likely to cause problems on different servers.
Encoding scope and URL parsing
- Parameter value (default): every special character is encoded, which is right for a value after
?q=. - Full URL: keeps the URL structure (
: / ? & = #) and encodes only what a URL does not allow, such as non-ASCII characters, spaces and symbols like[ ] |. For examplehttps://example.com/咖啡?q=拿 鐵becomeshttps://example.com/%E5%92%96%E5%95%A1?q=%E6%8B%BF%20%E9%90%B5. - Parse URL: "Parse URL" splits a URL into protocol, host, port, path and fragment, and lists every query parameter decoded in a table, including repeated ones. A
+in the query is read as a space, as servers do.
FAQ
Can I encode a whole URL?
With the default "Parameter value" scope, a whole URL breaks because ://, ? and & are encoded too. For a whole URL, set "Encoding scope" to "Full URL", which keeps the URL structure and encodes only what a URL does not allow; use "Parameter value" for a single value.
Decoding says "Invalid URL-encoded string"
Every % must be followed by two hex digits (0–9, A–F). If the text simply contains a percent sign (like 100%), it was never encoded and does not need decoding.
What does %2520 mean?
The text was encoded twice: the % itself was encoded again as %25. Decode once more to get the original.