GZIP is a bandwidth optimization tool that compresses data before delivering it over the web. Used mostly on code and text files, GZIP can reduce the size of JavaScript, CSS and HTML files by up to 90%.

Graphic for gzip compression by MaxCDN.


Despite the proliferation of high-speed Internet, bandwidth usage is a huge concern for service providers and end users. For large web services, having to deliver hundreds or even thousands of large files can have a big impact on performance.

Compression helps resolve this issue by reducing the file size of the content before it leaves the server. GZIP, the most popular compression method, is used by web servers and web browsers to seamlessly compress and decompress content as it’s transmitted.

How GZIP Works

GZIP acts as both a file format and an application.

  1. When a server receives a request for a web page, the server checks the header of the request to determine if the browser supports GZIP.
  2. If so, the server generates the markup for the page before applying GZIP.
  3. GZIP converts the markup into a compressed data stream, which is then delivered to the end user.
  4. When the end user receives the compressed stream, their browser decompress it.

Most modern web browsers support GZIP decompression and will include this as part of their request header. The compressed stream is decompressed to the original markup, which is then rendered to the user’s browser.GZIP can also be used to compress files before they’re requested.

In most cases, GZIP compression is performed on-the-fly, which makes it easier for dynamic websites to deliver realtime content at the expense of higher resource usage. Since this content frequently changes, it would be a waste to compress it before it’s needed. For static content, however, files can be compressed in advanced, allowing service providers to benefit from lower bandwidth costs without the additional overhead of ongoing compression.

How Compression Levels Affect Resource Usage

Compression is a CPU-dependent process, with higher compression levels resulting in smaller files at the expense of CPU. Enterprises can choose how much to compress – as well as what to compress – based on the needs of their web service. Some providers may choose to only compress HTML, while other providers may choose to compress everything.

Example of GZIP

A 2009 study shows the drastic impact compression can have on some of the world’s top websites. For Facebook, enabling compression reduced the page load time by an average of 9.4 seconds, or 414%. A savings of 350 KB may not seem like much in today’s data driven world, but when aggregated across all of Facebook’s users it makes for a substantial improvement.

A post by Google shows an average compression ratio of 77% for some of the most popular JavaScript libraries and CSS frameworks. While Google itself enjoys a modest 10.3 KB (or 44%) savings from compressing its homepage, some CSS frameworks experience savings of up to 88%. Combined with minification and other data reduction techniques, compression can drastically reduce the size of some of the web’s most widely used libraries.

Benefits of GZIP

GZIP is a key strategy for delivering content faster while reducing network traffic.

  • Enterprises experience lower bandwidth costs since smaller files are being sent over the network. A slight bump in CPU use could lead to a big drop in bandwidth usage.
  • Users experience faster page load times as less data is transferred to and from their devices. Now wsers with data caps are able to stretch their monthly allowance even further.


Over the past 10 years, the average web page has grown in size by almost 1.2 MB. As our demand for information increases, techniques for quickly and efficiently delivering large amounts of data are becoming more and more relevant.

When a 100ms increase in load time can reduce your sales by 1%, it’s vital to make web services as efficient as possible. GZIP compression can add a profitable speed boost any web service.