URL Encoder / Decoder
Encode URLs and query strings with encodeURIComponent or encodeURI, and decode percent-encoded strings back to readable text. Supports batch encoding of multiple lines. All in-browser, no data uploaded.
Quick load:
▶ Encode — Text to URL-encoded
◀ Decode — URL-encoded to Text
encodeURIComponent vs encodeURI — When to Use Which?
| Function | Encodes | Preserves | Use Case |
|---|---|---|---|
encodeURIComponent | All special characters | A-Z a-z 0-9 - _ . ! ~ * ' ( ) | Query parameter values, form data, API keys |
encodeURI | Most special characters | ; , / ? : @ & = + $ # and above | Full URLs, redirect URIs, base URLs |
Rule of thumb: Use
encodeURIComponent for query parameter values (it encodes &, =, ?, #). Use encodeURI for full URLs that you want to keep structurally intact. Read the URL Encoding Guide for a complete explanation.
Common URL Encoding/Decoding Examples
API Query Params:
search=hello world becomes search=hello%20world. Always use encodeURIComponent for parameter values to avoid & breaking the query string.International URLs: Chinese, Japanese, Korean, Arabic, and other non-ASCII characters are percent-encoded as UTF-8 byte sequences:
世界 becomes %E4%B8%96%E7%95%8C.OAuth Redirect URIs: When registering redirect URIs in OAuth 2.0, the entire URL must be
encodeURIComponent-encoded once more for the query parameter: redirect_uri=https%3A%2F%2Fexample.com%2Fcallback.Double Encoding: Some APIs require double-encoding. E.g.,
%20 becomes %2520. Watch out for this common debugging pitfall.Reserved Characters Reference
| Character | Encoded | Name | Used In |
|---|---|---|---|
! | %21 | Exclamation mark | Fragment identifiers (preserved by both) |
# | %23 | Number sign / hash | Fragment separator (preserved by encodeURI) |
$ | %24 | Dollar sign | Sub-delims (preserved by encodeURI) |
& | %26 | Ampersand | Query param separator (preserved by encodeURI) |
' | %27 | Apostrophe | Sub-delims (preserved by both) |
( ) | %28 %29 | Parentheses | Sub-delims (preserved by both) |
* | %2A | Asterisk | Sub-delims (preserved by both) |
+ | %2B | Plus sign | Query param separator (preserved by encodeURI) |
, | %2C | Comma | Sub-delims (preserved by encodeURI) |
/ | %2F | Slash | Path separator (preserved by encodeURI) |
: | %3A | Colon | Scheme / port separator (preserved by encodeURI) |
; | %3B | Semicolon | Sub-delims (preserved by encodeURI) |
= | %3D | Equals sign | Key-value separator (preserved by encodeURI) |
? | %3F | Question mark | Query string start (preserved by encodeURI) |
@ | %40 | At sign | Authority delimiter (preserved by encodeURI) |
space | %20 | Space | Always encoded (never + in URL encoding) |
Related Tools
- Base64 Encoder / Decoder — Encode binary or text data to Base64 and back
- Hash Digest — MD5, SHA-1, SHA-256, SHA-512, SM3 hash calculator
- JWT Decoder & Debugger — Decode and inspect JSON Web Tokens
- ASN.1 DER Parser — Decode X.509 certificates from DER binary