SEO glossary
What is Gzip?
Learn what Gzip compression is—the ubiquitous HTTP content-encoding algorithm—and how to configure it as the universal fallback behind Brotli for faster HTML, CSS, and JS delivery.
Definition
Gzip is a lossless compression algorithm identified by the Content-Encoding: gzip HTTP header, widely supported by browsers and crawlers to reduce the transfer size of text-based web assets.
Gzip: the baseline compression every site needs
Gzip is the workhorse of HTTP compression. When a client cannot use Brotli (br), gzip is almost always the answer. Every major browser, CDN, reverse proxy, and search crawler—including Googlebot—understands Content-Encoding: gzip.
For Technical SEO, gzip is not exciting—it is mandatory. Serving uncompressed 200 KB CSS files because someone forgot gzip on in nginx is an unforced error that slows rendering, hurts Core Web Vitals, and burns crawl budget on redundant bytes.
This entry focuses on gzip specifically: how it works, how it differs from Brotli, and how to configure it as the reliable fallback in your compression strategy. For the broader content-encoding negotiation model, see Compression.
How gzip fits the encoding stack
Client Accept-Encoding: br, gzip
↓
Server has prebuilt file.br? → send Brotli
↓ else
Server gzip enabled? → send gzip
↓ else
Send uncompressed (avoid this path)
Gzip is the safety net—not the ceiling. Modern stacks prefer Brotli for static text, gzip for everything else.
Gzip vs Brotli (when to use which)
| Factor | Gzip | Brotli |
|---|---|---|
| Compression ratio | Good | Typically 15–25% better on text |
| Client support | Universal | Modern browsers + Googlebot |
| CPU (dynamic) | Lower at level 6 | Higher unless precompressed |
| Precompressed static | .gz files common | .br files growing standard |
| SEO role | Fallback + legacy | Preferred first choice |
Policy: enable both; negotiate br first, gzip second.
What gzip compresses well
- HTML — repetitive tags and attributes.
- Minified JavaScript — repeated keywords and punctuation.
- CSS — long selector lists and property blocks.
- JSON — API payloads and JSON-LD in HTML.
- SVG — XML text compresses heavily.
- XML sitemaps — large URL lists shrink dramatically.
A 2 MB sitemap.xml might gzip to 200 KB—faster for crawlers to ingest.
What gzip should not touch
Binary formats with internal compression:
- JPEG, PNG, WebP, AVIF, GIF
- MP4, WebM
- WOFF2 fonts
- PDF, ZIP
Configure MIME-type allowlists—not “compress everything.”
Server configuration examples
nginx
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/json
application/xml
image/svg+xml;
gzip_vary on emits Vary: Accept-Encoding—critical for browser caching correctness.
Apache
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
Precompressed static files
Build pipeline outputs app.a1b2c3.js and app.a1b2c3.js.gz. Server maps:
gzip_static on;
Serves .gz with Content-Encoding: gzip when client accepts gzip—zero runtime CPU.
Gzip and dynamic HTML (SSR)
SSR pages generate fresh HTML per request. On-the-fly gzip at level 6 adds modest CPU but saves latency on slow mobile networks—where mobile-first indexing evaluates your site.
For high-traffic HTML, consider:
- Short CDN cache (
s-maxage=60) for anonymous pages. - Edge caching of gzip-compressed variants.
- Edge rendering with compression at PoP.
Headers you should see
Successful gzip response:
HTTP/2 200
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Verify with:
curl -sI -H 'Accept-Encoding: gzip' https://yoursite.com/ | grep -i encoding
Gzip + minification interaction
Minification removes human-readable redundancy; gzip exploits byte-level patterns. Order matters:
- Minify JS/CSS in build.
- Gzip (and Brotli) the minified output.
- Hash filenames for immutable caching.
Skipping minification leaves easy wins on the table—gzip cannot compress verbose comments you should have deleted.
SEO and crawl implications
Faster JavaScript rendering
Smaller JS downloads complete sooner—CSR and hydration finish before crawler render timeouts.
Sitemap and feed efficiency
Large sitemaps gzip cleanly. Ensure your server gzips application/xml responses or serves .xml.gz with correct headers.
Third-party scripts
You cannot gzip assets on other domains. Self-host critical JS or choose vendors that gzip/br their CDNs.
Troubleshooting gzip issues
| Issue | Cause | Fix |
|---|---|---|
| Lighthouse “Enable compression” | gzip off for MIME type | Add type to gzip_types |
| Double gzip garbled page | CDN + origin both compress | Disable one layer |
| Cached wrong encoding | Missing Vary | Enable gzip_vary on |
.gz file served as raw | Missing Content-Encoding | Map encoding header |
| Tiny files expand | gzip_min_length | Skip <1 KB responses |
Migration path to Brotli without dropping gzip
Enable Brotli on CDN/origin, precompute .br alongside .gz in CI, and negotiate br first with gzip fallback. Gzip stays enabled—some proxies still strip br.
How Crawlox helps with gzip-related performance
Crawlox crawl metrics highlight overweight text responses on your origin—often indicating missing gzip/Brotli or unminified assets. While gzip is infrastructure, its absence surfaces as bloated pages in crawl exports, prompting fixes that improve both user experience and crawler throughput before indexation quality suffers.
Related terms
Frequently asked questions
Is Gzip still relevant with Brotli available?
Yes. Gzip remains the universal fallback for older clients, bots with limited br support, and intermediate proxies. Serve Brotli when possible, gzip always.
How much does Gzip reduce file size?
Text assets often shrink 60–80% depending on content. Minified JavaScript compresses especially well due to repeated tokens.
Does Googlebot support Gzip?
Yes. Googlebot sends Accept-Encoding including gzip and br. Uncompressed HTML wastes crawl bandwidth.
What compression level should I use for Gzip?
Level 6 is a common default balancing CPU and ratio. Level 9 saves marginal bytes with higher CPU—better for precompressed static files offline.
Should I gzip images?
No. JPEG, PNG, and WebP are already compressed. Gzip them only wastes CPU.
References
Explore authoritative guidance and frameworks related to gzip.
Explore every glossary definition
Return to the glossary to search by term, alias, starting letter, or category.