How do I test Brotli vs Gzip compression online?
Paste text (JSON, HTML, CSS, or any content) and instantly see compression results for Brotli, Gzip, and Deflate side by side — compressed size, savings percentage, ratio, and compression time. The tool highlights the best algorithm. Everything runs in your browser using native CompressionStream and brotli-wasm.
[JSON API response — 12.4 KB]
Brotli: 2.1 KB (83% savings) ★ best Gzip: 2.8 KB (77% savings) Deflate: 2.9 KB (77% savings) Brotli is 25% smaller than Gzip Compression time: 3ms / 2ms / 1ms
Brotli / Gzip Compression Tester
Test and compare Brotli, Gzip, and Deflate compression ratios for your text content. See which algorithm gives the best compression for your data.
About Compression Testing
- Brotli — developed by Google, typically achieves 15-25% better compression than Gzip for text content. Supported by all modern browsers via HTTPS.
- Gzip — the most widely supported compression format. Based on DEFLATE algorithm. Universally supported by web servers and browsers.
- Deflate — the underlying algorithm used by both Gzip and Zlib. Lower overhead than Gzip (no header/trailer), but less common as a standalone format.
- Compression ratios vary by content type — repetitive text like JSON and HTML compresses well (70-90% savings), while already-compressed or random data may not compress at all.
- Everything runs in your browser — Gzip and Deflate use the native CompressionStream API, Brotli uses brotli-wasm. No data is sent over the network.
Tips & Best Practices
Brotli compresses 15-25% better than Gzip for text content
Brotli consistently beats Gzip on HTML, CSS, JavaScript, and JSON. The tradeoff: Brotli compression is slower (use static pre-compression for assets) but decompression is equally fast. All modern browsers support Brotli via the br content-encoding.
Don't compress already-compressed formats like JPEG, PNG, or MP4
Images, videos, and most binary formats are already compressed. Running them through Gzip or Brotli wastes CPU and can actually increase file size due to compression headers. Only compress text-based formats and uncompressed data.
Pre-compress static assets at build time with maximum compression
Brotli level 11 compresses 50% better than level 1 but takes 100x longer. For static assets (JS, CSS), compress once at build time with maximum quality. For dynamic responses, use Brotli level 4-6 for a good speed/ratio tradeoff.
Be aware of BREACH attacks when compressing HTTP responses
The BREACH attack exploits HTTP compression to extract secrets like CSRF tokens by measuring response sizes. Mitigations include: don't reflect user input and secrets on the same page, add random padding to responses, or use per-request CSRF tokens.
Frequently Asked Questions
What is the difference between Brotli, Gzip, and Deflate compression?
How much smaller will Brotli make my JavaScript and CSS files?
Should I use Brotli or Gzip for my web server?
Related Inspect Tools
GitHub Actions Validator
Validate GitHub Actions workflow YAML files for syntax, triggers, job structure, step config, needs dependencies, and deprecated actions
Aspect Ratio Calculator
Calculate aspect ratios from any dimensions, resize while preserving proportions, and find equivalent sizes. Device presets for phones, tablets, monitors, and social media
XPath Tester
Test XPath expressions against XML data with real-time evaluation — select elements, filter by attributes, navigate axes, and use XPath functions
SQL Playground
Run SQL queries in your browser with a full SQLite database powered by WebAssembly — practice JOINs, CTEs, window functions, aggregations, and more