HomeAll toolsURL Encoder

URL Encoder

Encode or decode complete URLs, components and query parameters.

Data is processed only in your browser
Input
Output
encodeURIComponent / decodeURIComponent:除字母数字与 - _ . ! ~ * ' ( ) 外全部转义,用于查询参数值与路径片段。

How to use

URL Encoder helps you safely encode and decode URLs and their components. Following RFC 3986, it converts special characters into %XX format, ensuring URLs are not misinterpreted during network transmission.

How to use: Paste the URL or text to process into the input field. Select "Encode" to convert special characters to %XX format, or "Decode" to restore %XX back to original characters.

URL Encoding Character Reference

CharacterEncodedCharacterEncoded
Space%20 or +Chinese chars%E4%B8%AD etc.
&%26=%3D
#%23?%3F
/%2F:%3A
%%25+%2B

Encoding Examples

Query parameter encoding:

Original: https://example.com/search?q=hello world&lang=en

Encoded: https://example.com/search?q=hello%20world&lang=en

Note: Usually only query parameter values need encoding — the protocol, domain, and path separators should remain unchanged.

Troubleshooting

Encoded URL doesn't work? Check if you encoded the entire URL. Only encode query parameter values, not the protocol, domain, or path separators.

Decoded text is garbled? Ensure UTF-8 charset was used during encoding. Some legacy systems use different charsets, causing inconsistent decoding.

In code

encodeURIComponent escapes reserved characters such as & and =. encodeURI deliberately leaves them alone, which is why it is the wrong choice for a query value.

JavaScript

encodeURIComponent('hello world&lang=zh');
// "hello%20world%26lang%3Dzh"
decodeURIComponent('hello%20world');  // "hello world"

Python

from urllib.parse import quote, unquote

quote('hello world&lang=zh', safe='')  # 'hello%20world%26lang%3Dzh'
unquote('hello%20world')                # 'hello world'

Frequently asked questions

What's the difference between encoding and decoding?

Encoding converts special characters (spaces, Chinese characters, &, etc.) into %XX format for safe URL inclusion. Decoding reverses this, restoring %XX back to the original characters.

Should I encode the whole URL or just parameters?

Usually you only need to encode query parameter values, not the entire URL. The tool offers both modes — encode the full URL or just components — choose based on your needs.

Which characters need encoding?

Per RFC 3986, all characters except letters, digits, and -_.~ must be encoded. Chinese characters, spaces, #, &, = are commonly encoded.

See all questions

Go deeper

Related tools