URL Encoder / Decoder
Use encodeURIComponent for query values or encodeURI for a full URL, and decode either form safely.
Your data stays in your browser. This tool processes your input locally and does not upload it to a server.
What is URL encoding?
URL encoding, also called percent-encoding, replaces characters that are unsafe or reserved in a URL with a percent sign and two hex digits, such as %20 for a space. Non-ASCII characters are encoded as UTF-8 bytes. This tool uses the browser encodeURIComponent and encodeURI functions and runs locally.
Component mode versus URI mode
Component mode uses encodeURIComponent. It encodes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for a single value, such as one query parameter or a path segment, because it also encodes ? & = / : # that would otherwise change the URL structure.
URI mode uses encodeURI. It keeps those structural characters so a whole URL stays usable, and only encodes things like spaces and non-ASCII letters. Using it on a single value is a common bug: an ampersand in the value would then split the parameter.
Decoding and privacy
Decoding uses decodeURIComponent, which turns %XX sequences back into text and reads multi-byte sequences as UTF-8. A malformed sequence such as a lone % raises an error, which the tool reports as an invalid encoded URL. A plus sign is not converted to a space.
Processing happens in your browser. URLs with tokens or personal data in the query string are not uploaded.
Examples
Encode a query value (component mode)
Input
name=Ana & Bo/1?xOutput
name%3DAna%20%26%20Bo%2F1%3FxEncode a full URL (URI mode)
Input
https://example.com/a b?q=1&r=caféOutput
https://example.com/a%20b?q=1&r=caf%C3%A9The scheme, slashes, ? and & stay as they are. The space and é are encoded.
Plus sign in component mode
Input
a+b cOutput
a%2Bb%20cA literal + becomes %2B and a space becomes %20.
Common mistakes and edge cases
- Do not encode a value twice. %20 would become %2520. Decode first if you are unsure.
- A space encodes as %20 here. HTML form submissions (application/x-www-form-urlencoded) use + for spaces, and this tool does not convert + back to a space when decoding.
- Use component mode for values and URI mode only for whole URLs. Mixing them up either breaks parameters or leaves reserved characters unencoded.
- encodeURI does not encode # or ?, so a value containing them will change the meaning of the URL.
- Decoding fails on a stray % or an invalid UTF-8 sequence, such as %E9 alone from a Latin-1 source.
- Do not encode an entire URL in component mode before using it. https:// would become https%3A%2F%2F and stop working as a link.
How to use this tool
- Paste a URL or a query value.
- Choose component or full URI encoding.
- Encode or decode, then copy the result.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI is meant for a whole URL, so it leaves reserved characters such as : / ? # & = intact and encodes the rest. encodeURIComponent is meant for a single piece of data, so it also encodes those reserved characters. Use component encoding for query values, and URI encoding only to clean up a complete URL that contains spaces or non-ASCII characters.
Should a space be %20 or +?
In a URL path, a space must be %20. In a query string produced by an HTML form (application/x-www-form-urlencoded), + also stands for a space. RFC 3986 only defines %20. This tool outputs %20, which is accepted everywhere, but it does not convert + to a space when decoding, so replace those by hand if your data uses form encoding.
How are non-English characters like é or emoji encoded?
They are converted to UTF-8 bytes and each byte is written as a percent sign and two hex digits. For example, é becomes %C3%A9. Decoding reverses the process and reads the bytes as UTF-8. If the bytes are not valid UTF-8, decoding fails with an error.
Why does decoding say the value is not a valid encoded URL?
decodeURIComponent throws an error when it meets a % that is not followed by two hex digits, or a byte sequence that is not valid UTF-8. Look for a lone % in the text, such as "50%", which should be %25. Data from older Latin-1 systems, for instance %E9, will also fail.
Is my URL sent anywhere?
No. Encoding and decoding use built-in JavaScript functions in your browser. Nothing you paste is uploaded, which matters when the URL carries tokens or ids.
References
Last reviewed