URL Percent-encoding, encode and decode, with support for any text and special characters
URL encoding (also called Percent-encoding) is a mechanism that converts special characters in a URL into a % followed by two hexadecimal digits. Per RFC 3986, a URL may only contain a subset of ASCII characters; other characters (such as Chinese, spaces, and special symbols) must be encoded.
In JavaScript, encodeURIComponent() encodes URL query parameters — it encodes every character except A-Z a-z 0-9 - _ . ! ~ * ' ( ). encodeURI() preserves URL structural characters (such as : / ? # & =).
Common URL encoding scenarios include: AJAX request parameter encoding, handling Chinese in URL paths, and parameter encoding in OAuth signatures.
Input: Hello, World! → Output: Hello%2C%20World!
encodeURI does not encode URL structural characters (:/?#&=+@$), so it is suitable for encoding a full URL; encodeURIComponent encodes more characters and is suitable for encoding query parameter values. This tool uses encodeURIComponent.encodeURIComponent encodes a space as %20. In the application/x-www-form-urlencoded format (such as form submission), spaces are encoded as +. Both are valid.%XX format, including ASCII letters and digits. It is useful in special cases, such as when you need to fully hide the URL content.