Comparison

Gzip vs Brotli Compression: Which to Use for Your Web Server

Brotli compresses 15-25% smaller than Gzip for text content but is slower to compress. When to serve Brotli, when Gzip, and how to configure both correctly.

The short answer

Serve Brotli to browsers that accept it, with Gzip fallback. Brotli compresses static assets 15-25% smaller than Gzip at equivalent speed; the gap widens for HTML/CSS/JS. Decompression speed is comparable for both — the user doesn't feel a difference.

Compression ratios on real content

ContentRawGzip -9Brotli -11
React bundle1,000 KB280 KB220 KB
HTML article80 KB20 KB16 KB
Tailwind CSS (full)3,500 KB420 KB320 KB
JSON API response (1 MB)1,000 KB180 KB150 KB
Already-compressed (JPEG)400 KB398 KB398 KB

Compression speed matters for dynamic content

Brotli level 11 (maximum) can take 100× longer to compress than Gzip level 6. For static assets (CSS/JS bundles) you compress once at build time and serve forever — use maximum level. For dynamic content (API responses compressed on the fly), use Brotli level 4-5 or Gzip level 4-6; anything higher costs more server CPU than it saves bandwidth.

Configuration pitfalls

  • Don't compress already-compressed content — JPEG, PNG, WebP, MP4, zip files. They gain nothing and cost CPU.
  • Vary: Accept-Encoding is essential when serving different encodings to different clients. Without it, intermediary caches can serve the wrong encoding.
  • Pre-compress static assets — generate .br and .gz files at build time; configure the server to serve them directly instead of recompressing each request.
  • CDNs handle this for you — Cloudflare, CloudFront, Fastly all support Brotli automatically. Often simpler than configuring your origin.

Browser support (2026)

  • Brotli — 97% global; anything except very old browsers
  • Gzip — 100%; unchanged since 1997

What about Zstandard?

Zstandard (zstd) is Facebook's compression algorithm with better speed/ratio tradeoffs than Brotli for some workloads. HTTP support is emerging (Chrome, Firefox have flags) but not yet production-ready for public-facing sites. For now: Brotli for static, Gzip fallback, keep an eye on zstd.

Minify BEFORE compressing

Compression is not a substitute for minification. A minified JS file compresses to a smaller Brotli output than an un-minified one of the same compressed size, because minification eliminates redundancy the compressor can't. Use JavaScript minifier, CSS minifier, HTML minifier, and JSON minifier as a build step — then let Brotli/Gzip finish the job.

Measurable impact

Switching a typical 500 KB static bundle from Gzip to Brotli saves ~50-80 KB per user. At a million requests per month that's 50-80 GB of bandwidth, plus a real reduction in Time To First Byte for users on slow connections. LCP often improves 50-150ms on the first page load.

Featured Tools

Try these free related tools directly in your browser — no sign-up required.

gzip vs brotli brotli compression http compression brotli vs gzip performance content encoding comparison

Explore 300+ Free Tools

Utilko has tools for developers, writers, designers, students, and everyday users — all free, all browser-based.