Gzip Size Calculator
Paste text or drop a file to instantly see gzip and deflate compressed sizes with visual comparisons.
About This Tool
The Gzip Size Calculator is a free browser-based tool that lets you instantly measure the compressed size of any text, code, or file using gzip and deflate algorithms. It shows the original size, the compressed size for each algorithm, the compression ratio as a percentage, and a visual bar chart comparing all three.
This tool uses the browser’s built-in Compression Streams API to perform real gzip and deflate compression entirely on your device. No data is ever sent to any server. You can paste JavaScript bundles, CSS stylesheets, HTML pages, JSON payloads, or any other text and see the compressed output size in real time.
Understanding compressed transfer sizes is essential for web performance. Most
web servers and CDNs serve assets with Content-Encoding: gzip or
Content-Encoding: br (Brotli). Knowing your compressed size helps you set
accurate performance budgets and decide whether
further minification is worthwhile.
The tool also detects common content types (JSON, HTML, CSS, JavaScript) and offers actionable suggestions. For example, if you paste unformatted JSON, it will suggest minifying it first with the JSON Formatter tool before compressing. If you are working with HTML content, the HTML to Markdown converter can help strip unnecessary markup before you measure compression.
You can drag and drop any file for analysis, including binary files. The calculator supports files of any size, though very large files may take a moment to process. All processing is 100% client-side with zero data transmission.
How to Use
- Paste or type your text, code, or markup into the input textarea. The tool starts analyzing as you type.
- Alternatively, drag and drop a file onto the input area, or click Upload File to select a file from your device.
- View the three size cards showing Original, Gzip, and Deflate compressed sizes in bytes and human-readable units.
- Check the savings summary to see the percentage reduction and exact bytes saved for each compression method.
- Review the visual bar chart to compare original and compressed sizes at a glance.
- If a content type hint appears (JSON, HTML, CSS, JavaScript), follow the suggestion to optimize further.
- Click Copy Results or press Ctrl+Shift+C to copy all size information to your clipboard.
Popular Gzip Compression Examples
FAQ
How accurate is the gzip size estimate?
The tool uses the browser's native CompressionStream API, which performs actual gzip compression using the DEFLATE algorithm. The result is the same as what a web server would produce with default gzip settings. The size shown is the exact compressed byte count, not an estimate.
What is the difference between gzip and deflate?
Gzip wraps the DEFLATE compression algorithm with additional headers (including a checksum and file metadata). Deflate is the raw compression algorithm itself. Gzip output is typically 18-20 bytes larger than raw deflate due to these headers. Both are widely supported by web servers and browsers via the Content-Encoding header.
Does this tool support Brotli compression?
The tool currently uses gzip and deflate via the browser's CompressionStream API. Brotli (Content-Encoding: br) is not yet available in the CompressionStream API in all browsers. The deflate results shown provide a reasonable comparison baseline since Brotli typically achieves 15-25% better compression than gzip for text content.
What compression level does this tool use?
The browser's CompressionStream API uses a default compression level (typically level 6 for gzip, which is the standard default). This matches what most web servers use in production. Custom compression levels are not exposed by the browser API.
Can I analyze binary files?
Yes. You can drag and drop any file type onto the input area. Binary files (images, PDFs, executables) will be compressed and measured, though already-compressed formats like PNG, JPEG, and ZIP will show minimal or no size reduction. The tool processes the raw bytes without attempting text decoding for binary files.
Is my data safe?
Yes. All compression is performed entirely in your browser using the native CompressionStream API. No text, code, or file data is ever sent to any server. You can verify this by checking the Network tab in your browser's developer tools while using the tool.
Why does my compressed size seem larger than expected?
Compression adds overhead (headers, dictionary, checksums). For very small inputs (under ~100 bytes) or already-compressed content (images, videos, zip files), the compressed output can be the same size or even larger than the original. This is normal behavior and is why web servers typically skip compression for small or already-compressed responses.
Related Tools
Code Minifier
Minify and beautify JavaScript, CSS, and HTML code with size comparison stats.
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting and tree view.
HTML to Markdown
Convert HTML to clean Markdown with support for headings, links, images, lists, tables, and code blocks.
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes for text and files.
Cache-Control Builder
Build Cache-Control headers visually with toggle switches for every directive, duration presets, and server config snippets.
Performance Budget Calculator
Calculate and visualize web performance budgets based on connection speed, target load time, and asset category allocation with presets and export options.
Web Vitals Reference
Interactive reference for Core Web Vitals (LCP, INP, CLS) and supplementary metrics (FCP, TTFB, TBT) with threshold checks and optimization tips.