URL Encoder / Decoder
Safely encode or decode URL components and query strings.
What is URL encoding?
URL encoding (also called percent encoding) converts characters that are not allowed or have special meaning in a URL into a safe representation. Each unsafe character is replaced by a percent sign (%) followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, an ampersand becomes %26, and an emoji like 🚀 becomes %F0%9F%9A%80.
URLs can only contain a limited set of characters defined by RFC 3986: letters, digits, hyphen, period, underscore, and tilde are "unreserved" and do not need encoding. Characters like / ? # [ ] @ ! $ & ' ( ) * + , ; = are "reserved" and have special meaning in URL structure. Any other character — including spaces, non-ASCII characters, and many punctuation marks — must be encoded.
JavaScript provides two functions: encodeURIComponent() encodes everything except unreserved characters (use for encoding a query string value), and encodeURI() encodes everything except unreserved characters and the reserved characters (use for encoding a complete URL that already has valid structure). This tool supports both modes.
Common mistakes
- Double-encoding — Encoding a string that is already encoded produces double-encoded output (e.g.
%2520instead of%20). Always decode first if you're unsure. - Using encodeURI for query values —
encodeURI()does not encode&,=, and+, which are separators in query strings. UseencodeURIComponent()for individual parameter values.