Gzip & Deflate Compression Ratio Calculator

Measure gzip and deflate sizes for text and JSON in your browser. Compare byte savings and see a separately labeled Brotli estimate.

—
Embed this tool on your website / blog No code required · Copy and paste
HTML Embed Code (iframe):
<iframe src="https://lucentool.com/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/compression-compare" target="_blank" style="color:#c85a32;text-decoration:none;">Lucentool - Gzip vs Brotli Compression Benchmark</a></div>

Compare compressed size on your own text

Paste text or JSON and choose Measure. The tool uses the browser's compression implementation to report the original UTF-8 byte count, gzip size, and zlib-wrapped deflate size. The ratio is compressed bytes divided by original bytes, shown as a percentage.

Example: one character can become a larger file

Enter a, a one-byte UTF-8 input. In Chromium, the result is 21 bytes for gzip and 9 bytes for deflate: 2100% and 900% of the original size. Headers and checksums outweigh the savings for this tiny input.

What the Brotli row means

Brotli is an estimate calculated as gzip size × 0.82–0.90; this tool does not run a Brotli encoder or measure encoding speed. Results can differ from a server using another compression level. Test the actual server response before choosing production settings.

Where it breaks down

The comparison uses the browser's own CompressionStream, so the numbers come from the same deflate and gzip implementations your server is likely to use rather than from a hand-written estimator. compress() wraps the text in a Blob, pipes it through the stream and measures the resulting buffer; the table then reports original size, compressed size and the ratio for each format. Because the work happens locally, you can paste a real payload — a JSON response, an HTML fragment — instead of a sample string.

Formats, sizes and other limits

Only the formats the browser exposes are available: gzip and deflate where CompressionStream exists, and nothing where it does not — older Safari builds lack it entirely, so the table silently has fewer rows on those browsers. Brotli is not exposed to JavaScript, so any brotli figure you see elsewhere comes from a server-side test, not from this page. Ratios on tiny inputs are meaningless because of header overhead, and highly repetitive test strings flatter every algorithm equally.

Privacy: no data leaves this tab

The text is compressed with the browser’s built-in stream machinery, entirely on your device. That also means a confidential payload can be measured without being sent anywhere.

Frequently asked questions

Why is Brotli missing?

Browsers do not expose a Brotli compressor to JavaScript. Measure it server-side, or trust your CDN's own reporting.

Why do my ratios look worse than a benchmark?

Benchmarks usually use large, repetitive text. Real payloads — JSON with unique ids, HTML with varied copy — compress far less.

Does the result match what my server sends?

The algorithm is the same; the level and window may not be. Treat the numbers as a close estimate, not an exact byte count.