URL Encoder & Decoder

Encode or decode URLs and query parameters to make them safe for transmission.


                

URL encoding FAQ

What is URL encoding?
URL encoding replaces characters that are unsafe in a URL with a percent sign followed by two hexadecimal digits - a space becomes %20, and so on. It lets query strings, paths and form data travel without breaking the URL structure.
What is the difference between encodeURI and encodeURIComponent?
encodeURI keeps characters that are valid in a whole URL (the protocol, slashes, ? and &), so it is for encoding a full URL. encodeURIComponent encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ), so it is for encoding a single value inside a query parameter. When in doubt, use encodeURIComponent for values.
Should a space be %20 or +?
In a path or query key use %20. A + is the legacy way of representing a space inside form body data (application/x-www-form-urlencoded). Most servers accept + in query strings, but %20 is always correct.
Why did my decode fail?
Usually because the string contains a lone % that is not followed by two hex digits, or it was double-encoded. Decode once more if the output still shows percent signs that look encoded.