URL Encode Decode

Encode or decode URLs, query strings, and URI components using RFC 3986 percent-encoding. Convert special characters safely for web and API requests.

Free, no sign-upRuns in your browserUpdated November 2026
Input URL or Text String
Encoded URL Output
102 Characters
Input Length: 71 chars Output Length: 102 chars
Common Percent-Encoded ASCII Characters
CharacterLiteralPercent Code
Space[space]%20 or +
Percent Sign%%25
Ampersand&%26
Question Mark?%3F
Equals Sign=%3D
Forward Slash/%2F

How to use the URL Encode Decode

  1. Paste your raw text, query string, or API URL into the Input URL box.
  2. Select whether you want to Encode (convert to %-hex) or Decode (convert back to readable text).
  3. Choose your scope: encodeURIComponent for individual query values, or encodeURI for full website addresses.
  4. 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.

Percent-Encoding Format: % + Hexadecimal representation of ASCII byte value (e.g., Space = ASCII 32 = %20)

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 with encodeURI, 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 %2F and & into %26. Never pass a full URL into encodeURIComponent, 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)":

CharacterRaw InputPercent-EncodedPurpose
Space %20Spaces are illegal in HTTP request lines
Ampersand&%26Prevents browser from treating this as a new query variable
Percent%%25Prevents parsing ambiguity with hexadecimal escapes
Open Paren(%28Strict RFC 3986 escape
Close Paren)%29Strict RFC 3986 escape
Final URL ParameterTom & Jerry (100% Fun)Tom%20%26%20Jerry%20%28100%25%20Fun%29

Frequently asked questions

What is URL percent-encoding?
Percent-encoding is a mechanism for encoding arbitrary characters in a URI using only US-ASCII characters, replacing non-allowed characters with a "%" followed by two hexadecimal digits.
What is the difference between %20 and + for spaces?
RFC 3986 specifies %20 for spaces in URI paths and general URLs. The plus sign (+) is used specifically within the query component for application/x-www-form-urlencoded form submissions.
Why did my URL break when using encodeURIComponent?
encodeURIComponent encodes slashes (/), colons (:), and question marks (?). If applied to an entire URL rather than an individual parameter value, it destroys the protocol and path structure.
How do I encode special characters in an API request?
Pass each query parameter value through encodeURIComponent before joining them with ampersands (&).
Can this tool decode malformed percent sequences?
If a string contains an isolated "%" not followed by two valid hexadecimal characters, JavaScript will throw an URIError. This tool catches and highlights the malformed sequence.
Is my data transmitted to a remote server during encoding?
No. All encoding and decoding operations execute 100% locally on your computer inside browser memory.

Last reviewed November 2026. Results are estimates for information only — see our disclaimer.