URL Encoder & Decoder
Encode and decode URLs with encodeURIComponent and encodeURI modes plus query string table parsing.
- Free
- No sign-up
- Runs in your browser
URL Encoder
Parsed Query String Parameters
0 parameters| Parameter Key | Raw / Encoded Value | Decoded Value |
|---|
Runs in your browser. Your inputs never leave your device.
In short
Quick Answer
encodeURIComponent() encodes every character except A–Z, a–z, 0–9, -, _, ., !, ~, *, ', (, ). Use it for individual query-string values. encodeURI() preserves structural characters (:, /, ?, #, &, =) and is used for complete URLs. To decode, paste percent-encoded text and the tool reverses each %XX sequence to the original UTF-8 character.
Step by step
How to Use
- Select Operation & Mode. Choose 'Encode' or 'Decode' and pick either Component mode (encodeURIComponent) or Full URI mode (encodeURI).
- Enter String or URL. Type or paste your query parameter, text snippet, or complete web address into the input box.
- Inspect & Copy Output. View converted output live, inspect parsed query parameter key-value pairs in the table, and copy the result.
How & When to Use the URL Encoder / Decoder
- Passing Nested URLs in Redirects: When passing a return URL (e.g.
?returnTo=https://example.com/dashboard?tab=billing), useencodeURIComponentso the nested query parameters aren't parsed by the outer server. - Fixing Broken Links with Spaces: Web browsers require valid ASCII URIs. Encode spaces as
%20(or+) and non-ASCII Unicode characters before sharing links. - Debugging Webhook Payloads & Query Strings: Paste complex query strings to view every parameter neatly parsed into a structured table.
- Safe Form Data Encoding: Verify how input field data will be transmitted in
application/x-www-form-urlencodedPOST requests.
URL Encoding Specification & Mode Comparison
RFC 3986 specifies percent-encoding to represent characters in URIs outside the allowed ASCII character set. Understanding the distinction between component and full URI modes prevents broken routes and corrupted parameters.
| Character | encodeURI Mode | encodeURIComponent Mode | Reason |
|---|---|---|---|
Space ( ) |
%20 |
%20 |
Spaces are never permitted in valid URIs. |
Ampersand (&) |
& (Preserved) |
%26 (Encoded) |
Delimits query parameters; must be encoded inside values. |
Equals (=) |
= (Preserved) |
%3D (Encoded) |
Separates key and value; must be encoded inside values. |
Question Mark (?) |
? (Preserved) |
%3F (Encoded) |
Begins query string; must be encoded inside values. |
Slash (/) |
/ (Preserved) |
%2F (Encoded) |
Separates path segments; must be encoded inside values. |
Hash (#) |
# (Preserved) |
%23 (Encoded) |
Begins fragment anchor; must be encoded inside values. |
Examples
Worked Examples
Encode a Query Parameter Value
Mode: encodeURIComponent · Input: hello world & goodbye!
- Spaces → %20, & → %26, ! → %21
- Output: hello%20world%20%26%20goodbye%21
Result: hello%20world%20%26%20goodbye%21
Encode a Full URL
Mode: encodeURI · Input: https://example.com/search?q=hello world&lang=en
- Structural characters preserved: ://?&=
- Space → %20, other special chars encoded
- Output: https://example.com/search?q=hello%20world&lang=en
Result: https://example.com/search?q=hello%20world&lang=en
Decode a Percent-Encoded String
Mode: Decode · Input: Caf%C3%A9%20au%20lait
- %C3%A9 is the UTF-8 encoding for é (e with acute)
- %20 is a space character
- Decoded: Café au lait
Result: Café au lait
Watch out
Common Mistakes to Avoid
-
Double-Encoding: Encoding an already percent-encoded string converts existing
%characters into%25(e.g.%20becomes%2520). Always verify whether incoming data is already encoded before applying transformation. -
Using encodeURI for Query Values: Running
encodeURIon a parameter value leaves characters like&and+unencoded, causing server parsers to truncate or split values unexpectedly. -
Malformed Percent Sequences: Decoding a string with a bare percent sign (such as
discount=50%instead ofdiscount=50%25) throws a fatal JavaScriptURIError: URI malformed. Safe tools catch and surface this error clearly.
FAQ
Frequently Asked Questions
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes all reserved punctuation characters (including &, =, ?, /, :, and #) into percent-encoded hex sequences. It is intended for encoding individual query parameter keys and values. In contrast, encodeURI preserves valid URL structure characters (;,/?:@&=+$#) and only encodes characters forbidden in standard URIs like spaces and Unicode glyphs.
When should I use encodeURIComponent instead of encodeURI?
Always use encodeURIComponent when preparing values to append to a query string (e.g., ?q=search+term or ?redirect_url=https://example.com). If you used encodeURI, symbols like & and = inside your value would be mistaken for additional query delimiters.
How does this tool handle '+' plus signs in query strings?
In application/x-www-form-urlencoded query strings, plus signs (+) commonly represent spaces. When decoding in Component mode, this tool translates both '+' and '%20' into standard space characters.
Is my URL or private query parameter data sent to a server?
No. All URL encoding, decoding, and query string table parsing run 100% locally in your web browser. Sensitive API tokens and query strings never leave your device.
What is the maximum URL size supported?
The tool supports inputs up to a 1 MB safety cap (1,048,576 characters). Live debounced processing ensures instant UI updates without lag.
References