SEO glossary
What is Brotli?
Learn what Brotli compression is—the Content-Encoding: br algorithm offering superior text ratios over Gzip—and how to precompress assets for Core Web Vitals gains.
Definition
Brotli is a modern lossless compression algorithm signaled by Content-Encoding: br in HTTP responses, delivering typically 15–25% smaller text payloads than Gzip at comparable quality—especially effective for precompressed static HTML, CSS, and JavaScript.
Brotli: smaller text than gzip, when configured correctly
Brotli (Content-Encoding: br) is Google’s open-source compression algorithm designed for web text. On typical HTML, CSS, and minified JavaScript, Brotli achieves roughly 15–25% smaller payloads than Gzip at similar decompression speeds in browsers—translating directly into faster downloads for users and crawlers.
Brotli is not a replacement for sound architecture. It will not fix unminified 3 MB bundles or unoptimized hero images. It will squeeze already-clean text assets further—low-hanging Technical SEO fruit when paired with code minification and proper cache-control.
This page covers Brotli specifically. For negotiation basics and MIME-type rules, see Compression. For legacy fallback configuration, see Gzip.
Brotli vs Gzip: decision matrix
| Scenario | Recommendation |
|---|---|
Static app.[hash].js at deploy | Precompute .br + .gz; serve best match |
| SSR HTML per request | Dynamic Brotli level 4–6 or gzip if CPU-bound |
| API JSON rarely crawled | Brotli optional; prioritize public HTML/JS |
| Old IE clients | Gzip only (historical); irrelevant to Googlebot |
Always ship both encodings for static assets. Brotli-first negotiation, gzip safety net.
Why Brotli beats gzip on text
Brotli includes a built-in static dictionary of common web tokens (<div, function, https://)—repeated strings in minified JS compress aggressively. Gzip’s smaller window still performs well but lacks those web-tuned literals.
Example illustrative savings on a 120 KB minified bundle:
| Encoding | Transferred size |
|---|---|
| Uncompressed | 120 KB |
| Gzip level 6 | ~38 KB |
| Brotli quality 11 (precomp) | ~30 KB |
Exact ratios vary; measure your assets.
Precompression workflow (recommended)
Build step:
# Illustrative — tools: brotli CLI, vite-plugin-compression
brotli -q 11 -o app.a1b2c3.js.br app.a1b2c3.js
gzip -k -9 app.a1b2c3.js # gzip sibling for fallback
Deploy all three: app.js, app.js.br, app.js.gz.
nginx brotli_static on; gzip_static on; serves correct file with encoding header based on Accept-Encoding.
Benefits:
- Zero per-request compression CPU.
- Maximum ratio (quality 11) without slowing TTFB.
- Stable bytes for browser caching (
immutablehashed names).
Dynamic Brotli for HTML
SSR and edge rendering may compress HTML on the fly:
brotli on;
brotli_comp_level 5;
brotli_types text/html text/css application/javascript application/json image/svg+xml;
Higher levels increase CPU—watch origin load during traffic spikes. CDN dynamic compression offloads this.
Response headers
HTTP/2 200
Content-Type: application/javascript
Content-Encoding: br
Vary: Accept-Encoding
Cache-Control: public, max-age=31536000, immutable
Test:
curl -sI -H 'Accept-Encoding: br' https://cdn.example.com/app.js | grep -E 'encoding|content-type'
Brotli and Core Web Vitals
Smaller transfers improve:
- LCP — critical CSS/JS/HTML arrive sooner.
- INP — less time blocked on network before script parse (especially on slow 4G).
- TTFB follow-up — not TTFB itself, but total page load window shrinks.
Lab Lighthouse may show modest gains; field CrUX improvements matter for ranking signals.
Crawl efficiency
Googlebot fetches HTML, JS, and XML sitemaps. Brotli-shrunk sitemaps and JS reduce per-URL bandwidth—useful on million-URL catalogs where crawl rate is constrained by host response time and size.
CDN defaults
Cloudflare, Fastly, Akama, and Vercel often enable Brotli automatically for eligible MIME types. Verify:
- HTML from origin is
brwhen Accept-Encoding includes br. - Custom error pages compress too.
Vary: Accept-Encodingpresent on cached objects.
Pitfalls unique to Brotli
| Pitfall | Consequence | Mitigation |
|---|---|---|
| Only gzip files uploaded | No br for modern clients | Generate .br in CI |
| Dynamic level 11 on HTML | CPU latency spikes | Use level 4–6 live; 11 offline |
| Compressing JPEG | CPU waste | MIME allowlist |
| Missing Vary | Cache serves wrong encoding | CDN + origin alignment |
| Disabling gzip fallback | Old tools break | Keep gzip |
Brotli vs Zstd
Zstd (zstd) is emerging in some CDNs with excellent speed/ratio tradeoffs. Adoption is narrower than Brotli today. Monitor your CDN; Brotli + gzip remains the 2026 mainstream pair.
Relationship to image optimization
Brotli does not replace AVIF/WebP. A 2 MB PNG stays ~2 MB with br. Optimize images at codec layer; Brotli handles text stack.
Implementation checklist
□ CI emits .br for JS, CSS, SVG, optional HTML shells
□ Origin/CDN brotli_static + gzip_static enabled
□ brotli_types / gzip_types include application/javascript
□ Vary: Accept-Encoding on all compressed cacheable responses
□ curl tests for br and gzip paths after deploy
□ Lighthouse transfer sizes down vs pre-Brotli baseline
When Brotli matters most
High impact:
- JS-heavy client-side rendering sites.
- Large design-system CSS bundles.
- Huge XML sitemaps and RSS feeds.
- Global audiences on edge rendering CDNs.
Lower impact:
- Tiny mostly-static HTML brochure sites already under 50 KB—still enable, but measure before over-optimizing infra.
How Crawlox helps with Brotli context
Crawlox identifies pages with disproportionate downloaded weight during crawls. If text assets remain large despite Brotli at CDN, the issue is usually unminified sources or double-stacked libraries—not algorithm choice. Fix minification and bundle splitting first; then verify Content-Encoding: br in production to capture remaining byte wins for crawlers and users alike.
Related terms
Frequently asked questions
Is Brotli better than Gzip for SEO?
Brotli usually transfers fewer bytes for text, improving load metrics that influence rankings. Keep Gzip as fallback—SEO gains come from smaller payloads, not the algorithm name alone.
Does Googlebot support Brotli?
Yes. Googlebot advertises Accept-Encoding: gzip, deflate, br. Serving only uncompressed responses wastes crawl efficiency.
Should I use dynamic or precompressed Brotli?
Precompress static JS/CSS/HTML at build time (quality 11 offline). Dynamic Brotli suits SSR HTML when CPU allows—often level 4–6.
Can Brotli compress images?
No meaningful benefit. Use AVIF/WebP for images; Brotli for text assets.
Why is my site not serving br?
Common causes: CDN setting disabled, origin missing brotli module, only .js.gz uploaded without .br sibling, or client not sending Accept-Encoding: br in test.
References
Explore authoritative guidance and frameworks related to brotli.
Explore every glossary definition
Return to the glossary to search by term, alias, starting letter, or category.