Encode or decode URLs and URL components instantly in your browser. Supports three encoding modes — all processing is local, no data is sent anywhere.
Encodes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use this for query string values and path segments.
| Character | Encoded as | Component mode | Full URL mode |
|---|---|---|---|
| Space | %20 (or + in form mode) | Encoded | Encoded |
| ! | - | Safe (kept) | Safe (kept) |
| # | %23 | Encoded | Safe (kept) |
| $ | %24 | Encoded | Safe (kept) |
| & | %26 | Encoded | Safe (kept) |
| = | %3D | Encoded | Safe (kept) |
| ? | %3F | Encoded | Safe (kept) |
| / | %2F | Encoded | Safe (kept) |
| : | %3A | Encoded | Safe (kept) |
| @ | %40 | Encoded | Safe (kept) |
| + | %2B | Encoded | Encoded |
| Non-ASCII (e.g. 中文) | %E4%B8%AD... | Encoded (UTF-8) | Encoded (UTF-8) |
/, ?, =, and #; Form Encoding replaces spaces with + for HTML form submissions.URL encoding — officially called percent encoding — is a mechanism for representing arbitrary data in a URI (Uniform Resource Identifier). URLs can only contain a limited set of ASCII characters. Characters outside this safe set must be encoded as a percent sign followed by two hexadecimal digits representing the character’s byte value in UTF-8.
For example, a space (ASCII 0x20) becomes %20, and the ampersand & (which is a reserved query-string delimiter) becomes %26. Without encoding, an ampersand in a query value would be misinterpreted as a parameter separator, silently breaking the URL.
The two main JavaScript functions for URL encoding serve different purposes:
encodeURIComponent() — Encodes everything except letters, digits, and - _ . ! ~ * ' ( ). Use this for individual query parameter values or path segments that should not contain structural URL characters.encodeURI() — Preserves characters that are valid in a complete URL (/ : ? = & # @). Use this to encode a complete URL when you only want to clean up non-ASCII characters.application/x-www-form-urlencoded) — Similar to URI component encoding but replaces spaces with + instead of %20. This is what browsers use when submitting HTML forms via GET or POST.%20 is the standard percent-encoding for a space and is valid in any part of a URL. The + notation for spaces only applies in the application/x-www-form-urlencoded format used by HTML forms — it is not valid in URL paths or most API contexts. When building query strings for REST APIs, always use %20 or encodeURIComponent(). The + shorthand is only safe when the receiving server explicitly decodes it as a space, which is guaranteed for HTML form submissions but not for general URLs.
Use encodeURIComponent() for encoding individual values that will be placed inside a URL — for example, the value of a query parameter like ?q=hello+world&name=John Doe. Each value should be encoded separately before concatenating. Use encodeURI() only when you have a complete URL with structural characters already in place and you only want to sanitise non-ASCII characters. A common mistake is using encodeURI() on a query value: it will not encode &, =, or ?, which will break the URL structure.
Double-encoding occurs when an already-encoded string (hello%20world) is encoded again, producing hello%2520world — the % itself gets encoded to %25. This usually happens when encoding is applied multiple times in a processing pipeline. To avoid it, always decode before encoding, or check whether the string is already encoded by looking for %XX patterns. The Decode button in this tool will reverse one layer of encoding; apply it again if you suspect multiple layers.
Characters outside the ASCII range (like accented letters, CJK characters, or emoji) are first converted to their UTF-8 byte representation, and each byte is then percent-encoded separately. For example, the Chinese character 中 has the UTF-8 bytes E4 B8 AD, so it encodes as %E4%B8%AD. Three percent-encoded values for one character is normal for Unicode content. Servers and browsers that understand UTF-8 will correctly decode this back to the original character.