URL Encoder / Decoder
URL-encode and decode text live in both directions. Choose encodeURIComponent for values or encodeURI for full URLs. Free and private.
About the URL Encoder / Decoder
This URL encoder and decoder converts text to percent-encoding and back, live, as you type in either box. Spaces become %20, ampersands become %26 and non-ASCII characters are encoded as UTF-8 byte sequences — exactly what browsers and servers expect in query strings and paths.
A mode switch lets you pick the right function for the job. encodeURIComponent (the default) escapes everything including / ? & = and is what you need for individual query-string values. encodeURI keeps URL structure characters intact, so you can safely encode a complete URL without breaking its scheme, path or parameters.
Decoding works the other way and reports a clear error if the input contains a malformed percent-escape. Everything runs in your browser, so pasted URLs with tokens or session IDs never leave your machine.
How to Use the URL Encoder / Decoder
- 1Choose encodeURIComponent (for values) or encodeURI (for full URLs).
- 2Type or paste text in the decoded box to encode it live.
- 3Or paste an encoded string in the encoded box to decode it.
- 4Copy either side with the copy buttons.
Frequently Asked Questions
When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent when encoding a single value that goes inside a URL — a search query, a redirect target, an email address in a parameter. It escapes every reserved character including &, = and /. Use encodeURI only when you have a complete URL and want to escape illegal characters (like spaces) while keeping the structure — ://, ?, & and = — intact.
Why do spaces become %20 and not a plus sign?
Both are correct in different contexts. %20 is the standard percent-encoding for a space anywhere in a URL, and it is what encodeURIComponent produces. The + convention only applies to the application/x-www-form-urlencoded format used by HTML form submissions. If a server shows + for spaces, it is using form encoding; %20 is always safe.
How are non-English characters like é or 中 encoded?
They are first converted to UTF-8 bytes, then each byte is percent-encoded. é becomes %C3%A9 (two bytes) and 中 becomes %E4%B8%AD (three bytes). Decoding reverses this automatically, which is why one visible character can turn into several %XX groups.
Why does decoding sometimes fail with an error?
Decoding fails when the input contains a percent sign that isn't followed by two valid hexadecimal digits — for example a lone % or %ZZ. This usually means the string was truncated, double-encoded then partially edited, or was never URL-encoded in the first place. Fix or remove the malformed escape and decoding will work.