HTTP Compression



According to RFC 2616, Internet HTTP Compression is a method to send, from the Web server, an HTTP response message in compressed format to a requesting Web browser.

This technology assumes that the Web server is capable of encoding the outbound content and the Web browser is capable of (automatically) decoding the received content.

HTTP Compression saves transfer data volume and speeds ups Web page load time. This short overview discusses various aspects of HTTP compression, suggest proven solutions, and gives hints to further reading.

Table of Contents

  1. About HTTP Compression
  2. HTTP request flow
    1. Client sends request to server
    2. Servers sends compressed response to client
  3. Compression formats
    1. deflate
    2. gzip
  4. Web server support
  5. Web browser support
  6. Web Resources
    1. Standards
    2. Articles
    3. Software
    4. Hardware

About HTTP Compression

HTTP Compression is a publicy defined way to compress content (mostly textual) transferred from Web servers across the world wide Web to browsers. The impact of compression is that the number of transmitted bytes is reduced and thus a higher performance is gained. HTTP Compression uses public domain compression algorithms to encode HTML, XML, JavaScript, CSS and other file formats at the server-side. This standards-based method of delivering compressed content is built into HTTP/1.1, and all modern Web browsers support the HTTP/1.1 protocol, i.e. they can decode compressed files automatically at the client-side. This means, in particular, that no additional software or user interaction on the client-side is required.

More information on HTTP:

HTTP request flow

Client sends request to server

When a Web browser loads a Web page, it opens a connection to the Web server and sends an HTTP request to the Web server. A typical HTTP request looks like this:

GET /index.html HTTP/1.1
Accept-Encoding: gzip
User-Agent: Firefox/5.0

With this request, the Web browsers asks for the object "/index.html" on host "". The browser identifies itself as "Firefox/5.0" and claims that it can understand HTTP responses in gzip format.

Server sends compressed response to client

After parsing and processing the client's request, the Web server may send the HTTP response in compressed format. Then a typical HTTP response looks like this:

HTTP/1.1 200 OK
Server: Apache
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 12345


With this response, the Web server tells the browser with status code 200 that he could fulfil the request. In the next line, the Web server identifies itself as Apache. The line "Content-Type" says that it's an HTML document. The response header "Content-Encoding" informs the browser that the following data is compressed with gzip. Finally, the length of the compressed data is stated.

Compression formats


More information:


More information:

Web server support

As of 2011, all common Web servers support HTTP compression.

Web browser support

As of 2011, all common Web browsers support HTTP compression.

Web resources


Books and Articles



Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Last update: 2011-08-12.