About This Tool

What is URL 编码 / 解码?

A tool for encoding and decoding URL strings. URL encoding is essential when web addresses contain special characters, spaces, or non-ASCII characters like CJK text. It ensures safe transmission of query parameters in web requests.

How to Use

  1. Enter the string you want to encode or decode in the input area.
  2. Click 'Encode' to convert special characters to percent-encoding (%XX).
  3. Click 'Decode' to restore encoded strings to their original characters.
  4. Copy the result for use in your project.

Key Features

  • Standard URL encoding based on encodeURIComponent
  • Full support for non-ASCII characters including CJK
  • Bidirectional encode/decode conversion
  • Real-time result display

Tips

  • Special characters like &, =, ?, and # must be encoded in URLs to work as intended.
  • Spaces are converted to %20 or + during URL encoding.
  • Always encode user input in query parameters when making API calls.

URL 编码 / 解码

对 URL 字符串进行编码或解码


Frequently Asked Questions

encodeURI()和encodeURIComponent()有什么区别?

encodeURI()编码整个URI但保留特殊字符如:、/、?和#。encodeURIComponent()编码所有字符包括这些特殊字符,使其适合编码单个查询参数值。

为什么空格有时显示为%20,有时显示为+?

%20是URL中空格的标准百分号编码。+号仅在application/x-www-form-urlencoded格式(HTML表单提交)中使用。两者都表示空格,但%20在URL中更为通用和正确。

我需要在URL中编码韩文或日文等非英文字符吗?

是的。非ASCII字符必须经过URL编码才能安全传输。现代浏览器在地址栏中显示解码后的字符以提高可读性,但实际的HTTP请求使用编码形式。


Related Tools