How to use the URL Encode Decode
- Paste your raw text, query string, or API URL into the Input URL box.
- Select whether you want to Encode (convert to %-hex) or Decode (convert back to readable text).
- Choose your scope:
encodeURIComponentfor individual query values, orencodeURIfor full website addresses. - Click Copy Result to copy the sanitized string directly into your browser or code editor.
Why URLs Require Percent-Encoding (RFC 3986)
Uniform Resource Identifiers (URIs) and URLs are constrained to a restricted subset of the US-ASCII character set. Characters outside this safe spectrum—including international Unicode characters (emojis, accented vowels, Cyrillic, Kanji), binary data, and ASCII control characters—cannot be transmitted across the Hypertext Transfer Protocol (HTTP) without causing parsing corruption.
Furthermore, several standard ASCII characters (such as ?, &, =, /, and #) serve as reserved structural delimiters that separate schemes, hostnames, paths, query strings, and fragment anchors. To transmit a literal question mark, ampersand, or percentage symbol inside a query parameter value, it must be represented via percent-encoding.
encodeURI vs. encodeURIComponent: When to Use Each
In modern web development and JavaScript, developers often introduce severe bugs by interchanging encodeURI and encodeURIComponent:
- encodeURI(): Intended for complete, full-length URLs. It encodes illegal characters (such as spaces and non-ASCII glyphs) while preserving structural URL delimiters like
http://,/,?, and&. If you encode an entire address withencodeURI, the URL remains functional in a web browser. - encodeURIComponent(): Intended for isolated query string parameters, keys, and values. It encodes everything outside of alphanumeric characters and
- _ . ! ~ * ' ( ), transforming delimiters like/into%2Fand&into%26. Never pass a full URL intoencodeURIComponent, or the domain slashes and protocol colon will break.
Strict RFC 3986 Compliance
While standard JavaScript encodeURIComponent follows modern specifications for most characters, it leaves exclamation marks !, single quotes ', parentheses ( ), and asterisks * unencoded because they were classified as "sub-delimiters" in legacy RFC 2396. When constructing sensitive REST API payloads for platforms like OAuth 1.0a or Amazon AWS Signature Version 4, strict RFC 3986 mandates encoding those five characters as %21, %27, %28, %29, and %2A.
Worked Example: Encoding a Search Query with Spaces and Ampersands
Suppose you are building a search link where a user searches for "Tom & Jerry (100% Fun)":
| Character | Raw Input | Percent-Encoded | Purpose |
|---|---|---|---|
| Space | | %20 | Spaces are illegal in HTTP request lines |
| Ampersand | & | %26 | Prevents browser from treating this as a new query variable |
| Percent | % | %25 | Prevents parsing ambiguity with hexadecimal escapes |
| Open Paren | ( | %28 | Strict RFC 3986 escape |
| Close Paren | ) | %29 | Strict RFC 3986 escape |
| Final URL Parameter | Tom & Jerry (100% Fun) | Tom%20%26%20Jerry%20%28100%25%20Fun%29 | |
Frequently asked questions
What is URL percent-encoding?
What is the difference between %20 and + for spaces?
Why did my URL break when using encodeURIComponent?
How do I encode special characters in an API request?
Can this tool decode malformed percent sequences?
Is my data transmitted to a remote server during encoding?
Last reviewed November 2026. Results are estimates for information only — see our disclaimer.