URL 编码空间占比

🔤 URL Encoding Space Overhead

Estimate the percent-encoding size growth of a URL or query string to anticipate parameter bloat in links.

📐 计算公式与说明

每个非 ASCII/特殊字符编码为 %XX(3 字符)
空格编码为 %20 或 +

用于预估 URL 参数长度。

📚 深度解析:URL 编码空间占比

💡 常见使用场景

示例:含 10 个中文的参数
约 30 字节原文编码后约 90 字符,膨胀约 200%(每中文字≈9 字符)。

❓ 常见问题(FAQ)

占比与长度关系?
占比衡量相对膨胀,长度工具给绝对字符数,二者互补。
为何中文膨胀这么大?
UTF-8 每中文字 3 字节,编码为 %XX 各 3 字符,故约 3×。
能降低膨胀吗?
可对整段先做 Base64Url 或改用短编码,但会牺牲可读性。

Formula & Standard References

Item Formula / Rule Source / Standard
Unreserved set 66 characters stay literal: A–Z, a–z, 0–9, "-", ".", "_" and "~" RFC 3986 §2.3 Unreserved Characters
Encoded length Lout = literal characters + 3 × bytes needing escape RFC 3986 §2.1 Percent-Encoding
Literal share Share = unreserved characters ÷ total characters × 100% WHATWG URL Standard, percent-encode sets