URL Encoder/Decoder

Encode or decode full URLs or individual URL components.

Component mode escapes every reserved character (&, =, ?, /, spaces…) — use this for a single query value.

Advertisement

About URL Encoder/Decoder

Percent-encode or decode a full URL or a single component such as a query value, with clear separation between the two so you don't accidentally double-encode a path. Malformed percent-encoding on decode is caught and reported instead of throwing an unhandled error.

URL encoding has two subtly different jobs, which is why this tool has two modes instead of one. Component mode (backed by encodeURIComponent) escapes every character that could be confused with URL syntax — including &, =, ?, and spaces — which is what you want when encoding a single query parameter value that might itself contain those characters.

Full URL mode (backed by encodeURI) assumes you're handing it an entire, already-structured URL, so it deliberately leaves the structural characters (:, /, ?, &, #) alone and only escapes things that are never valid in a URL at all, like raw spaces or non-ASCII characters. Running a full URL through component-mode encoding by mistake is a classic bug — it turns https://example.com/path into a mangled, double-escaped mess.

Decoding runs through the same distinction in reverse and catches malformed percent-encoding — a stray % not followed by two hex digits, or a truncated multibyte UTF-8 sequence — reporting it clearly instead of throwing a raw URIError.

Frequently asked questions

Which mode should I use for a query string parameter?
Use Component mode. It's designed for encoding a single value that will be placed inside a URL (like a search term or a redirect target), and it escapes characters such as &, =, and spaces that would otherwise break the URL's structure.
Why did decoding fail on my input?
Percent-encoding requires a % followed by exactly two hexadecimal digits representing one byte, and multibyte UTF-8 characters need all of their encoded bytes present. If any % is followed by something else, or a multibyte sequence is cut short, decoding fails — the tool reports this instead of guessing at a corrupted result.
What's the difference between encodeURI and encodeURIComponent under the hood?
encodeURI (Full URL mode) leaves the URL-reserved characters : / ? # [ ] @ ! $ & ' ( ) * + , ; = untouched because they're meaningful in a full URL. encodeURIComponent (Component mode) escapes all of them, because a component value should never introduce new URL structure.