URL Encode / Decode
Percent-encode or decode URLs and query strings. Handles UTF-8 and reserved characters correctly.
Percent-encoding replaces unsafe or reserved characters in a URL with a '%' followed by two hexadecimal digits. It is required because URLs can only contain a limited set of ASCII characters.
The encoder here uses UTF-8, so Chinese, emoji, and other non-ASCII text are first turned into UTF-8 bytes and then percent-encoded byte by byte.
UTF-8 is used before percent-encoding, so Chinese, emoji, and other non-ASCII text are handled correctly and produce valid URLs everywhere.
Common uses
- Preparing a search query with spaces or non-ASCII characters for a GET request parameter.
- Building a 'mailto:' or 'tel:' link with a subject line that contains special characters.
Frequently asked questions
- Should spaces become %20 or +?
- In the path and most modern APIs, %20. The '+' form is only correct in application/x-www-form-urlencoded query strings.
- Why does my decoded URL show strange characters?
- The bytes were probably not UTF-8. If the source used Latin-1 or another legacy encoding, UTF-8 decoding will produce replacement characters.
- Is encoding reversible?
- Yes. Percent-encoding is a lossless transformation; decoding restores the exact original bytes.
- What about spaces in paths?
- Spaces in paths must be %20, not '+'. The '+' convention only applies to query strings in form submissions.
- When should I encode the whole URL?
- Only the parameter values need encoding; encoding the entire URL would break the protocol and domain. Paste just the value you want to send.
- Why not use encodeURIComponent?
- encodeURIComponent is the browser-native function doing exactly this. The tool replicates it so you can use it outside a browser, for example in documentation or on the command line.