URL Encoder / Decoder
Encode text so it can travel safely inside a URL, or decode a percent-encoded link back into readable text. If a URL contains a broken % sequence, the tool shows you where it is.
URL breakdown
Your text and URLs are encoded and decoded inside your browser and are never sent to our server.
How to use the URL Encoder / Decoder
- Paste your text or URL into the top box.
- To put a value inside a URL (a search term, a file name, a redirect address), press Encode component. To clean up a whole URL that contains spaces or accented letters, press Encode full URL.
- To read an encoded link, press Decode. If the text came from an HTML form, tick treat + as a space first.
- If the input is a complete URL, check the URL breakdown table to see the host, path and each query parameter decoded separately.
encodeURIComponent vs. encodeURI
Both functions replace unsafe characters with a % followed by the two-digit hexadecimal value of each UTF-8 byte, so "é" becomes %C3%A9 and a space becomes %20. They differ in which characters they leave alone:
- encodeURIComponent (the Encode component button) leaves only
A–Z a–z 0–9 - _ . ! ~ * ' ( )unchanged. Everything else is encoded, including the characters that give a URL its structure:; , / ? : @ & = + $ #. Use it for one piece of a URL, such as a query parameter value. If a search term contains "&" and you do not encode it, the server will read it as the start of a new parameter. - encodeURI (the Encode full URL button) leaves those structural characters as they are, so
https://example.com/a b?x=1becomeshttps://example.com/a%20b?x=1and still works as a link. The catch: it cannot tell whether a "&" or "?" inside your data was meant as data, so it is the wrong choice for encoding individual values.
Neither function encodes ! ' ( ) *, even though the URI standard reserves them. If a system you are sending to is strict about those characters, encode them by hand.
Spaces, plus signs and malformed sequences
HTML forms submitted with the default application/x-www-form-urlencoded format write spaces as + rather than %20. The two checkboxes let you produce and read that style. Without the decoding option, a + is kept as a literal plus sign, which is what decodeURIComponent does.
Decoding fails with a "URI malformed" error when the input contains a % that is not followed by two hex digits, or a sequence of bytes that is not valid UTF-8, for example %E9 from an old Latin-1 web page. Instead of just reporting the error, this tool finds the first broken sequence and highlights it with its line and column.
Frequently asked questions
Which button should I use for a query parameter?
Encode component. Encode each value on its own, then join them with & and =. Encoding the whole URL with it would also encode the slashes, the "?" and the "&", and the link would stop working.
Why does decoding say my URL is malformed?
There is a percent sign that is not followed by two hexadecimal digits, such as "100%" written literally, or the encoded bytes are not valid UTF-8. The error message highlights the exact spot. A literal percent sign should be written as %25.
What is double encoding?
It happens when already-encoded text is encoded again, so %20 becomes %2520. After decoding once you still see percent sequences. Decode a second time to get the original text, and fix the code that encodes twice.
Does this encode non-English characters?
Yes. Characters outside ASCII, such as ő, ß, 中 or emoji, are converted to their UTF-8 bytes and each byte is written as %XX.
Is my URL sent to a server?
No. Encoding, decoding and the URL breakdown all use JavaScript built into your browser. Nothing is uploaded or logged by this page.
Sources: MDN Web Docs: encodeURI(); MDN Web Docs: encodeURIComponent() (course mirror)