URL Encoder/Decoder
Encode and decode URLs and URL components
Last updated
How to Use This Tool
Paste a URL or query string, then encode or decode it so it works correctly in links and APIs.
When Should You Use This Tool?
Use this when spaces, symbols, or non-English characters break a URL or when youβre building query parameters.
See also: Unit Converter, Coin Flip .
What is URL encoding?
URL encoding, also called percent-encoding, replaces characters that are unsafe or have a special meaning in a URL with a % sign followed by two hexadecimal digits for each byte. A space becomes %20, an ampersand becomes %26, and non-ASCII characters are first converted to UTF-8 bytes, so Γ© becomes %C3%A9. This tool encodes text with JavaScript's encodeURIComponent() and decodes it with decodeURIComponent(), the same functions web applications use. By default the decoder also reads + as a space, as HTML forms do.
How do I encode or decode a URL with this tool?
- Choose Encode URL or Decode URL in the Operation menu.
- Paste the text or the encoded string into the input box.
- When decoding, leave Treat + as space when decoding checked for form data and query strings, or uncheck it to keep every
+as a literal plus sign. - Click Process to see the result.
- Click Copy Result to copy it.
The conversion happens in your browser. If a string cannot be decoded, the tool shows an error message in the result area that points to the problem, and there is no result to copy.
What are the common percent-encoded characters?
This table shows what the encoder produces for characters you are likely to find in query strings and paths:
| Character | Encoded | Why it needs encoding |
|---|---|---|
| space | %20 | Spaces are not allowed in URLs |
& | %26 | Separates query parameters |
= | %3D | Separates a parameter name from its value |
? | %3F | Starts the query string |
# | %23 | Starts the fragment, so the rest is never sent to the server |
/ | %2F | Separates path segments |
+ | %2B | Read as a space by form decoders, including this tool by default |
% | %25 | Starts every encoded sequence |
: | %3A | Separates the scheme and the port |
@ | %40 | Separates user info from the host |
, and ; | %2C and %3B | Reserved delimiters |
", <, > | %22, %3C, %3E | Not allowed in URLs |
Γ© | %C3%A9 | Non-ASCII, encoded as two UTF-8 bytes |
β¬ | %E2%82%AC | Non-ASCII, three UTF-8 bytes |
| π | %F0%9F%98%80 | Emoji, four UTF-8 bytes |
Letters, digits and the characters - _ . ! ~ * ' ( ) are left unchanged.
Should I encode the whole URL or only the parameters?
Encode each query parameter value (or path segment) on its own, then put the URL together. Encoding the whole URL also encodes the ://, /, ? and = that give the URL its structure, and the result no longer works as a link:
Value: rock & roll/jazz
Encoded: rock%20%26%20roll%2Fjazz
Correct URL: https://example.com/search?q=rock%20%26%20roll%2Fjazz
Whole URL encoded (broken):
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Drock%20%26%20roll
Leaving the value unencoded is just as bad. In ?q=rock & roll the server sees & as the start of a new parameter, so q only receives "rock ".
Why does a space become %20 and not +?
This tool uses encodeURIComponent(), which always encodes a space as %20. The + form comes from HTML form encoding (application/x-www-form-urlencoded), which browsers use when submitting forms and which URLSearchParams produces. Most servers accept both in a query string.
Decoding accepts both. With Treat + as space when decoding checked (the default), a+b%20c decodes to a b c, which is what a server does with a submitted form. Uncheck it to decode only percent sequences, and a+b%20c decodes to a+b c. Leave it unchecked for URL paths, where + is a literal plus sign. A real plus sign, such as in a phone number, should be sent as %2B, which always decodes to +.
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent(), which this tool uses, encodes every reserved character and is meant for single values. encodeURI() leaves URL structure characters alone and is meant for a complete URL that only needs spaces and non-ASCII characters fixed.
| Character | encodeURIComponent (this tool) | encodeURI |
|---|---|---|
& | %26 | & |
/ | %2F | / |
? | %3F | ? |
# | %23 | # |
= | %3D | = |
: | %3A | : |
| space | %20 | %20 |
Γ© | %C3%A9 | %C3%A9 |
How do I URL encode in other languages?
These are the closest equivalents to this tool. They agree on spaces and reserved characters, though a few differ on rare characters such as ! * ' ( ):
// JavaScript
encodeURIComponent("rock & roll") // rock%20%26%20roll
# Python
urllib.parse.quote("rock & roll", safe="") # rock%20%26%20roll
// PHP
rawurlencode("rock & roll"); // rock%20%26%20roll
// Java (uses + for spaces, like form encoding)
URLEncoder.encode("rock & roll", StandardCharsets.UTF_8) // rock+%26+roll
Why does decoding fail with an error?
Decoding fails when a % is not followed by two hex digits, or when the bytes do not form valid UTF-8. A literal percent sign, as in 100%, should have been encoded as 100%25. Old systems sometimes encoded Γ© as %E9 (Latin-1) instead of %C3%A9, and decodeURIComponent() rejects that as well. The error message names the part that failed: for 100% it points to the lone %, and for %E9 it explains that the UTF-8 form of Γ© is %C3%A9.