URI / URL Percent-Encoding & Query Parameter Decoder
Encode query string parameters using standard RFC 3986 percent-encoding or decode encoded URLs back to human text.
All formulas and computation matrices for this calculator execute directly in your browser with zero latency. Enter your parameters to see instant results.
Who Uses This Calculation & Why Accuracy Matters
Web developers, backend engineers, SEO analysts, and API testers use this calculator to percent-encode reserved and unsafe characters in Uniform Resource Identifiers (URIs) and decode complex query parameter strings adhering strictly to IETF RFC 3986.
A frontend engineer passing a user search query containing symbols (`"C++ & AI / ML?"`) into an HTTP GET query string.
A security engineer constructing an OAuth authorization URL passing an internal callback URL as the `redirect_uri` parameter.
A digital marketer decoding a campaign tracking URL containing nested encoded redirect parameters.
RFC 3986 Reserved & Common Percent-Encoded ASCII Characters
Standard characters, their hex values, and reasons for percent-encoding in URIs.
| Character | Hex Code | Percent-Encoded | RFC 3986 Category | URI Structural Function |
|---|---|---|---|---|
| Space (" ") | 0x20 | %20 or + | Unsafe Character | Separates tokens in query strings |
| Ampersand (&) | 0x26 | %26 | Reserved Delimiter | Separates key-value query parameters |
| Equals (=) | 0x3D | %3D | Reserved Delimiter | Separates parameter key from value |
| Question Mark (?) | 0x3F | %3F | Reserved Subcomponent | Marks the beginning of a query string |
| Forward Slash (/) | 0x2F | %2F | Reserved Segment | Separates path hierarchy segments |
| Hash / Fragment (#) | 0x23 | %23 | Reserved Fragment | Marks client-side fragment identifier |
| Colon (:) | 0x3A | %3A | Reserved Scheme | Delimits scheme and port numbers |
| Plus Sign (+) | 0x2B | %2B | Reserved Subcomponent | Often interpreted as space in query strings |
| Percent Sign (%) | 0x25 | %25 | Escape Indicator | Literal escape indicator byte |
* Unreserved characters that should NEVER be encoded: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~).
Uniform Resource Identifier Percent-Encoding Algorithm
Under RFC 3986, characters not permitted in a URI component are replaced with a percent sign ("%") followed by the two-character hexadecimal representation of their underlying byte octet.
Characters allowed without encoding: [A-Z], [a-z], [0-9], "-", "_", ".", "~".
Characters with reserved syntactical meaning: ":", "/", "?", "#", "[", "]", "@", "!", "
quot;, "&", "'", "(", ")", "*", "+", ",", ";", "=".Two-digit hex byte value derived from UTF-8 character encoding.
Step-by-Step Worked Examples with Real Numbers
Encoding a Complex Search Query Parameter
Decoding a Nested Tracking URL Parameter
Assumptions, Edge Cases & Common Calculation Mistakes
ℹ Underlying Algorithm Assumptions
- Encodes non-ASCII characters by converting them first to multi-byte UTF-8 sequences before percent-encoding each individual byte.
- Differentiates between full URI encoding (`encodeURI`) and individual query component encoding (`encodeURIComponent`).
- Assumes modern RFC 3986 percent-encoding standard (%20 for spaces) with optional application/x-www-form-urlencoded support ("+" for spaces).
⚠ 3 Common Mistakes to Avoid
- Using `encodeURI()` when encoding an individual query parameter value, which leaves delimiters like "&" and "=" unencoded, breaking parameter parsing.
- Double encoding an already-encoded string (turning `%20` into `%2520`), a very frequent bug in web redirects.
- Assuming "+" always represents a space (valid in POST form bodies and query strings under HTML specs, but invalid in URL path segments).
Frequently Asked Questions
What is the difference between encodeURI() and encodeURIComponent() in JavaScript?
`encodeURI()` is meant for complete URLs and does not encode characters that have structural meaning in a URL (like http://, ?, &, =). `encodeURIComponent()` is designed for query parameter values and encodes all reserved delimiters so they do not break the overall URL structure.
When should a space be encoded as "%20" vs. "+"?
Under standard RFC 3986 URI rules, a space must always be encoded as "%20". The plus sign "+" represents a space only in query strings formatted as `application/x-www-form-urlencoded` (standard HTML form submissions). In URL path segments, a plus sign literally represents a plus sign.
Why must the percent sign "%" itself be encoded as "%25"?
Because "%" is the escape indicator in URL encoding. If a literal "%" were not encoded, the URL parser would expect the two characters immediately following it to be valid hexadecimal digits, causing a URI malformed syntax error.
What is "double encoding" and why does it break links?
Double encoding happens when an already-encoded URL is passed into an encoder a second time. The "%" in "%20" becomes "%25", turning the string into "%2520". When the browser decodes it once, it yields "%20" instead of a literal space.
Are uppercase and lowercase hex letters equivalent in percent encoding?
RFC 3986 states that percent-encoded octets are case-insensitive (%2f is mathematically equivalent to %2F), but specifies that uppercase letters (e.g., %2F) are the preferred canonical standard.