Component mode escapes every reserved character (&, =, ?, /, spaces…) — use this for a single query value.
Encode or decode full URLs or individual URL components.
Component mode escapes every reserved character (&, =, ?, /, spaces…) — use this for a single query value.
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.