What is URL encoding?
URL encoding (also called percent-encoding) is a mechanism for encoding information in a Uniform Resource Identifier (URI). It replaces characters that are not allowed or have special meaning in a URL with a percent sign (%) followed by two hexadecimal digits. For example, a space becomes %20, and an ampersand becomes %26.
Why encode URLs?
URLs can only contain a limited set of characters from the ASCII character set. Characters outside this set, or characters that have special meaning in URLs (such as &, =, ?, and #), must be encoded before they can appear in a URL. This is especially important when passing user-supplied data as query string parameters, where unencoded special characters could break the URL structure or be misinterpreted by the server.
Common characters that need encoding
Characters like spaces, quotes, angle brackets, curly braces, pipes, backslashes, and non-ASCII characters (such as accented letters or emoji) all require percent-encoding in URLs. This tool uses encodeURIComponent(), which encodes all characters except A–Z a–z 0–9 - _ . ! ~ * ' ( ) — making it ideal for encoding individual query parameter values.
Use cases
URL encoding is needed when building query strings programmatically, constructing redirect URLs, embedding links in HTML attributes, working with form submissions, and testing API endpoints that accept URL parameters. Decoding is useful when you receive an encoded URL and want to inspect its readable components.