URL Encoder / Decoder
Encode or decode URLs and query string parameters.
URL Encoding Explained
URL encoding (percent-encoding) replaces unsafe characters with a % followed by two hex digits. encodeURIComponent encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ), making it ideal for query parameters. encodeURI preserves URI structure characters like : / ? # &.
Use cases
- Build query strings that include spaces, symbols, or non-ASCII characters.
- Decode a logged URL to see what a user actually submitted.
- Safely pass a redirect target as a query parameter.
- Debug issues where servers receive unexpected characters.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves URI-structural characters like : / ? # &, so it is appropriate for whole URLs. encodeURIComponent encodes those characters too, so it is the right choice for a single query parameter value.
Why is a space encoded as %20 sometimes and + other times?
%20 is the standard percent-encoding for a space. The + form is a legacy rule specific to the application/x-www-form-urlencoded body format used by HTML forms.
Do I need to encode Chinese characters?
Yes. Non-ASCII characters must be UTF-8 encoded and then percent-encoded to travel through URLs reliably. This tool handles that automatically.