URL encoder and decoder
Percent-encode text for safe use in URLs and query strings, or decode %20-style sequences back to readable text. It runs in your browser and nothing is uploaded.
How to use it
- Paste a value or a full URL in the box.
- Pick the operation in Operation: encode a value, encode a full URL, form style or decode.
- When decoding form data, tick When decoding, treat + as a space.
- Click Copy to use the result.
A practical guide to URL encoding and decoding
Why URLs need encoding
A web address can only contain a small set of safe ASCII characters. Spaces, accented letters, emoji and symbols such as &, = or # either are not allowed or have a special meaning in a URL. Percent-encoding solves this by replacing each unsafe byte with a percent sign and two hexadecimal digits: a space becomes %20 and the letter é becomes %C3%A9, because é takes two bytes in UTF-8. You meet this when you build a search link, pass a value in a query string, write a redirect, call an API or debug a link that arrives broken. This tool encodes text for that purpose and decodes it back to readable text.
The four operations
The tool uses the standard functions built into JavaScript, so the results match what your browser or a Node.js server would produce. Nothing is uploaded.
| Operation | Behavior | Use it for |
|---|---|---|
| Encode a value (encodeURIComponent) | Encodes everything except letters, digits and - _ . ! ~ * ' ( ). This includes / ? & = # : @ | One value that goes inside a URL, such as a search term or a parameter |
| Encode a full URL (encodeURI) | Leaves the characters that give a URL its structure, such as : / ? & = # and @, untouched. Spaces and non-ASCII letters are still encoded | A complete address that only has spaces or accents to fix |
| Encode as form data (space becomes +) | Like the first one, but spaces become + and the characters ! ' ( ) * ~ are also percent-encoded | Bodies and query strings in the application/x-www-form-urlencoded style |
| Decode | Turns %XX sequences back into characters, reading them as UTF-8 | Reading a link that is full of % codes |
Worked example
- Type
café & crème brûléein Your text or URL and choose Encode a value (encodeURIComponent). The result iscaf%C3%A9%20%26%20cr%C3%A8me%20br%C3%BBl%C3%A9e. The ampersand became%26, so it cannot be mistaken for the separator between two parameters. - Paste the whole address
https://example.com/search?q=café & crèmeand choose Encode a full URL (encodeURI). You gethttps://example.com/search?q=caf%C3%A9%20&%20cr%C3%A8me. The structure is intact, but notice that the ampersand stayed as it was. For that reason, encode each value alone first when the text may contain & or =. - Choosing Encode a value (encodeURIComponent) for that same address gives
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20cr%C3%A8me, which is correct only if the whole address is itself a value, for example inside a redirect parameter. - Type
a b*cwith Encode as form data (space becomes +) and you geta+b%2Ac. - Paste
a+b%20c%C3%A9, choose Decode and tick When decoding, treat + as a space. The result isa b cé. With the box unticked, the + would stay as a plus sign.
Errors when decoding
Decoding fails in two cases, and the message tells you which. If a % is not followed by two hexadecimal digits, as in 100% sure, the tool points to the position of the bad percent sign (position 4 in that example). If the codes are well formed but do not make valid UTF-8, for example a lone %C3, you get an invalid sequence message; this usually means the string was cut off or was encoded with another character set. When encoding, the only failure is a lone surrogate character, which cannot be turned into UTF-8.
Tips and common mistakes
- Do not encode twice. If you see
%2520, the percent sign itself was encoded (%25 followed by 20); decode once more to get back to %20. - A plus sign means a space only in form-style query strings. In a path, a real + must be written as
%2B. - Do not apply the value mode to a complete URL, or the slashes and colons will be encoded and the link will stop working.
- Decoding does not check that a link is safe. Never open a decoded address you do not trust.
Related tools
To split an address into its parts, use the URL parser. To make a clean address from a title, try the slug generator, and for another common encoding see the Base64 encoder.
Questions
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent also encodes characters such as / ? & = # and is meant for a single value inside a URL. encodeURI leaves those alone so a whole URL keeps its structure.
Why do I get an invalid sequence error?
Decoding fails when a % is not followed by two hex digits, or when the codes do not make valid UTF-8. The message says which case it is.
Is a space %20 or +?
%20 is correct everywhere. + means a space only in form-style query strings (application/x-www-form-urlencoded), which is why there is a separate option.
Is my text uploaded?
No. Encoding and decoding use your browser only.