โ Frequently Asked Questions โ URL Encoder
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL, preserving characters that have special meaning in URLs like /, :, @, ?, and &. encodeURIComponent encodes a single URL component (like a query value), encoding everything including &, =, and ?. Use encodeURIComponent for query parameter values and encodeURI for the full URL.
Why do spaces become %20 or + in URLs?
In standard URL encoding (RFC 3986), spaces are encoded as %20. In HTML form encoding (application/x-www-form-urlencoded), spaces are encoded as +. Both are valid in their contexts. This tool uses %20 (the standard), which is correct for all modern web APIs.
When should I URL encode data?
Always URL encode user-provided data before including it in a URL query string. This prevents broken URLs (from characters like &, =, #) and protects against URL injection attacks. In JavaScript, use encodeURIComponent() for query values and encodeURI() for the full URL.
What characters do NOT need URL encoding?
The unreserved characters (AโZ, aโz, 0โ9, -, _, ., ~) do not need encoding. All other characters, including spaces, &, =, ?, #, /, and non-ASCII characters (like accented letters and emoji), must be percent-encoded when used in URL components.