How Accept-Encoding works
Browsers send gzip, deflate, br, zstd (Brotli and zstd only over HTTPS). Servers and CDNs pick the best one they support and reply with Content-Encoding. JavaScript can’t change this header in browsers.
Examples
Accept-Encoding: gzip, deflate, br, zstd
Common mistakes
-
To see compression from the command line, ask for it:
curl -sI -H "Accept-Encoding: br, gzip" https://example.com. curl’s--compressedsends the header and decompresses for you.
Check it
# Show the request headers curl sends (lines starting with >)
curl -sv -o /dev/null https://example.com 2>&1 | grep '^>'
Paste a full set of response headers into the HTTP header checker to get every header explained and common mistakes flagged.
Related headers
- Content-Encoding: names the compression applied to the body, such as gzip, br (Brotli) or zstd.
- Vary: lists the request headers that change the response, so caches keep a separate copy for each value.
- Accept: lists the response formats the client prefers, with optional weights.
More content and negotiation headers
Content-Type , Content-Disposition , Accept-Language , Content-Length , Range , Transfer-Encoding .
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does the Accept-Encoding header do?
The Accept-Encoding request header lists the compression formats the client can decode. Browsers send gzip, deflate, br, zstd (Brotli and zstd only over HTTPS). Servers and CDNs pick the best one they support and reply with Content-Encoding. JavaScript can’t change this header in browsers.
How do I see the Accept-Encoding header?
Open your browser’s dev tools, select a request in the Network tab and look under Request Headers. On the command line, "curl -v https://example.com" prints the request headers it sends, marked with ">".