Free tool · Developer tools
URL decode and encode
Percent-encode text for a URL, decode %XX sequences back to readable text, or take a URL apart into its protocol, host, path and query parameters. Nothing you enter leaves your device and no URL is ever opened.
- Free
- No sign-up
- Runs in your browser
Encoded10 characters escaped as %XX
- Input
- 24 characters
- Output
- 45 characters
- Escaped
- 10 sequences
| # | Name | Value (decoded) |
|---|
How to use the URL Encoder Decoder
- Choose Encode, Decode or Take a URL apart under What do you want to do?, then paste into the box.
- To encode, pick the Method: Component for one value, Whole URL for a full address, or Form data to write spaces as +.
- To decode, tick Treat + as a space for form data, or Keep malformed sequences instead of stopping to decode what can be decoded.
- Read the result, then press Copy, Download or Use result as input. A red message names the position of a bad sequence.
What is URL encoding and why is it needed?
A URL can only carry a small set of characters. RFC 3986 lists the unreserved ones: letters, digits, hyphen, period, underscore and tilde. Others, such as / ? # & =, have jobs in the structure of a URL, and everything else, including spaces, accented letters and emoji, has to be written as percent-encoding: a % followed by two hex digits for each byte of the UTF-8 text. So a space becomes %20 and the é in café becomes %C3%A9, because it is two bytes.
The example in the box, q=café au lait & ice/50%, becomes q%3Dcaf%C3%A9%20au%20lait%20%26%20ice%2F50%25 in Component mode. Every character that would be read as structure (=, &, / and the % itself) is escaped, so the whole string can be a single query value without changing what the URL means.
What is the difference between encodeURI and encodeURIComponent?
Component is encodeURIComponent. It leaves only letters, digits and - _ . ! ~ * ' ( ), so use it for one piece of a URL: a query value, a path segment or a fragment. Whole URL is encodeURI. It also leaves ; , / ? : @ & = + $ # alone, because they separate the parts of a full address. https://example.com/a b?x=1&y=é becomes https://example.com/a%20b?x=1&y=%C3%A9 and still works as a link.
Using the wrong one causes the classic bugs. encodeURI on a value that contains & or = leaves them in place and breaks the query string, while encodeURIComponent on a whole URL turns https:// into https%3A%2F%2F. Form data follows the application/x-www-form-urlencoded rules of the URL Standard: only letters, digits and * - . _ stay, and a space is written as + instead of %20. Tick Leave existing %XX sequences alone to avoid encoding twice: without it, a%20b becomes a%2520b, because the % is escaped too.
How do I decode a URL with percent signs, and what does %20 mean?
Choose Decode and paste the text. Each %XX is a byte in hex, and %20 is the byte 0x20, a space. A multi-byte character such as %E2%82%AC is read as UTF-8 and gives €. Plus signs are only spaces in form data, such as the query part of a submitted form, so they are left alone unless you tick Treat + as a space; when the text contains + the result shows a hint.
Decoding stops with an error when a sequence is malformed, the way decodeURIComponent throws a URIError. The message gives the position: a lone % or one not followed by two hex digits (100%), or bytes that are not valid UTF-8 (%C3%28, or a cut-off %E0%A4). Tick Keep malformed sequences instead of stopping to decode everything else and keep the broken pieces as written, with their positions listed. If the result still contains %XX, the text was encoded twice: use Use result as input to decode again.
Which characters need to be encoded, and what does the URL parts view show?
Always encode spaces, quotes, < >, non-ASCII letters, and any reserved character that you mean as data rather than structure. Take a URL apart shows how a browser reads an address: protocol, username, host, port, path, query string and fragment, the decoded path, and a table of query parameters with their decoded values, in order and including repeats such as two size parameters. It tells you when a link carries a username before the @, which can make a link look like a different site, and when the host uses punycode (xn--), which is how internationalized domain names are written.
The tool only reads the text. It never opens, requests or follows the URL, so it is safe to use for a link you do not trust. A relative address such as /docs/a%20b?x=1 is shown with a path and query but no host, and an address typed without a protocol is read as https.
Use it with
- Base64 Encoder Decoder: encode or decode Base64.
- JSON Formatter: format and validate JSON.
- HTML Entity Encoder: encode special characters.
Questions
What is URL encoding and why is it needed?
URLs may only contain a limited set of characters, so everything else is written as a % followed by two hex digits for each UTF-8 byte, such as %20 for a space.
What does %20 mean?
%20 is the byte 0x20 written in hex, which is a space. Form data often writes a space as + instead.
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent escapes everything except letters, digits and - _ . ! ~ * ' ( ) and is for single values. encodeURI also leaves ; , / ? : @ & = + $ # alone and is for whole URLs.
How do I decode a URL with percent signs?
Choose Decode and paste it. Tick Treat + as a space if it is form data. A malformed sequence gives an error with its position, or tick the keep option to decode the rest.
Which characters need to be encoded?
Spaces, non-ASCII characters and any reserved character such as / ? # & = that you mean as data. Letters, digits and - . _ ~ never need it.
Does this tool open or fetch the URL?
No. It only reads the text in your browser. Nothing is sent and no URL is ever requested.
Sources
How this page was made: the tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations were drafted with AI help and checked against the tool's own output.