Dev Converters
Encoding

URL Encoder / Decoder

Percent-encode or decode query strings, path segments, and form values. Handles reserved characters, spaces, and Unicode.

How it works

URLs can only contain a limited set of ASCII characters. Anything else — spaces, quotes, Unicode, reserved delimiters used out of context — has to be percent-encoded: replaced by a `%` followed by two hex digits per UTF-8 byte. This matters any time you build a URL from user input, a database query, or a piece of configuration.

JavaScript offers two built-ins: `encodeURI` (leaves structural characters like `/`, `?`, and `#` unencoded, suitable for a whole URL) and `encodeURIComponent` (stricter, used for individual query parameters or path segments). This tool uses `encodeURIComponent` because that is the safer default when you are not sure whether your input contains literal delimiters.

Things to watch for: the old `+` = space convention is only valid inside `application/x-www-form-urlencoded` form bodies, not in paths. Always pick one or the other and be consistent. Decoding malformed input (e.g., a lone `%` without two hex digits) throws — the tool surfaces the error instead of silently mangling the string.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?
encodeURI leaves reserved characters like / ? # alone, while encodeURIComponent encodes everything. This tool uses encodeURIComponent (stricter) by default.
How do I decode only — not encode?
Prefix the input with `decode:` in the playground, or use the mode toggle on the page.
Does this handle + vs %20 correctly?
Yes. Query strings historically use + for space; this encoder uses %20 which is valid everywhere. The decoder accepts both.

Related tools