How to use the url encoder / decoder
- Paste a URL, a query string or arbitrary text.
- Leave the full-URL option on to keep :/?&=# intact, or turn it off to encode everything.
- Click Encode or Decode — multi-line input processes line by line.
- Copy the result.
URLs are limited to a small set of ASCII characters. Anything outside it — a space, a Chinese character, an emoji, an ampersand inside a parameter value — has to be percent-encoded: written as % followed by the UTF-8 bytes in hex. Spaces become %20, and a space inside a query string is often written +.
Two functions do this job and choosing the wrong one is the classic bug. encodeURI preserves the characters that structure a URL — :/?&=# — so it is right for encoding a whole address. encodeURIComponent encodes those too, which is what you need for a single parameter value, otherwise & inside a value would split it into a new parameter.
What people get wrong
- Encoding a value with
encodeURIand then callingdecodeURIComponenton it — the pair does not round-trip. - Encoding twice:
%20becomes%2520because the percent sign itself is encoded. - Sending a raw
+where a space was meant: only form-encoded bodies treat+as a space, not URL paths. - Assuming ASCII-only text needs no encoding because it "looks fine" — but non-ASCII gets mangled the moment it crosses a header or a log line.
Decoding is lenient here: malformed percent sequences fall back to the untouched text instead of throwing, so a half-encoded string still yields something usable.
Frequently asked questions
Should I use encodeURI or encodeURIComponent?
Whole URLs: encodeURI. Individual parameter values: encodeURIComponent. The checkbox switches between them.
Why did my string become %25 something?
It was already encoded and got encoded again. Decode once, then re-encode.
Does it handle Chinese and emoji?
Yes — input is converted to UTF-8 bytes before encoding, so multi-byte characters come out as the correct percent sequences.
Is the plus sign a space?
Only in application/x-www-form-urlencoded bodies. In a URL path or query value, + is a literal plus unless the server chooses to read it as a space.