files/en-us/web/http/reference/headers/accept-encoding/index.md
The HTTP Accept-Encoding {{glossary("request header", "request")}} and {{glossary("response header")}} indicates the content encoding (usually a compression algorithm) that the sender can understand.
In requests, the server uses content negotiation to select one of the encoding proposals from the client and informs the client of that choice with the {{HTTPHeader("Content-Encoding")}} response header.
In responses, it provides information about which content encodings the server can understand in messages to the requested resource, so that the encoding can be used in subsequent requests to the resource.
For example, Accept-Encoding is included in a {{HTTPStatus("415", "415 Unsupported Media Type")}} response if a request to a resource (e.g., {{HTTPMethod("PUT")}}) used an unsupported encoding.
Even if both the client and the server support the same compression algorithms, the server may choose not to compress the body of a response if the identity value is also acceptable.
This happens in two common cases:
As long as the identity;q=0 or *;q=0 directives do not explicitly forbid the identity value that means no encoding, the server must never return a {{HTTPStatus("406", "406 Not Acceptable")}} error.
<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>{{Glossary("Request header")}}, {{Glossary("Response header")}}</td> </tr> <tr> <th scope="row">{{Glossary("Forbidden request header")}}</th> <td>Yes</td> </tr> </tbody> </table>[!NOTE] IANA maintains a list of official content encodings. The
bzipandbzip2encodings are non-standard, but may be used in some cases, particularly for legacy support.
Accept-Encoding: gzip
Accept-Encoding: compress
Accept-Encoding: deflate
Accept-Encoding: br
Accept-Encoding: zstd
Accept-Encoding: dcb
Accept-Encoding: dcz
Accept-Encoding: identity
Accept-Encoding: *
// Multiple algorithms, weighted with the quality value syntax:
Accept-Encoding: deflate, gzip;q=1.0, *;q=0.5
gzip
compress
deflate
br
zstd
dcb {{experimental_inline}}
dcz {{experimental_inline}}
identity
* (wildcard)
;q= (qvalues weighting)
Browser navigation typically has the following Accept-Encoding request header value:
GET /en-US/ HTTP/2
Host: developer.mozilla.org
Accept-Encoding: gzip, deflate, br, zstd
The following header shows Accept-Encoding preferences using a quality value between 0 (lowest priority) and 1 (highest-priority).
Brotli compression is weighted at 1.0, making br the client's first choice, followed by gzip at 0.8 priority, and then any other content encoding at 0.1:
Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1
{{Specifications}}
{{Compat}}