// encode special characters in urls · decode percent-encoded strings · parse url components · nothing leaves your browser
A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use for encoding individual query parameter values.
URL encoding (also called percent-encoding) converts characters that aren't allowed in URLs into a safe format. Each character is replaced with a % followed by its two-digit hexadecimal ASCII code — for example, a space becomes %20.
This is essential when passing special characters like &, =, ?, or non-ASCII text (like Arabic or Chinese characters) in query strings or path segments.
encodeURIComponent for query values, encodeURI for full URLsURLs can only contain a limited set of characters defined by the URI specification (RFC 3986). Characters outside this set — including spaces, international characters, and many punctuation marks — must be percent-encoded before they can appear in a URL. Percent-encoding replaces each unsafe byte with a percent sign followed by two hexadecimal digits representing the byte value.
For example, a space becomes %20, an ampersand becomes %26, and the equals sign becomes %3D. Non-ASCII characters like Arabic, Chinese, or accented Latin letters are first encoded as UTF-8 bytes, then each byte is percent-encoded — which is why a single character like é becomes %C3%A9 (two bytes in UTF-8).
URL encoding is essential when building query strings, constructing API requests programmatically, handling form submissions, and working with any user-generated content that might contain special characters. Failure to encode URLs properly is one of the most common sources of bugs in web applications.
encodeURIComponent is for encoding individual query parameter values. It encodes everything except letters, digits, and the characters - _ . ! ~ * ' ( ). Use this when encoding the value part of a key=value pair in a query string.
encodeURI is for encoding a complete URL. It leaves characters that have structural meaning in URLs untouched: / ? # & = : @ !. Use this when you have a full URL that might contain Unicode characters but its structural components are already correct.
encodeURI is for encoding a complete URL — it leaves characters like /, ?, #, and & alone because they have structural meaning in a URL. encodeURIComponent encodes everything except letters, digits, and - _ . ! ~ * ' ( ) — use it for individual query parameter values.%20. In HTML form data (application/x-www-form-urlencoded), spaces are encoded as +. Both are valid in their respective contexts — this tool supports both via the encoding type selector.%XX sequence. For example, é is encoded as %C3%A9 because it's two bytes in UTF-8.A–Z, a–z), digits (0–9), and the symbols - _ . ~. Everything else should be percent-encoded depending on context.encodeURIComponent, then join them with & and append to the base URL. Don't encode the full URL at once — that would encode the ? and = separators, breaking the URL structure.