Skip to content
Related Articles
Open in App
Not now

Related Articles

HTTP headers | Accept-Encoding

Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 23 Oct, 2019
Improve Article
Save Article
Like Article

The HTTP headers Accepts-Encoding is usually a comparison algorithm of request header. All the HTTP client used to tell the server which encoding or encoding it supports. Then the server will respond in any of the supporting encoding formats. The server selects any one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header.

Syntax:

Accept-Encoding: gzip | compress | deflate | br| identity| *

Note: Multiple algorithm are also can be applicable.

Directives:

  • gzip: It is a compression format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC.
  • compress: It is a compression format using the Lempel-Ziv-Welch (LZW) algorithm.
  • deflate: It is a compression format using the zlib structure, with the deflate compression algorithm.
  • br: It is a compression format using the Brotli algorithm.
  • identity: This directive Indicates the identity function which is always acceptable.
  • *: This directive matches any content encoding which can be listed in the header or not. It is the default value.

You can check how good your Accept-Encoding and Content-Encoding is working on this site.
Example:

Accept-Encoding: gzip, deflate, br
Accept-Encoding: br;q=1.0, gzip;q=0.6, *;q=0.1

To check this Accept-Encoding in action go to Inspect Element -> Network check the request header for Accept-Encoding like below, Accept-Encoding is highlighted you can see.

Supported Browsers: The browsers compatible with HTTP headers Accept-Encoding are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!