URL Encode / Decode Online — encodeURIComponent / decodeURIComponent
URL percent-encoding / URL decoding / escaping Chinese and special characters
About URL Encoding & Decoding
URL encoding (percent-encoding, RFC 3986) converts non-ASCII and special characters in a URL into the %XX form (e.g. the Chinese character "中" → %E4%B8%AD, a space → %20), so the URL is not broken during HTTP transport. This tool encodes and decodes all special characters including Chinese, spaces and symbols, keeping a URL safe and reliable in HTTP transport. Note the difference from Base64: Base64 converts binary data to text, while URL encoding is for safe URL transport — for Base64 use the Base64 encoder/decoder.
Use Cases
- Frontend Ajax/Fetch requests: when GET query parameters contain Chinese, they must be encoded with encodeURIComponent before being sent to the backend.
- REST API debugging: when building an API request URL, special characters in the path or query (such as &, =, ?) must be encoded, or they will be misparsed.
- Link sharing: URLs containing Chinese or special characters may be truncated or garbled after copying; an encoded link is safe and stable.
- Form data submission: the application/x-www-form-urlencoded format requires form data to be URL-encoded (a space becomes + or %20).
FAQ
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes more broadly, escaping URI structural characters such as / ? : @ & = + $ #, and suits encoding the "value" of a query parameter. encodeURI keeps those characters, suited to encoding a full URL without breaking its structure. This tool uses encodeURIComponent (good for parameter values); to encode a full URL, handle the path and parameters separately.
Does a % sign need to be encoded again after URL encoding?
If % is part of the original text (not an encoding result), it must be encoded as %25. For example, the string "100% 完成" encodes to "100%25%E5%AE%8C%E6%88%90". This tool’s encodeURIComponent handles multi-byte UTF-8 characters correctly.
Which characters in a URL do not need encoding?
According to RFC 3986, unreserved characters do not need encoding: uppercase letters A-Z, lowercase letters a-z, digits 0-9, hyphen -, underscore _, dot . and tilde ~. All other characters may need encoding.
Why do Chinese characters display normally in the browser address bar?
Modern browsers visually decode the URL in the address bar (for display only), but the actual HTTP request sent — or copied and pasted — is still in encoded form. If you see Chinese in the address bar, pasting it into a text editor usually converts it to the encoded form automatically. To build a URL containing Chinese manually, always encode it first.