URL Encoder & Decoder
Encode or decode URLs and query parameters instantly. Supports full Unicode characters.
What Is URL Encoding?
URL encoding, formally known as percent-encoding, is the standard mechanism for representing special characters in Uniform Resource Identifiers (URIs). The URI specification (RFC 3986) defines a limited set of characters that are safe to use in URLs: unreserved characters (A-Z, a-z, 0-9, and the symbols - _ . ~) and reserved characters that have specific syntactic meaning (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Any character outside this set must be percent-encoded before being included in a URL.
Percent-encoding replaces each unsafe byte with a percent sign (%) followed by two uppercase hexadecimal digits representing the byte's value. For example, a space character (ASCII 0x20) becomes %20, an ampersand (ASCII 0x26) becomes %26, and a Japanese character like あ (encoded as three UTF-8 bytes) becomes %E3%81%82. This encoding ensures that URLs remain valid ASCII strings regardless of what data they carry.
URL encoding is essential for the correct functioning of the web. Without it, a space in a search query would break the URL structure, a literal ampersand in a parameter value would be misinterpreted as a parameter separator, and non-ASCII characters would be rejected by many servers and proxies. Every web browser performs URL encoding automatically when you submit a form or click a link, but developers frequently need to encode and decode strings manually when building APIs, constructing query strings, or debugging HTTP requests.
How URL Encoding and Decoding Work
This tool uses JavaScript's built-in encodeURIComponent() function for encoding and decodeURIComponent() for decoding. encodeURIComponentencodes all characters except A-Z, a-z, 0-9, and the four symbols - _ . ~. It also encodes reserved characters like / ? # & =, which makes it safe for encoding individual query parameter values and path segments.
This is different from encodeURI(), which is designed to encode a complete URI and deliberately preserves reserved characters that have structural meaning in a URL. If you used encodeURI on a parameter value containing an ampersand, the ampersand would not be encoded and would be misinterpreted as a parameter separator. For this reason, encodeURIComponent is almost always the correct choice when encoding individual values.
The decoding process reverses the encoding: each %XX sequence is replaced with the character it represents. Multi-byte UTF-8 characters are reconstructed from their constituent encoded bytes. If the input contains an invalid percent-encoded sequence (e.g., %ZZ or a truncated sequence like %2), the decoder throws an error, which this tool catches and displays as a user-friendly error message.
Common Use Cases
- Building API query strings — When constructing URLs for REST API calls, parameter values that contain special characters (spaces, slashes, Unicode) must be encoded to prevent breaking the URL structure.
- Debugging HTTP requests — When inspecting network traffic in browser DevTools or log files, encoded URLs can be difficult to read. Decoding them reveals the actual parameter values for easier debugging.
- Form data handling — HTML forms submit data in
application/x-www-form-urlencodedformat, where spaces become + signs and special characters are percent-encoded. Understanding this encoding is essential for backend developers processing form submissions. - Redirect URL parameters — OAuth flows, SSO systems, and payment gateways frequently pass redirect URLs as query parameters. The redirect URL itself must be encoded so its internal slashes, question marks, and ampersands do not conflict with the outer URL structure.
- Internationalized content — URLs containing non-ASCII characters (Chinese, Korean, Japanese, Arabic, Cyrillic, etc.) must be percent-encoded for transmission. This tool correctly handles full Unicode input through UTF-8 encoding.
- Deep linking in mobile apps — Mobile deep links often carry encoded parameters. Decoding them helps verify that the correct data is being passed to the app.
- Email and messaging links — When embedding links in emails, SMS, or chat messages, special characters in URLs can cause link parsers to truncate the URL prematurely. Pre-encoding ensures the full URL is clickable.
- Web scraping and crawling — Scrapers need to encode query parameters correctly when constructing request URLs and decode response URLs to extract meaningful data.
Tips and Best Practices
- Encode values, not entire URLs. If you encode a full URL including the protocol and path separators, the slashes and colons will be encoded too, making the URL invalid. Use
encodeURIComponentonly on individual parameter values or path segments. - Do not double-encode. Encoding an already-encoded string turns
%20into%2520. Always check whether your input is already encoded before applying encoding again. - Know the difference between + and %20. In
application/x-www-form-urlencodedformat (used by HTML forms), spaces are represented as +. In standard percent-encoding (used in URL paths and most APIs), spaces are%20.encodeURIComponentproduces%20. - Handle Unicode carefully.
encodeURIComponentfirst converts the string to UTF-8 bytes, then percent-encodes each byte. A single emoji or CJK character may produce six or more percent-encoded bytes. This is correct behavior, not an error. - Test with edge cases. Characters like single quotes, parentheses, and exclamation marks are technically allowed in URLs but can cause issues in certain contexts (HTML attributes, JavaScript strings, email parsers). When in doubt, encode them.
URL Encoder vs Alternatives
Programming languages provide built-in URL encoding functions: Python has urllib.parse.quote(), PHP has urlencode(), Java has URLEncoder.encode(), and Go has url.QueryEscape(). These are the right choice when encoding is part of your application logic. Command-line users can use python3 -c "import urllib.parse; print(urllib.parse.quote('...'))" or install tools like jq with @uri format.
A web-based encoder like this one is the fastest option when you need a quick, one-off conversion without opening a terminal or writing code. It is especially useful for non-developers who need to encode a URL for a marketing campaign, email template, or CMS configuration. No installation required, works on any device, and supports full Unicode input and output.