URL Encoder / Decoder
Encode or decode URLs and query strings instantly. Supports standard percent-encoding, encodeURI, and encodeURIComponent modes.
Advertisement
Encode / Decode URL
Encoding Method:
Auto-detect:
Input
Output
encodeURI vs encodeURIComponent — What's the Difference?
Both functions percent-encode characters, but they treat reserved URL characters differently. Use the table below to understand which method to use.
| Character | encodeURI Whole URL | encodeURIComponent Query Values |
|---|---|---|
| Space | %20 | %20 |
| / (slash) | / (not encoded) | %2F |
| ? (question) | ? (not encoded) | %3F |
| = (equals) | = (not encoded) | %3D |
| & (ampersand) | & (not encoded) | %26 |
| : (colon) | : (not encoded) | %3A |
| # (hash) | # (not encoded) | %23 |
| @ (at) | @ (not encoded) | %40 |
| + (plus) | + (not encoded) | %2B |
| Letters, digits, - _ . ~ | Not encoded | Not encoded |
Rule of thumb: Use encodeURI for an entire URL (preserves structure). Use encodeURIComponent for individual query parameter values.
Advertisement
About URL Encoding & Decoding
URL encoding (also known as percent-encoding) converts characters that are not allowed in URLs into a format that can be transmitted over the Internet. A URL can only be sent over the Internet using the ASCII character set. Characters outside this set are replaced with a % sign followed by two hexadecimal digits.
When Do You Need URL Encoding?
- When building query strings with special characters like
&,=, or spaces. - When passing URLs as parameter values (a URL inside a URL).
- When handling form submissions via GET method.
- When working with REST APIs that include dynamic data in path segments.
Common Percent-Encoded Characters
- Space →
%20(or+in form encoding) - Slash
/→%2F - Question mark
?→%3F - Ampersand
&→%26 - Hash
#→%23