URL encoder / decoder
Encode and decode URLs with encodeURIComponent, encodeURI, form encoding (+ for spaces) or a strict percent mode, with repeated encode/decode, a per-character table and clear errors for malformed percent sequences.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Character table
Shows the encoding of every code point in the current mode, so you can spot what gets escaped
Enter something to inspect it
What this tool does
- Put strings containing Chinese, spaces, & or # safely into a URL query: encode before building an endpoint or request so the server does not receive half a parameter.
- Decode %E4%BD%A0%E5%A5%BD from API logs or the address bar to see what a request actually sent.
- Diagnose double encoding: decode twice and check whether some middleware encoded the percent signs again, which breaks parameter matching.
- Confirm exactly which characters were escaped with the per-character table: # and & stay as-is in URI mode but become %23 and %26 in component mode.
Example
Input
https://unikit.cc/tools?q=hello world&n=1
Output
https%3A%2F%2Funikit.cc%2Ftools%3Fq%3Dhello%20world%26n%3D1
This uses encodeURIComponent (component mode), so : / ? = & are all escaped and the space becomes %20. Choosing encodeURI (URI mode) instead yields https://unikit.cc/tools?q=hello%20world&n=1, where only the space is encoded.
Frequently asked questions
Which of the four modes should I pick?
Use component (encodeURIComponent) for a single parameter value; URI (encodeURI) to patch a whole URL while keeping : / ? & = # intact; form when submitting an application/x-www-form-urlencoded body, since it writes spaces as +; and percent mode for the strictest output, keeping only A-Za-z0-9-_.~ and escaping !'()* as well.
Why does a space become + in form mode?
It is the historical HTML form convention: in application/x-www-form-urlencoded, + means space. Decoding converts + back to a space, but inside an ordinary URL path a + is a literal plus sign — do not mix the two.
Why does Chinese text grow so much when encoded?
One Chinese character is 3 bytes in UTF-8 and each byte is written as three characters (%XX), so the encoded length is roughly nine times the original. If you see two-byte sequences like %C4%E3, the source was GBK encoded — convert it to UTF-8 first.
What do “invalid percent sequence” and “invalid UTF-8” mean?
The first means a stray % or %X (not followed by two hex digits), usually from a truncated copy or from pasting raw text into a URL. The second means the %XX sequences are well formed but the resulting bytes are not valid UTF-8, typically GBK content decoded as UTF-8.
What are the repeated encode/decode rounds for?
Double encoding: after two passes a percent sign becomes %25, and one decode only unwraps one layer. Setting the round count to 2 shows the final value in one go, up to five rounds. Everything runs in your browser and nothing is uploaded.
Keywords:url encodeurl decodeurl 编码url 解码encodeURIComponentencodeURIpercent encoding百分号编码表单编码form urlencoded中文乱码