TToolbox
%

URL Encode/Decode

Encode and decode URL components

About this tool

URL encoding (also known as percent-encoding) is the mechanism specified by RFC 3986 for URI character representation. Since URLs can only be safely transmitted across the Internet using a limited subset of printable ASCII characters, any non-ASCII characters (such as Chinese or accents) and reserved delimiters (?, &, =, #, +) must be encoded as '%' followed by two hexadecimal digits to preserve URL structure.

How to Use This Tool (Step-by-Step)

1

Enter URL or Query String

Paste a full URL or raw query parameter string into the text box. Full UTF-8 support handles all multilingual characters and special symbols.

2

Select Encode or Decode Action

Click 'URL Encode' to convert sensitive characters into %XX format, or click 'URL Decode' to convert percent-encoded strings back to plain text.

3

Copy Converted URL Result

The converted URL or query string is generated immediately. Copy it directly into HTTP client calls, redirect headers, or webhook payloads.

Complete UTF-8 Percent Encoding

Flawlessly handles multilingual text, emojis, whitespace, and special delimiters into valid RFC 3986 percent-encoded bytes.

100% Private Client-side Operation

No network requests are fired. Safely encode or decode URLs containing sensitive query parameters, callback URLs, or auth keys.

Smart Reserved Character Parsing

Assists developers in understanding the crucial difference between encoding a complete URI versus encoding an individual URI component.

Key Gotchas & Common Pitfalls

  • •Know encodeURI vs encodeURIComponent: encodeURI leaves '?', '&', '=', and '/' intact (for whole URLs), while encodeURIComponent escapes them (for query values). Mixing them up causes broken query strings.
  • •Beware of '+' vs space: In URL forms, spaces become '+'. If your parameter genuinely contains a '+' (like a Base64 string), it MUST be escaped as '%2B', otherwise servers will decode it into a space!
  • •Avoid double encoding: Encoding an already encoded string turns '%20' into '%2520' (encoding the '%' itself). Always verify whether upstream proxies have already encoded inputs.

Code & Transformation Examples

URL with Multilingual Query Params Example

Raw URL (Unencoded)
https://example.com/search?keyword=前端 工具&lang=zh
Percent-encoded Output
https://example.com/search?keyword=%E5%89%8D%E7%AB%AF%20%E5%B7%A5%E5%85%B7&lang=zh

* Chinese characters are encoded into UTF-8 byte triplets, and the space is safely converted to %20.

Native Implementation across Languages

JavaScript
// 参数值编码(推荐)
const safeParam = encodeURIComponent("前端 工具");

// 完整 URL 编码(保留 :// 等)
const safeUrl = encodeURI("https://example.com/路径");
Python 3
import urllib.parse

# 参数编码 (空格转为 + 或 %20)
safe_param = urllib.parse.quote("前端 工具")

# 解码
raw_text = urllib.parse.unquote(safe_param)

* In frontend development, always use encodeURIComponent for individual query parameter values to escape '&' and '=' delimiters.

Frequently Asked Questions

Q: Why do Base64 strings sent via GET parameters often fail to decode?

A: Base64 uses '+' characters. If not escaped as '%2B', HTTP servers interpret '+' as a space. The backend then receives a corrupted Base64 string that fails validation.

Q: Is percent-encoding case sensitive (%2F vs %2f)?

A: According to RFC 3986, hex digits in percent-encoding are case-insensitive (%2F equals %2f). However, uppercase letters are formally recommended for standard consistency.

Q: Which characters are considered 'unreserved' and never need encoding?

A: RFC 3986 specifies: alphanumeric characters (A-Z, a-z, 0-9) and four symbols: '-', '_', '.', and '~' are unreserved and never require encoding.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/