Skip to content
100% local

Compression size calculator

See how much smaller your text gets with gzip, deflate or brotli compression.

Input
Output

Compression size calculator

Paste any text and this tool compresses it with the browser's native CompressionStream to show exactly how much smaller it gets. It reports the original size in bytes and kB, the compressed size, the compression ratio and the percentage saved — useful for estimating gzip transfer sizes, comparing JSON payloads, or checking whether a blob of text is worth compressing before you store or send it.

Pick an algorithm from gzip, deflate, deflate-raw or brotli, the same formats a web server or a build pipeline uses for response compression. Turn on "Compare all algorithms" to run every one at once and see them side by side in a single table, which is the fastest way to tell whether brotli's extra ratio actually beats plain gzip for your specific text. "Show compressed data as Base64" prints the compressed bytes of the selected algorithm as a Base64 string, handy for embedding a compressed payload directly in code or a data URI.

Brotli support varies by browser — some engines don't implement it for CompressionStream yet, and the tool says so plainly instead of pretending it ran. Very short or already-compressed text (like a short random ID) can come out larger than the input once framing overhead is added; that's expected and the ratio will show it. The live tally under the output always shows the original-to-compressed byte count and the percentage saved for the algorithm you have selected.

Everything runs locally in your browser via the Web Compression Streams API — no text is uploaded anywhere, so it's safe to test API responses, config files or anything else you wouldn't want to paste into a third-party site. Copy the report, download it as a .txt file, or send the output back into another tool to keep working.

FAQ

Which compression algorithm should I pick?
gzip is the most widely supported and a good default for comparing against real-world server compression. Brotli usually compresses text a bit smaller but is newer and not supported everywhere. Turn on "Compare all algorithms" to see the actual difference for your text.
Why is the compressed size larger than the original for short text?
Every compression format adds a small fixed amount of header and framing overhead. For very short input that overhead can outweigh the savings, so the "compressed" size ends up bigger than the original — this is normal and the same thing happens on real servers.
What does the compression ratio mean?
It is the original size divided by the compressed size, shown as X:1. A ratio of 3:1 means the compressed data is about a third of the original size.
Why does it say brotli is not supported?
Not every browser implements the brotli format for the native CompressionStream API yet. When that happens the tool reports it plainly rather than showing a wrong number — try gzip or deflate instead, or check again in an updated browser.
Is my text uploaded anywhere?
No. Compression runs entirely in your browser using the native CompressionStream API — your text is never sent to a server.