devkult_
tools29converters34
home/headers/accept-encoding

Accept-Encoding

request headercontent

Lists the compression formats the client can decompress, so the server can pick one.

Accept-Encoding is the request half of compression negotiation. The server picks one of the listed encodings, compresses the body and labels it with Content-Encoding — or sends it uncompressed if nothing matches.

Syntax

Accept-Encoding: <encoding>[;q=<weight>], …

Defined in RFC 9110 §12.5.3 — Accept-Encoding.

Examples

Accept-Encoding: gzip, deflate, br, zstd

what current browsers send

Accept-Encoding: identity

no compression, please

Good to know

  • Browsers only advertise br and zstd over HTTPS.
  • curl sends no Accept-Encoding by default; curl --compressed adds one and decompresses the result.

Who sets Accept-Encoding

Browsers and most HTTP clients send Accept-Encoding and decompress responses for you. To test compression, set it explicitly: curl -sI -H "Accept-Encoding: br, gzip" https://example.com/.

Check it

In the browser, open DevTools → Network, pick a request and look under Request Headers. From the command line, curl's verbose mode prints every header it sends, prefixed with >:

curl -sv https://example.com/ -o /dev/null 2>&1 | grep '^>'

Frequently asked questions

Do I need to set Accept-Encoding in fetch?

No — browsers and Node.js's fetch set it themselves and decompress transparently. In browsers it's a forbidden header that scripts can't change.

Related headers