What Is URL Encoding (Percent-Encoding)?
Uniform Resource Identifiers (URIs) are constrained by the RFC 3986 standard to a restricted subset of the US-ASCII character set. Characters that carry syntactic meaning in URLs (such as ?, &, =, /, and #) or characters outside the printable ASCII range (such as spaces and non-Latin alphabets) cannot be transmitted literally inside query parameters.
URL encoding replaces unsafe or reserved characters with a % followed by their two-digit hexadecimal representation (for instance, a space becomes %20, and an ampersand becomes %26).
Component Encoding vs. Full URL Encoding
- encodeURIComponent: Used to encode individual parameter values. It encodes delimiters like
&,=, and/so they do not inadvertently split URL query strings. - encodeURI: Used when encoding a complete URL without escaping structural protocol and domain separators (like
https://or?).
This tool performs strict component encoding and decoding, ideal for preparing search queries, tracking parameters, and OAuth redirect URIs.
Common URL Encoding Pitfalls
- Double Encoding: Encoding an already encoded string results in corrupt sequences like
%2520(where the%itself was re-encoded). - Plus Signs (+) vs. %20: In application/x-www-form-urlencoded form data, spaces are frequently represented as
+. In standard URI paths,%20should be strictly preferred. - Truncated Sequences: Incomplete percent sequences (e.g.
hello%2) will trigger URI decode exceptions.