{{HTTPSidebar}}
The Accept-Encoding
request HTTP header advertizes which content encoding, usually a compression algorithm, the client is able to understand. Using content negotiation, the server then selects one of the proposal, use it and inform the client of its choice with the {{HTTPHeader("Content-Encoding")}} response header.
Header type | {{Glossary("Request header")}} |
---|---|
{{Glossary("Forbidden header name")}} | no |
Syntax
Accept-Encoding: <content_encoding> Accept-Encoding: <content_encoding>, <content_encoding>
Directives
- <content_encoding>
- A list of content encoding algorithms, usually compression algorithms. Their order of preference is expressed using relative quality factor called the weight. The possible algorithms are:
Algorithm Description gzip
A compression format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC. compress
A compression format using the Lempel-Ziv-Welch (LZW) algorithm. deflate
A compression format using the zlib structure, with the deflate compression algorithm. br
A compression format using the Brotli algorithm. identity
Indicates the identity function (i.e. no compression, nor modification). This is the default value if the header is not present. *
Matches any content encoding not already listed in the header
Examples
Accept-Encoding: gzip Accept-Encoding: gzip, compress, br Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1
Specifications
Specification | Title |
---|---|
{{RFC("7232", "Accept-Encoding", "5.3.4")}} | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Context |
Browser compatibility
The compatibility table in this page is generated from structured data. If you’d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data/README.md and send us a pull request.
{{Compat}}
See also
- HTTP content negotiation
- Header with the result of the content negotiation: {{HTTPHeader("Content-Encoding")}}
- Other similar headers: {{HTTPHeader("TE")}}, {{HTTPHeader("Accept")}}, {{HTTPHeader("Accept-Charset")}}, {{HTTPHeader("Accept-Language")}}