Encode or decode URL-safe characters
This tool percent-encodes text using the browser's built-in encodeURIComponent rules (a space becomes %20, a Chinese character becomes a UTF-8 byte sequence such as %E4%BD%A0) and reverses the process with decodeURIComponent. It suits query-string values, path segments, or a garbled link copied from a log. Be aware that it offers only this one rule: there is no structure-preserving mode like encodeURI, no form-style 'space becomes plus' option, and no automatic detection of whether your input is already encoded.
Click 'Encode →' on the default sample, https://example.com/搜索?q=你好 世界, and the actual output is https%3A%2F%2Fexample.com%2F%E6%90%9C%E7%B4%A2%3Fq%3D%E4%BD%A0%E5%A5%BD%20%E4%B8%96%E7%95%8C. Notice that the colon, slashes, question mark and equals sign were escaped too, which tells you this tool is meant for encoding a single parameter value, not a whole link. Another case: a b&c=d/é becomes a%20b%26c%3Dd%2F%C3%A9, where & turns into %26 so it cannot be mistaken for a parameter separator. In the other direction, %E4%BD%A0%E5%A5%BD decodes to 你好 (the Chinese greeting). These outputs come from running the same functions, not from guesswork.
Because encodeURIComponent escapes structural characters such as :// and ? as well. It is designed for a small piece of data that goes inside a URL, such as the search term after ?q=. The right approach is to keep the link's structure and encode each parameter value on its own before you assemble the URL.
First check the line is complete. Text copied from email, chat or logs can be cut off at the end or carry stray spaces and line breaks. Then confirm the source was UTF-8; sequences in GBK or other charsets cannot be restored here. A line of ordinary text that happens to contain a lone percent sign, such as '50% done', will also fail, and that text does not need decoding in the first place.
In the query part of a URL, systems disagree. Traditional HTML form submissions write a space as a plus sign, while JavaScript's encodeURIComponent and most modern APIs use %20. This tool produces and understands only the %20 form. If your string uses plus signs for spaces, replace them with spaces somewhere else before decoding.
The hexadecimal digits in encoded output are uppercase (for example %E4), which is fixed behaviour of encodeURIComponent. Decoding accepts either case. Ordinary letters and digits are never rewritten.
Encoding and decoding happen in your browser. The code only calls the built-in encodeURIComponent and decodeURIComponent, makes no request that sends your input to a server, and keeps no history. Refreshing or closing the page clears what you typed. If you are handling links that carry tokens or passwords, avoid leaving the page open on a shared device.