URL Encoder/Decoder
Text & Data ToolsURL Encoder / Decoder
How to Use This Calculator
How to Use the URL Encoder/Decoder
The URL Encoder/Decoder converts text to URL-safe format (percent-encoding) and back. URLs can only contain certain characters, so spaces, special characters, and non-ASCII text must be encoded for proper transmission in web addresses, API calls, and form submissions.
Encoding URLs
Paste text containing special characters and click Encode. Spaces become %20 (or + in form data), ampersands become %26, and non-ASCII characters are encoded as UTF-8 byte sequences. "Hello World!" becomes "Hello%20World%21". The encoded string is safe to use in any URL component.
Decoding URLs
Paste a percent-encoded URL and click Decode to see the human-readable version. "%E4%BD%A0%E5%A5%BD" decodes to the Chinese characters for "hello." This is useful for reading URLs copied from browser address bars, analytics tools, or server logs.
Percent-Encoding and RFC 3986
URL encoding is formally defined in RFC 3986 as percent-encoding. Each unsafe character is replaced by a percent sign (%) followed by two hexadecimal digits representing the byte value. The standard defines unreserved characters — A-Z, a-z, 0-9, hyphen (-), period (.), underscore (_), and tilde (~) — which never need encoding. Reserved characters like :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, and = have special syntactic meaning in URLs and must be encoded when used as data rather than as delimiters. For example, a query parameter value containing an ampersand must encode it as %26 to prevent it from being interpreted as a parameter separator.
Component vs. Full URL Encoding
encodeURIComponent: Encodes everything except A-Z, a-z, 0-9, and -_.~. Use this for query parameter values. It encodes characters like &, =, and / that have special meaning in URLs.
encodeURI: Encodes everything except valid URL characters including :, /, ?, #, &, and =. Use this for encoding a full URL while preserving its structure.
UTF-8 and International Characters
When encoding non-ASCII characters such as accented letters, Chinese, Arabic, or emoji, the text is first converted to its UTF-8 byte representation, and then each byte is percent-encoded individually. A single Unicode character may produce two, three, or even four percent-encoded bytes. For example, the Euro sign (€) is encoded as %E2%82%AC (three bytes). Modern browsers display internationalized domain names (IDNs) and Unicode paths in readable form in the address bar, but transmit the encoded version over the network. Always ensure your server and application expect UTF-8 encoded URLs to avoid character corruption.
Common Characters and Their Encodings
Space = %20 or +, Ampersand (&) = %26, Equals (=) = %3D, Question mark (?) = %3F, Hash (#) = %23, Slash (/) = %2F, Plus (+) = %2B, Percent (%) = %25. Knowing these common encodings helps when reading and debugging URLs manually.
Common Web Development Use Cases
URL encoding is essential in many everyday development tasks. When building API requests dynamically, query parameter values must be encoded to prevent special characters from breaking the URL structure. Redirect URLs passed as query parameters (such as ?return_url=https://example.com/path?key=value) require double encoding to preserve the inner URL's structure. When constructing mailto: links with subject lines and body text, all special characters must be encoded. Similarly, sharing URLs on social media platforms or embedding them in email templates requires encoding to handle spaces, ampersands, and other characters that might be stripped or misinterpreted by the receiving platform.
Frequently Asked Questions
Q: When should I use %20 vs + for spaces?
A: Use %20 in URL path segments and most contexts. Use + only in application/x-www-form-urlencoded data (HTML form submissions). Modern APIs typically expect %20. When in doubt, %20 is the universally safe choice.
Q: Why does my URL break when it contains special characters?
A: URLs have reserved characters with specific meanings (& separates parameters, = assigns values, # marks fragments). If your data contains these characters without encoding, the browser misinterprets the URL structure. Always encode parameter values before constructing URLs.
Q: How do I handle non-English characters in URLs?
A: Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded. The Japanese character "a" (U+3042) becomes %E3%81%82 (three UTF-8 bytes). Modern browsers display these as readable characters in the address bar while transmitting the encoded form.
Q: Should I encode the entire URL or just parts of it?
A: Only encode the parts that contain user data or special characters — typically query parameter values and path segments. Never encode the structural characters (:, /, ?, &, =, #) that separate URL components unless they appear as literal data within a value. Use encodeURIComponent for individual parameter values and encodeURI only when you need to encode a complete URL while preserving its structure.
Q: What happens if I double-encode a URL?
A: Double encoding occurs when an already-encoded string is encoded again, turning %20 into %2520 (the percent sign itself gets encoded). This causes the server to decode it back to %20 instead of a space. Always check whether your input has already been encoded before applying encoding. If a URL contains visible %XX sequences, it is likely already encoded and decoding — not encoding — is what you need.