```yaml
product: AlterLab
title: "Gzip Compression — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/gzip-compression
```

protocol

# Gzip Compression

Gzip is a lossless data compression algorithm used to reduce HTTP response body size, decreasing transfer time for HTML and JSON responses by 60–90%.

When a browser or scraper sends `Accept-Encoding: gzip` in a request header, the server may compress the response body with gzip before sending it. Large HTML documents (50–200 KB uncompressed) typically compress to 10–40 KB, significantly reducing bandwidth consumption and transfer latency — especially on mobile or slow connections.

Most HTTP client libraries (Python's requests, httpx, Node's axios) automatically send `Accept-Encoding: gzip, deflate, br` and transparently decompress the response, so scrapers receive the decompressed body without extra code. Brotli (`br`) is a newer, higher-compression alternative to gzip that is widely supported by modern browsers and CDNs.

For large-scale scraping, always requesting gzip compression reduces bandwidth costs. On cloud providers, egress is billed by byte transferred; compressed responses can halve the egress bill for HTML-heavy crawls.

### What is Gzip Compression?

Gzip is a lossless data compression algorithm used to reduce HTTP response body size, decreasing transfer time for HTML and JSON responses by 60–90%.

### How does AlterLab handle Gzip Compression?

For large-scale scraping, always requesting gzip compression reduces bandwidth costs. On cloud providers, egress is billed by byte transferred; compressed responses can halve the egress bill for HTML-heavy crawls.

## Examples

```
import requests

# gzip is requested automatically by requests
response = requests.get("https://example.com",
    headers={"Accept-Encoding": "gzip, deflate, br"})
print(response.headers.get("Content-Encoding"))  # 'gzip' if server compressed
print(f"Received {len(response.content)} bytes (decompressed automatically)")
```

## Related Terms

[HTTP HeadersKey-value metadata fields sent with HTTP requests and responses that communicate authentication, content type, caching, and other directives.](https://alterlab.io/glossary/http-headers)[HTTPHTTP (HyperText Transfer Protocol) is the application-layer protocol used by web browsers and scrapers to request and receive resources from web servers.](https://alterlab.io/glossary/http)[Content Delivery Network (CDN)A distributed network of servers that delivers web content from locations geographically close to the user, often where anti-bot protection is deployed.](https://alterlab.io/glossary/content-delivery-network)[Content NegotiationContent negotiation is an HTTP mechanism where the client specifies preferred response formats (JSON, HTML, XML) via Accept headers and the server responds in the best matching format.](https://alterlab.io/glossary/content-negotiation)[Connection PoolingConnection pooling reuses open TCP/TLS connections across multiple HTTP requests to reduce handshake overhead and improve scraping throughput.](https://alterlab.io/glossary/connection-pooling)

## Extract Gzip Compression data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)