URL Encoder / Decoder
Percent-encode and decode URL query values or full URIs with UTF-8 support and safe error handling.
URI Component vs. Full URI Encoding
RFC 3986 percent-encoding replaces unsafe and reserved characters in URLs with a % sign followed by two hexadecimal digits representing each UTF-8 byte. Choosing the right encoding mode prevents broken query strings and double-encoded redirect URLs.
URI Component Mode (encodeURIComponent)
Encodes reserved URI delimiters including : / ? & = + #. Use this mode whenever you are encoding an individual query parameter key or value (for example, passing a callback URL inside ?redirect_uri=...).
Full URI Mode (encodeURI)
Preserves structural URL delimiters (https://, /, ?, &, =) while percent-encoding spaces and non-ASCII UTF-8 characters.
Form-Urlencoded Plus (+) Handling
HTML forms (application/x-www-form-urlencoded) encode spaces as + instead of %20. Keep Decode + as space checked to decode query strings from web forms accurately.
Frequently Asked Questions
What is the difference between %20 and + for spaces in URLs?
In RFC 3986 URI path segments, spaces must be encoded as %20 (and + is treated as a literal plus sign). In application/x-www-form-urlencoded query strings, spaces are historically encoded as + and literal plus signs must be encoded as %2B.
Why did decoding throw a malformed URI sequence error?
decodeURIComponent() throws a URIError if a string contains a bare % character not followed by two valid hex digits (such as 100%) or an incomplete UTF-8 byte sequence.