content

Accept-Encoding

Client advertisement of which content codings it can decode, letting the server compress the response accordingly. Absence means 'identity only'; an explicit identity;q=0 forbids uncompressed responses.

Accept-Encoding: <coding>[;q=<qvalue>][, <coding>...]  (gzip, br, deflate, zstd, identity, *)

Common directives / values

Directive Purpose
gzip Universally supported.
br Brotli — sent by modern browsers over HTTPS.
deflate Legacy zlib deflate.
zstd Zstandard — increasing modern browser support.
identity No compression.
* Any coding not explicitly listed.

Examples

Accept-Encoding: gzip, deflate, br, zstd

Typical modern browser advertisement.

Accept-Encoding: identity

Force uncompressed — useful when debugging with tcpdump or curl.

Accept-Encoding: gzip;q=1.0, br;q=0.9, *;q=0

Explicit preference: gzip over brotli, forbid everything else.

curl -H 'Accept-Encoding: gzip' --compressed https://example.com

Request gzip and auto-decompress with curl.

Gotcha

Servers must always add Vary: Accept-Encoding when responses differ by encoding — otherwise a CDN can hand a gzipped body to a client that didn't ask for one. 'identity;q=0, *;q=0' means the client accepts NOTHING and the server should return 406.

Related headers

← All HTTP headers · HTTP status codes · Fix CORS errors