URL 编码器 / 解码器

即时编码和解码 URL。将特殊字符转换为百分比编码格式,反之亦然。支持完整 URL 和组件编码。100% 客户端处理,不向服务器发送任何数据。

输入字符数: 0 输出字符数: 0

快速示例

关于 URL 编码器/解码器

URL 编码将字符转换为可通过互联网传输的格式。空格、引号和非 ASCII 字符等特殊字符会被替换为百分比编码序列(例如,空格变为 %20)。此工具支持保留 URL 结构的完整 URL 编码(encodeURI),以及编码所有特殊字符(包括斜杠和冒号)的组件编码(encodeURIComponent)。

功能

How to Use

  1. Select the mode: "Encode" to convert text to URL-encoded format, or "Decode" to convert URL-encoded text back to plain text
  2. Choose the encoding type: "Full URL" preserves URL structure characters (: / ? #), while "URL Component" encodes all special characters
  3. Paste your text or URL into the input field
  4. Click the "Process" button to encode or decode your input instantly
  5. Use the "Copy" button to copy the result to your clipboard, or "Swap" to exchange input and output
  6. Try the Quick Examples buttons below the output to see common encoding/decoding scenarios in action

Common Use Cases

常见问题

什么是 URL 编码?

URL 编码(也称为百分比编码)是一种在统一资源定位符(URI)中编码信息的机制。它将不安全的 ASCII 字符替换为 "%" 后跟两个十六进制数字。例如,空格变为 %20。

encodeURI 和 encodeURIComponent 有什么区别?

encodeURI 编码完整的 URL,但保留 URL 结构中有效的字符(如 : / ? #)。encodeURIComponent 编码所有特殊字符,因此适用于查询参数值。完整 URL 使用 encodeURI,URL 组件使用 encodeURIComponent。

什么时候应该使用 URL 编码?

当您的数据包含需要包含在 URL 中的特殊字符时,如空格、非 ASCII 字符或保留字符(如 & = ? /),应使用 URL 编码。这确保 URL 有效,并能被浏览器和服务器正确解析。

此工具对于敏感数据使用是否安全?

是的,所有处理完全在您的浏览器中进行。不会向服务器发送任何数据,因此对于 API 密钥、令牌或私有 URL 等敏感信息完全安全。

Can I encode Unicode and non-ASCII characters?

Yes, this tool fully supports Unicode and all non-ASCII characters including emoji, Chinese characters, Arabic script, Cyrillic, and more. These characters are encoded using UTF-8 percent-encoding, which is the standard for modern web applications.

Why does my encoded URL look different after encoding?

URL encoding replaces unsafe characters with percent-encoded sequences. For example, spaces become %20, & becomes %26, and non-ASCII characters become multi-byte sequences like %E4%B8%AD for Chinese characters. This is normal and expected — the encoded URL is still valid and functional.

Can I decode a partially encoded URL?

Yes, the decoder will process any percent-encoded sequences it finds and leave other characters unchanged. However, if the URL contains malformed encoding (like an incomplete % sequence), the tool will show an error. Make sure your input is valid URL-encoded text.

What is the maximum input size?

There is no artificial limit imposed by the tool. The practical limit depends on your browser's memory and JavaScript string handling capabilities. Most modern browsers can handle inputs of several megabytes without issues. For extremely large datasets, consider processing in chunks.

Related Tools