Brotli vs gzip vs zstd: which compression to serve and when

By TechCompare · Updated · How we check

Serve Brotli for files you compress ahead of time, Brotli or zstd for pages built on the fly, and keep gzip as the fallback. Never compress images, video or fonts that are compressed already.

Servers compress text responses like HTML, CSS, JavaScript and JSON before sending them, and the browser unpacks them. The browser lists what it accepts in its Accept-Encoding header, and the server names its pick in Content-Encoding. Gzip works everywhere. Brotli usually makes smaller files. Zstandard, or zstd, is fast enough to use on every request and often gets close to Brotli.

Topic
Brotli vs gzip vs zstd
Compression
Category
HTTPS setup
HSTS, ECH, redirects and compression

How this is calculated

Gzip goes back to the 1990s, and every HTTP client can read it. Brotli (RFC 7932) came out of Google in 2015 and was built for the web, with a built-in dictionary of common words and HTML snippets. Browsers only offer it over HTTPS. At its highest level it's slow to compress, so it shines for static files you compress once at build time.

Zstandard (RFC 8878) came out of Facebook. It compresses much faster than Brotli for a similar result, which suits responses built per request, like HTML from a CMS or JSON from an API. Chrome added it in version 123 and Firefox in version 126, both in 2024. Safari followed in version 26.3 in February 2026, on Apple's newest systems only. For HTTP, RFC 9659 caps the memory a zstd stream may ask a browser for.

Compression only pays off for text. JPEG, PNG, WebP, AVIF, MP4 and WOFF2 files are compressed already, and squeezing them again burns CPU for almost nothing. Tiny responses gain little either. Pages that mix a secret, like a CSRF token, with text an attacker controls can leak that secret through the compressed size, an attack called BREACH. Keep such tokens out of compressed responses or change them on every request.

The SSL Checker asks for the site's home page, or wherever it redirects, once per encoding, offering only that one each time. It reports which of br, gzip and zstd come back.

Verdict

Turn on Brotli and gzip at the least, which most CDNs do for you. Precompress static files with Brotli at a high level. For pages built per request, use Brotli at a middle level or zstd. Then check the site and confirm every encoding you enabled really comes back.

More SSL scenarios

Frequently asked questions

Should I turn on zstd if I already have Brotli?
It's optional. Brotli already covers every current browser over HTTPS. Zstd mainly helps servers that compress lots of dynamic responses, where its speed saves CPU. Keep Brotli and gzip either way, since each browser picks from what it offers.
Why does my site send gzip when the browser supports Brotli?
The server or CDN only sends what it has switched on, and some only use Brotli for certain file types or sizes. Over plain HTTP, browsers don't offer Brotli at all. Look at Content-Encoding on the HTML itself, not only on scripts and styles.
Can compression break a site?
Rarely, but it happens when a server compresses twice or labels the encoding wrong, which shows up as garbled text or a download prompt. A proxy that rewrites Accept-Encoding can change what you get too, so test from outside your own network.