Gzip / Brotli Tester

Paste any text payload and instantly see its compressed size across gzip, deflate, deflate-raw, and brotli — entirely in the browser.

FAQ

How does this tool compress data without a server?

It uses the browser's native Compression Streams API (available in Chrome 80+, Firefox 113+, Safari 16.4+), the same API used by the browser itself for network compression. No data leaves your device.

What is the difference between gzip and deflate?

Both use the DEFLATE compression algorithm internally. gzip wraps it with a header, checksum, and trailer (RFC 1952) — this is the format servers send in HTTP responses with Content-Encoding: gzip. The "deflate (zlib)" format adds a zlib wrapper (RFC 1950). "deflate-raw" is raw DEFLATE with no wrapper. In practice, HTTP clients expect gzip or brotli.

What is brotli and why does it produce smaller files?

Brotli (br) is a modern compression algorithm by Google optimised for text. It uses a combination of a modern variant of LZ77, Huffman coding, and a large static dictionary of common web content. It typically achieves 15–25% better compression than gzip on JSON and HTML.

Why does compressing short strings sometimes make them larger?

Compression algorithms include metadata headers and checksum bytes. For very short payloads (under ~50 bytes), the overhead of these headers exceeds the size savings from compressing the content itself. Compression only helps beyond a few hundred bytes.

Which algorithm should my API use?

Prefer brotli (br) when both client and server support it — it gives the best compression ratio. Fall back to gzip as it is universally supported. Set the Content-Encoding header on responses and Accept-Encoding on requests to negotiate the format.