Gzip vs Brotli 文本压缩率与耗时对比

想知道是否值得开启 Brotli?粘贴你的真实数据——HTML、JS、JSON——在这里直接实测 gzip 与 deflate 的对比。浏览器无法压缩 Brotli,因此你会得到其典型压缩率作为可靠的参考区间。

—
嵌入此工具到你的网站 / 博客 无需开发 · 复制即可使用
HTML 嵌入代码 (iframe):
<iframe src="https://lucentool.com/zh/compression-compare" width="100%" height="650" style="border:1px solid #e5e0d8;border-radius:12px;max-width:850px;width:100%;" frameborder="0"></iframe>
<div style="font-size:12px;color:#78716c;margin-top:6px;font-family:sans-serif;">Powered by <a href="https://lucentool.com/zh/compression-compare" target="_blank" style="color:#c85a32;text-decoration:none;">Lucentool - Gzip vs Brotli 文本压缩率与耗时对比</a></div>

你在测量什么

本工具使用浏览器原生的 CompressionStream 压缩你的文本——gzip(deflate + 头部/校验和)和 deflate(zlib 封装的 deflate)——并报告压缩后大小、节省的字节数和压缩率。这是对你真实数据的实测,而不是从通用表格里猜出来的。

Brotli 适用于什么场景

如何解读结果表

压缩率 = 压缩后 ÷ 原始大小(越低越好;0.35 表示节省了 65%)。Brotli 估算行会根据实测的 gzip 大小套用典型区间。做 CDN 决策时,先在这里对比 gzip 压缩率,再用 curl -H "Accept-Encoding: br,gzip" -I 确认你的服务器实际提供什么编码。