← All headersGeneral header

What is a Content-Encoding header?

Lists the encoding (e.g. gzip, br, deflate) applied to the body, which the receiver must reverse to read it.

Compressing responses with gzip or Brotli via Content-Encoding is one of the cheapest performance wins available to a website, often cutting transfer size by 70% or more for text-heavy pages. A mismatch between what's compressed and what the header claims will render a page as garbled text in the browser, which is why a monitor that actually inspects response bodies - not just status codes - is worth having on anything serving compressed content.

Common use case

A CDN or web server compresses HTML, CSS, and JSON responses with Brotli or gzip on the fly before sending them, based on what the client's Accept-Encoding advertised.

Example

Content-Encoding: br

History

Part of the original HTTP/1.0 specification, RFC 1945 (1996); Brotli support was added later via RFC 7932 (2016).

Did you know?

Brotli, now the fastest-compressing option most browsers support, was originally built by Google for compressing web fonts before being generalised into a full HTTP content encoding.