URL Encoder/Decoder
Encode and decode URLs and query strings
Frequently Asked Questions
What is URL encoding?
URL encoding replaces unsafe characters with % followed by hex digits. Spaces become %20, & becomes %26.
Why do URLs need encoding?
URLs can only contain certain ASCII characters. Special characters must be encoded to be valid.
What characters need encoding?
Spaces, &, =, ?, #, %, +, and all non-ASCII characters need URL encoding.
What is the difference between encodeURI and encodeURIComponent in JavaScript?
encodeURI encodes a full URL, preserving characters like :, /, and ?. encodeURIComponent encodes everything except letters and digits, suitable for encoding individual query parameter values.
Why do spaces become %20 or + in URLs?
In URL path segments, spaces are encoded as %20. In query strings (application/x-www-form-urlencoded), spaces can be encoded as +. Both represent a space but are used in different URL contexts.
URL Encoding
URL encoding converts characters into a format that can be transmitted over the Internet. Special characters are replaced with a % followed by their hex value.
encodeURI: Encodes a complete URL, preserving special characters like : / ? & =
encodeURIComponent: Encodes everything including special characters. Use for query parameters.
Common Encodings
Space → %20 or +
& → %26
= → %3D
? → %3F
/ → %2F