URL Encoder/Decoder
Encode or decode URLs and query strings for safe transmission. Supports encodeURIComponent and encodeURI modes.
About URL Encoder/Decoder
URL encoding, also known as percent encoding, is a mechanism for converting characters into a format that can be safely transmitted within a URL. URLs can only contain a limited set of characters from the ASCII character set. Characters outside this set, as well as certain reserved characters that have special meaning in URLs, must be replaced with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space character becomes %20, and an ampersand (&) becomes %26.
URL encoding is essential for web development, API integrations, and data transmission. When you submit form data, pass query parameters, or build URLs programmatically, special characters in the data could break the URL structure or be misinterpreted by servers. Encoding ensures data integrity during transmission by converting these problematic characters into safe representations. This tool performs all encoding and decoding entirely in your browser -- no data is sent to any server, ensuring complete privacy.
encodeURI vs encodeURIComponent
JavaScript provides two built-in functions for URL encoding, and choosing the right one matters:
encodeURIComponent encodes almost every special character, including : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use it when encoding individual values such as query parameter values, form fields, or any segment of a URL that might contain special characters. For example, encoding hello world&foo=bar produces hello%20world%26foo%3Dbar.
encodeURI encodes special characters but preserves characters that are part of valid URL syntax, such as : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use it when you have a complete URL and want to encode only truly invalid characters like spaces and non-ASCII characters while keeping the URL structure intact. For example, encoding https://example.com/path name?q=hello world preserves the protocol, slashes, and question mark while encoding the spaces.
Common Characters That Need Encoding
| Character | Encoded | Description |
|---|---|---|
| (space) | %20 | Space character |
| ! | %21 | Exclamation mark |
| # | %23 | Hash / Fragment identifier |
| $ | %24 | Dollar sign |
| & | %26 | Ampersand / Parameter separator |
| + | %2B | Plus sign |
| , | %2C | Comma |
| / | %2F | Forward slash |
| : | %3A | Colon |
| = | %3D | Equals sign |
| ? | %3F | Question mark |
| @ | %40 | At sign |
FAQ
Q: When should I use URL encoding?
A: You should use URL encoding whenever you include user-generated content, special characters, or non-ASCII characters in a URL. This includes building query strings, embedding data in links, sending form data via GET requests, and constructing API calls. If a value might contain characters like spaces, ampersands, question marks, or Unicode characters, it needs to be encoded to prevent the URL from breaking.
Q: What is the difference between %20 and + for spaces?
A: Both represent a space character, but they are used in different contexts. %20 is the standard percent-encoded form used in URLs as defined by RFC 3986. The + sign is an older convention used specifically in application/x-www-form-urlencoded format, commonly seen in HTML form submissions. JavaScript's encodeURIComponent produces %20 for spaces. Most modern APIs and servers accept both, but %20 is the more universally correct encoding for general URL use.
Q: Is my data safe when using this tool?
A: Yes, completely. This tool runs entirely in your browser using JavaScript. No data is transmitted to any server. Your input text and the encoded or decoded output never leave your device. You can verify this by using the tool with your browser's network tab open -- you will see no outgoing requests.
Q: Can I encode non-English characters and emoji?
A: Yes. Both encodeURI and encodeURIComponent handle Unicode characters by first converting them to their UTF-8 byte sequences, then percent-encoding each byte. For example, the character "e" with an accent becomes %C3%A9, and emoji characters are encoded into their multi-byte UTF-8 representations. This tool fully supports all Unicode characters, including CJK characters, Arabic, Cyrillic, and emoji.
Q: Why does my decoded URL show strange characters?
A: This usually happens when the encoded text was generated using a different character encoding, such as ISO-8859-1 instead of UTF-8. Modern systems overwhelmingly use UTF-8, but legacy systems may have encoded data differently. If you encounter garbled output, the original encoding may have used a non-UTF-8 character set that JavaScript's built-in decode functions cannot interpret correctly. In such cases, you may need a specialized tool that supports the specific encoding used.