Brotli is an open-source compression algorithm developed by Google to improve the speed and efficiency of data compression. It was introduced in 2015 and has since been increasingly adopted by web developers and users.
Unlike other compression algorithms, such as Gzip, Brotli is able to achieve a higher degree of compression by using a more advanced compression technique. In many cases, Brotli can produce 20-30% smaller files than Gzip. This results in smaller file sizes and faster load times for Web pages and other data compressed with Brotli.
Brotli is also more efficient than other compression algorithms, meaning it requires fewer CPU resources to compress and decompress data. This makes it suitable, for example, for use on servers where limited resources are available.
What files does Brotli compress?
However, it is important to emphasize that not all files will benefit from Brotli compression, some files are already so small or already so compression-efficient that the likelihood of the compression reducing the amount of file size reduction is negligible.
In fact, it is also advisable to be careful when compressing certain file types such as already audio and video files, as these are already compressed with a specific compression algorithm, and further compression may lead to loss of content quality or even degraded performance.
Which browsers support Brotli?
In terms of compatibility, most modern Web browsers support Brotli compression, although some older browsers may not be compatible. Web developers can use Brotli by implementing it on the server where the Web site is hosted, or by using it in conjunction with a content delivery network (CDN).
The most widely used browsers such as Google Chrome, Safari, Firefox and Microsoft Edge support Brotli.
For the comprehensive overview, please visit https://caniuse.com/brotli to see which other browsers support Brotli and how widely these browsers are used.
How do I test if Brolti is enabled for my website?
Both the server and client (browser) must both be Brotli compatible to benefit from the operation.
There are several ways to test whether Brotli is enabled. The easiest is to use websites such as:
Are there any drawbacks?
There are some disadvantages of using Brotli as a compression algorithm:
- Higher CPU load: Brotli requires more computing power to compress data than some other compression algorithms, such as Gzip. This means that using Brotli on servers with limited resources may cause higher CPU usage.
- Longer compression time: Because Brotli uses advanced techniques to compress data, it takes longer to compress data than some other algorithms. This can be a disadvantage in situations where fast processing is required.
- Less compatibility: Although Brotli is gaining support, it is not yet as widespread as some other compression algorithms such as Gzip, so there are still many browsers and servers that do not have support for Brotli. This may cause problems sending or receiving data through these unsupported browsers or servers. There are ways to use Gzip as a fallback, though.
- Limited storage economy: Brotli, as described earlier, is not as compression-efficient for certain types of files, such as already structured or already compressed files like audio and video. This means that compression can sometimes even result in a larger file size rather than a smaller one.
Please note, that using Brotli compression still has many advantages for specific use cases such as reducing file size and reducing loading time for web pages, as it uses less bandwidth and faster download time for the user.
All in all, Brotli offers several distinct advantages over other compression algorithms, including smaller file sizes, faster load times and more efficient compression and decompression processes. It is therefore a popular choice for Web developers looking for ways to improve the performance of their Web sites.
Curious about the full comparison of Brotli, Deflate, Zopfli, LZMA, LZHAM and Bzip2 compression algorithms? then you can read the full paper here.
This paper compares 6 different techniques and based on the results it can be concluded that Brotli can be used as a replacement for the well-known deflate algorithm.
In addition, Brotli is shown to consume less CPU than Zopfli, LZMA, LZHAM and Bzip2.