Accept-Encoding Header Explained

What the HTTP Accept-Encoding header does and when it's used.

Published October 13, 2026

Accept-Encoding tells the server which compression algorithms the client supports, such as gzip, br (Brotli) or zstd.

How it works

The server picks one and responds with Content-Encoding. This can shrink text responses by 70–90%.

The Accept-Encoding header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
Accept-Encoding: gzip, deflate, br
Where Accept-Encoding appears.

Practical examples

The header

Accept-Encoding: gzip, deflate, br

Set or use it in code

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

Inspect it

curl -sI https://example.com | grep -i 'accept-encoding'

Common mistakes

  • Compressing already compressed files like JPEG
  • Missing Vary: Accept-Encoding on cached responses
  • Compression breaking range requests

Key takeaways

  • Accept-Encoding: Accept-Encoding tells the server which compression algorithms the client supports, such as gzip, br (Brotli) or zstd.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

Which is best?

Brotli compresses best for text; gzip is universally supported.

Is Accept-Encoding case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles