Accept-Encoding

Compression negotiation between client and server starts with the Accept-Encoding header. Primarily a request header, it lists the content encodings a client supports, typically Compression algorithms. The specification also defines a limited response usage where a server lists accepted encodings for content coding in future requests to the same resource.

Usage

The HTTP Accept-Encoding request header is part of the content negotiation process and specifies which encoding methods are supported by the client. The server chooses one of the available methods and then informs the client of the selection by including the Content-Encoding header in the HTTP response.

Multiple encodings are specified using separate HTTP Accept-Encoding headers, or instead, by using a comma-delimited list. The q-factor is also included to indicate a preference or priority.

Directives

gzip

The gzip directive indicates the client supports GNU zip compression. This is the most widely supported encoding on the web.

deflate

The deflate directive indicates the client supports zlib compression. Despite the name, this uses zlib wrapping around the raw DEFLATE compressed data.

br

The br directive indicates the client supports Brotli compression. Brotli typically achieves better compression ratios than gzip for text-based content.

zstd

The zstd directive indicates the client supports Zstandard compression. Zstandard offers high compression ratios with fast decompression speeds.

dcb and dcz

The dcb and dcz directives indicate the client supports dictionary-compressed Brotli and dictionary-compressed Zstandard. Both apply a shared dictionary the client already holds, named in the Available-Dictionary request header, and the response identifies the dictionary through Dictionary-ID when the server assigned one. Clients list the two tokens only on requests where a matching dictionary exists.

identity

The identity directive indicates no encoding is applied. This value is always considered acceptable unless explicitly excluded with identity;q=0, or with *;q=0 when no more specific identity entry is present. An Accept-Encoding header with an empty value means the client wants no content coding at all, which differs from omitting the header, where any coding is acceptable. CLI tools and HTTP libraries sometimes send the empty form when a user disables compression, and the server then answers uncompressed.

* (wildcard)

The * wildcard matches any encoding not already listed in the header. If no Accept-Encoding header is present, the server treats the request as if * were specified.

;q= (quality values)

The ;q= parameter assigns a weight between 0 and 1 to each encoding, where 1 is the highest priority and 0 means "not acceptable." When omitted, the default quality value is 1. The server uses these weights to select the preferred encoding.

Example

In this example, the client requests the server to use one of several encoding methods. In the first variation, each of the options is given equal priority. In the second variation, the q-value directive is used to assign weight to the encoding priority. The server responds naming the single encoding it applied.

Request (variation #1)

GET / HTTP/1.1
Host: www.example.re
Accept-Encoding: gzip
Accept-Encoding: deflate
Accept-Encoding: br
Accept-Encoding: identity
Accept-Encoding: *

Request (variation #2)

GET / HTTP/1.1
Host: www.example.re
Accept-Encoding: gzip, deflate, br;q=1.0, identity;q=0.5, *;q=0.25

Response

HTTP/1.1 200 OK
Content-Encoding: br
Vary: Accept-Encoding

The Vary header tells caches the body depends on the request's Accept-Encoding, so a Brotli copy is never served to a client lacking Brotli support.

Troubleshooting

  1. Compression not applied despite Accept-Encoding. Some reverse proxy configurations clear Accept-Encoding before forwarding. In nginx, proxy_set_header Accept-Encoding ""; drops the header so modules such as sub_filter can rewrite plain-text bodies, and the upstream then answers uncompressed. Compression has to happen on the proxy itself in such a setup (gzip on). Verify what the client receives with curl -sS -o /dev/null -D- -H "Accept-Encoding: gzip" https://www.example.re/.

  2. Unexpected encoding selected. Quality values (q-factors) control preference order. A request with Accept-Encoding: gzip;q=0.5, br;q=1.0 prefers Brotli. Omitting q-values assigns equal weight, and the server chooses freely.

  3. Scripts cannot set Accept-Encoding. The Accept-Encoding header is a forbidden request header in the Fetch standard. The browser sets the value, a fetch() call cannot override it, and the header never triggers a CORS preflight. A script asking for a specific coding receives whatever the browser negotiated.

  4. CDN serving uncompressed responses. Some CDNs compress only when the origin sends an uncompressed response with an appropriate Content-Type. Verify the origin responds with Vary: Accept-Encoding so the CDN caches compressed and uncompressed variants separately.

  5. Identity encoding rejected. Sending Accept-Encoding: identity;q=0 tells the server the client refuses uncompressed responses. When no listed coding is available, the rule is to send the response without any coding anyway, unless identity is marked unacceptable, where the specification stops prescribing and older servers answer 406 Not Acceptable per the superseded rule. Avoid setting identity to q=0 unless all listed encodings are guaranteed available.

  6. Unsupported coding in the request body. A server failing a request over an unsupported Content-Encoding answers 415 and includes Accept-Encoding in the response naming the codings the resource accepts, the most common response-side use of the field.

Crawlers and Accept-Encoding

Verified crawlers advertise different coding sets, and a server picking the coding itself breaks some of them. Googlebot and Bingbot advertise gzip, deflate, and br. ClaudeBot and Meta-ExternalAgent also advertise zstd, while GPTBot and OAI-SearchBot stop at br. YandexBot sends Accept-Encoding: identity, asking for uncompressed bodies, and Applebot lists only gzip and identity. A server or CDN forcing Brotli or Zstandard regardless of Accept-Encoding therefore sends undecodable bodies to YandexBot and Applebot. Honoring the advertised tokens and falling back to gzip or identity keeps every crawler served.

Verified crawler probe

Probe data from verified crawler traffic (November 2026 snapshot) shows which bots send Accept-Encoding when requesting pages. Yes marks the header on at least nine of ten sampled requests from the bot, Sometimes marks a smaller share, and No marks absence.

Crawler Sends Accept-Encoding Observed tokens
Amazonbot Yes gzip, deflate
Applebot Yes gzip, identity
Baiduspider Yes gzip
Bingbot Yes gzip, deflate, br
ClaudeBot Yes gzip, br, zstd, deflate
DuckDuckBot Yes gzip
GPTBot Yes gzip, br, deflate
Googlebot Yes gzip, deflate, br
Googlebot (smartphone) Yes gzip, deflate, br
Googlebot-Image Yes gzip, deflate, br
Meta-ExternalAgent Yes gzip, deflate, zstd
Meta-WebIndexer Yes gzip
OAI-SearchBot Yes gzip, deflate, br
PerplexityBot Sometimes gzip
SeznamBot Yes gzip, deflate
YandexBot Yes identity
YandexFavicons Yes gzip, deflate

See also

Last updated: November 3, 2026