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%20Most common encoding
&%26Prevents being treated as query separator
#%23Prevents being treated as fragment identifier
?%3FPrevents 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

encoded = encodeURIComponent(text)

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:

  1. 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.
  2. 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:

  1. 1Enter 'cats & dogs' in Encode mode
  2. 2encodeURIComponent converts space to %20 and & to %26
  3. 3Result: cats%20%26%20dogs
  4. 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:

  1. 1Switch to Decode mode
  2. 2Paste Jos%C3%A9
  3. 3The converter decodes %C3%A9 as the UTF-8 byte sequence for é
  4. 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:

  1. 1Enter 🎉 in Encode mode
  2. 2The converter produces the UTF-8 percent encoding
  3. 3Result: %F0%9F%8E%89
  4. 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

encodeURIComponent encodes all characters except letters, digits, and -_.!~*'(), including slashes, colons, and question marks. It is the correct choice for encoding individual query parameter values. encodeURI is less aggressive — it preserves characters that have structural meaning in a complete URL (://, /, ?, &, =, #). Use encodeURI only for full URLs that are structurally valid but contain non-ASCII characters. This converter shows both outputs so you can see the difference.
The plus sign (+) is an alternative encoding for spaces in the application/x-www-form-urlencoded format, which is the default encoding for HTML form submissions. In the query string of a URL, spaces can be represented as either %20 or +, and both are valid. Most modern web frameworks accept both. However, in the path portion of a URL (before the ?), only %20 is valid — a + in the path remains a literal plus sign. The encodeURIComponent function uses %20, not +.
Non-ASCII characters are first encoded into UTF-8 bytes, then each byte is represented as %XX where XX is the hexadecimal value of the byte. For example, the character é (U+00E9) encodes to the UTF-8 bytes C3 A9, yielding %C3%A9. Emojis use 4 UTF-8 bytes: the fire emoji 🔥 (U+1F525) becomes %F0%9F%94%A5. This converter handles all Unicode characters correctly using JavaScript's native UTF-8 encoding.
Encoding a complete URL requires care — if you use encodeURIComponent on a full URL like 'https://example.com/page?q=hello', the slashes and colons will be encoded, breaking the URL structure. Use encodeURI for complete URLs to preserve the structure while encoding only the non-ASCII portions. For encoding individual parts (hostname, path segments, query values), encode each part separately with the appropriate function. This converter shows both encoding levels to help you decide.
No. The hexadecimal digits in percent-encoding (A-F) are case-insensitive. Both %2F and %2f represent the forward slash (/). Most encoders use uppercase letters for consistency, which is what this converter does. However, when comparing or decoding URL strings, treat uppercase and lowercase hex digits as equivalent.
The unreserved characters that are always safe in URLs are: uppercase letters A-Z, lowercase letters a-z, digits 0-9, hyphen (-), underscore (_), period (.), and tilde (~). These are never encoded by encodeURIComponent. Characters that are reserved for URL syntax (like :/@?&=+#) must be encoded only if they are not serving their syntactic role — for example, a ? that is part of a value, not the start of the query string, must become %3F.

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.

Source

Formula Source: NIST Guide to SI Units

by National Institute of Standards

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.