One of the most common speed recommendations is to compress files. Compression is about making files smaller. That way, the server has to send less data to the browser when loading a website. How does compression work? What do you need to know about compression techniques?
Let’s start with how compression works…
- Identifying Repetition: Compression algorithms look for repetitive data. If a chunk of data is found multiple times, the algorithm can store it just once and then reference it whenever it’s repeated. By removing repetitive data, files shrink considerably.
- Reducing Details: For things like images or videos, compression can slightly reduce quality to achieve smaller file sizes. It’s like trimming the edges off a piece of paper to make it fit into a smaller envelope. If done correctly, this reduction is often imperceptible to human eyes or ears. If any data is lost during compression, the compression is referred to as “Lossy”.
- Compact Encoding: Some compression tools use more efficient ways to represent data. Instead of using the full representation, they use shortcuts. It’s not cutting corners; it’s just being smarter about how data is stored.
The two main types of compression used for non-image content are Gzip or Brotli.
Gzip has been around for 30 years and is widely supported by servers and browsers. Gzip works by identifying repetitive strings and replacing them with shorter references. Gzip is lossless, so no data will be lost due to Gzip compression.
Brotli was introduced by Google in 2015 and offers more efficient compression, particularly for text-based assets. It builds on Gzip but also has additional ways of encoding text and more effectively predicts patterns in the data.
Brotli tends to compress files more effectively, resulting in faster speeds. However, Brotli can result in more overhead and isn’t supported by all hosting companies (though this is fast changing).
To check if your website is compressed and how much the compression is reducing your website’s file size, you can use a tool like GiftOfSpeed’s Gzip/Brotli test. In this example, the original, uncompressed size of the page was 32.61KB. With Brotli compression, this was reduced to 6.71KB instead.

Are your website files compressed? If so, how much is compressing files helping your website?