URL Encoder/Decoder
Encode and decode URL strings
URL Encoded
Enter input above
Common URL Encodings
SP
%20
!
%21
#
%23
$
%24
%
%25
&
%26
'
%27
(
%28
)
%29
+
%2B
/
%2F
?
%3F
What Is URL Encoding?
URL encoding (also called percent-encoding) is the process of converting characters into a format that can be safely transmitted over the internet in URLs. Since URLs can only contain a limited set of characters — specifically unreserved characters (A-Z, a-z, 0-9, hyphen, underscore, period, and tilde) — any other character, including spaces, punctuation, and non-ASCII text, must be replaced with a percent sign (%) followed by its two-digit hexadecimal ASCII code. So a space becomes %20, an exclamation mark becomes %21, and the & symbol becomes %26.
Without URL encoding, special characters in URLs would be misinterpreted. A space would break the URL, a question mark would signal the start of query parameters, and an ampersand would separate parameters when it was intended as literal text. URL encoding ensures that every character arrives at the server exactly as you intended it, which is essential for form submissions, REST API calls, and any link containing special characters, emojis, or non-English text.
This converter handles both encoding and decoding, using the standard JavaScript encodeURIComponent (for full URL component encoding including query string values) and encodeURI (for encoding entire URLs while preserving structure like slashes and query delimiters).
How URL Encoding Works
URL encoding replaces each disallowed character with a percent sign followed by its two-digit hexadecimal byte value in UTF-8. For ASCII characters, the hex byte matches the ASCII code point. For non-ASCII characters like emojis or Chinese text, the UTF-8 byte sequence is encoded as multiple percent-hex groups.
| Character | Encoded | Note |
|---|---|---|
| Space | %20 | Most common encoding |
| & | %26 | Prevents being treated as query separator |
| # | %23 | Prevents being treated as fragment identifier |
| ? | %3F | Prevents starting a query string |
This converter provides two encoding levels: encodeURIComponent encodes everything including slashes, making it suitable for individual query parameter values and form data, while encodeURI preserves URL structure (colons, slashes, question marks) and is suitable for encoding complete URLs that already have a valid structure.
URL Encoding
Where:
- text= The original text containing special characters, spaces, or non-ASCII symbols
- encoded= Percent-encoded string safe for transmission in URLs
encodeURI vs. encodeURIComponent — Which to Use
JavaScript provides two encoding functions, and choosing the wrong one is a common source of bugs. encodeURIComponent is the safer choice for most purposes — it encodes every character that is not a letter, digit, or one of the safe characters (-_.!~*'()). This means slashes, colons, question marks, ampersands, and equals signs are all converted to their percent-encoded forms. Use encodeURIComponent when encoding individual values in a query string, form fields in a POST request body, or path segments that may contain special characters.
encodeURI is more conservative — it preserves the characters that have syntactic meaning in a complete URL: colon (:), forward slash (/), question mark (?), ampersand (&), equals sign (=), and hash (#). Use encodeURI only when you have a full URL that may contain non-ASCII characters in the path or query string but whose structure is already valid. Encoding individual parameters with encodeURI can leave special characters unencoded, leading to broken URLs. This converter shows both results, letting you see the difference and choose the right encoding for your use case.
How to Use the URL Encoder and Decoder
The converter operates in two modes selectable from the top buttons:
- Encode mode: Enter any text — a search query, form value, filename with spaces, or string containing emojis or international characters. The converter produces the percent-encoded version suitable for URL query strings, plus a variant using encodeURI for full URLs. Click the Copy button to copy the result to your clipboard.
- Decode mode: Paste a percent-encoded string like "Hello%20World%21" and the converter restores the original text. This is useful for reading encoded URLs from server logs, debugging API responses, or understanding what raw data a form submission contains.
The common encodings reference grid at the bottom shows 12 frequently encountered percent-encoded characters with their raw symbols for quick lookup without typing.
When Do You Need URL Encoding?
URL encoding is essential in several common scenarios. When submitting HTML forms using the GET method, the browser automatically URL-encodes the form field values before appending them to the URL as query parameters. When building REST API URLs programmatically, you must manually encode query parameter values — forgetting to encode a value like "John & Jane" results in "John%20%26%20Jane" on the properly encoded request.
When constructing URLs that contain user-generated content — search terms, usernames, filenames, or free-text descriptions — URL encoding prevents injection attacks and malformed requests. Spaces, quotes, angle brackets, and non-ASCII characters in user input must all be encoded before the URL is sent. When working with redirect URLs in OAuth flows, the redirect URI itself must be URL-encoded when passed as a query parameter, resulting in double-encoding that this converter can help you debug.
For international text and emojis in URLs, encoding is mandatory. The emoji 😊 (U+1F60A) encodes to %F0%9F%98%8A — four hex bytes representing the UTF-8 encoding of the code point. Modern browsers display the decoded emoji in the address bar, but the actual HTTP request contains the percent-encoded form, and this converter lets you see both representations side by side.
Worked Examples
Encoding a Search Query for a URL
Problem:
You need to build a URL for searching 'cats & dogs' on a website. Encode the query string value.
Solution Steps:
- 1Enter 'cats & dogs' in Encode mode
- 2encodeURIComponent converts space to %20 and & to %26
- 3Result: cats%20%26%20dogs
- 4Full URL: https://example.com/search?q=cats%20%26%20dogs
Result:
cats%20%26%20dogs. Without encoding, the & would split the URL into a new query parameter instead of being treated as part of the search text.
Decoding a URL from Server Logs
Problem:
Your server logs show a request to /api/data?name=Jos%C3%A9. What is the original name?
Solution Steps:
- 1Switch to Decode mode
- 2Paste Jos%C3%A9
- 3The converter decodes %C3%A9 as the UTF-8 byte sequence for é
- 4Result: José
Result:
José. The character é in UTF-8 is encoded as the two-byte sequence C3 A9, which in URL encoding becomes %C3%A9. Non-ASCII characters always use multi-byte percent encoding.
Encoding an Emoji for a URL
Problem:
You want to include the 🎉 emoji in a shareable URL. Encode it.
Solution Steps:
- 1Enter 🎉 in Encode mode
- 2The converter produces the UTF-8 percent encoding
- 3Result: %F0%9F%8E%89
- 4The emoji U+1F389 encodes to 4 bytes in UTF-8
Result:
🎉 = %F0%9F%8E%89. Emojis take 4 bytes in UTF-8 encoding, resulting in 4 percent-hex groups when URL-encoded.
Tips & Best Practices
- ✓Always use encodeURIComponent for individual query parameter values — it is the safest default for URL encoding.
- ✓The Copy button next to the output lets you grab the encoded or decoded result in one click for pasting into code or a browser.
- ✓Space becomes %20 with encodeURIComponent but + with form encoding — this converter uses %20 for maximum compatibility.
- ✓Encoding the same string twice (double encoding) creates strings like %2520 (the %25 is the encoded % sign itself).
- ✓The common encodings grid shows 12 frequently used percent-encoded characters — use it as a quick reference without typing.
- ✓Emojis and non-Latin text always encode to multiple % groups — each UTF-8 byte becomes one %XX pair.
- ✓When debugging broken URLs, paste the encoded portion into Decode mode to see the original text that was submitted.
- ✓For OAuth and redirect URLs, the redirect URI itself must be encoded when passed as a query parameter value.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-06
Help us improve!
How would you rate the URL Encoder/Decoder?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: NIST Guide to SI Units
by National Institute of Standards