About URL Encoder/Decoder
URL encoding (also called percent-encoding) converts characters that are not allowed or have special meanings in URLs into a percent sign (%) followed by two hexadecimal digits. For example, a space becomes %20, and & becomes %26.
encodeURI vs encodeURIComponent
- encodeURI: Encodes a complete URL. Does NOT encode: A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
- encodeURIComponent: Encodes a URL component (e.g., a query parameter value). Does NOT encode: A-Z a-z 0-9 - _ . ! ~ * ' ( )
When to Use Each
Use encodeURI when encoding a full URL that should remain a valid URL. Use encodeURIComponent when encoding a value that will be used as part of a query string parameter (it encodes &, =, +, and ? which are special in query strings).
Frequently Asked Questions
Why does my URL have %20 instead of spaces?
%20 is the URL-encoded representation of a space character. URLs cannot contain literal spaces, so they are replaced with %20 (or sometimes + in query strings). Use our decoder to convert them back to readable text.
Should I encode the entire URL or just parameters?
Only encode individual parameter values, not the entire URL structure. Use encodeURIComponent on each parameter value separately, then combine them with & in the query string.