The search to offer a better user experience has led to the development of new technologies to improve speed and maximize web performance. A clear example of this is Brotli.
Until relatively recently, when we talked about a web compression system, the first thing that came to mind was GZIP. This situation has changed a lot, and it is time to give way to its worthy successor: Brotli.
If you don’t know what I’m talking about, don’t worry. In this article, I will explain what Brotli is, the advantages of this compression system, and how it can improve your web performance.
What is Brotli?
Brotli is an open-source data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka from Google, under the MIT license. This compression system generates no data loss using a combination of LZ77 and Huffman encoding.
Although its initial development was launched in 2015 and was intended for web typography, Brotli has been partially rewritten to improve its compression and decompression levels and encompass other types of data such as images, HTML documents, CSS, scripts, etc.
Brotli is considered to be the most powerful web compression system, offering improvements of up to 26% over more conventional compression systems such as Deflate, GZIP, or Zopfli developed by Google.
Brotli vs GZIP. Which one is Better?
Brotli and GZIP are two algorithms or systems that handle data compression. The smaller the volume of data used, the faster the data will be transmitted over the Internet. To measure the efficiency of one or the other compression system, the following two variables must always be considered:
– Compression capacity: that is, by how much we can reduce the size of a file.
– Compression speed: the speed at which a file is compressed and decompressed.
Therefore, although the goals of Brotli and GZIP are the same (reduce data size and increase speed), the difference lies in how they compress this data and how efficient the technology used is.
Brotli uses a predefined 120 kilobyte dictionary with 13,000 common words, phrases, and text and HTML strings with 11 levels of compression, while GZIP has 9 levels. With this tool, you can estimate how each of these two systems compresses data.
Brotli vs GZIP compression
For the same domain, the results of these two technologies are different. Broadly speaking we can say that Brotli offers better compression levels than GZIP, but let’s go a little deeper into this.
Brotli vs GZIP performance
There are many studies published about Brotli vs GZIP to see which of these two systems offer better performance levels. In this example, we are going to show you the results of the analysis performed by Akamai in which it collects a sample of 1000 URLs using both compression technologies.
– In HTML Brotli saves 21% more space than GZIP.
– In CSS code the savings is 17%.
In general terms, GZIP can reduce data up to 78%, but Brotli’s average is 82%. However, as we said before, what is important is not the only compression, but also speed.
In terms of speed, GZIP can obtain better results than Brotli in some compression levels. This makes us think that Brotli may be more suitable for compressing static data due to its higher compression capacity than GZIP, while the latter would be suitable for dynamic files since at certain levels it plays with higher speed.
However, as Akamai points out, this only happens in some levels of GZIP, and taking into account the 11 levels that Brotli has and that the data saving is much higher, it concludes that the capacity-speed ratio of the latter is higher, being able to offer better results.
Can I use Brotli on my website?
After seeing the results of Brotli vs GZIP you may want to know how to use Brotli on your web pages.
Unfortunately, many servers still do not incorporate this functionality and continue working with GZIP, which is also one of the best alternatives at the moment. Check our hosting plans and get a fast and easy-to-manage hosting service. Currently, the most used browsers (Google Chrome, Firefox, Opera, Safari…) already support Brotli.
I hope this article has helped you to get to know this new player, Brotli. We will see how he develops in the coming months.