Brotli is a compression algorithm designed for web data, combining dictionary and entropy coding to improve compression ratios.
Brotli emerged in the early part of the last decade as a lossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka at Google, with initial development starting in 2013 and the specification completed between 2013–2016[1]. Designed specifically to reduce the size of web assets such as fonts and HTTP content, Brotli combines multiple compression techniques including an advanced variant of LZ77, Huffman coding, and second-order context modelling to deliver superior compression ratios compared to its predecessor gzip.
The name "Brotli" traces its etymology to Swiss German, named after "Brötli," meaning a bread roll, a nod to Google's earlier project "zopfli," itself named after a braided bread[1]. This cultural reference underscores the algorithm's intent: compacting data into small, efficient units much like bread rolls are small but substantial.
Google's Brotli specification underwent significant refinement during its initial years. In September 2015, it was generalized for HTTP stream compression under the content encoding type "br"[1]. This release included pivotal enhancements like a predefined dictionary containing frequently used words and phrases, which enabled more effective compression for typical web content by reducing redundancy without increasing complexity.
The Internet Engineering Task Force formalized this work with the approval of RFC 7932 in July 2016, cementing Brotli as an informational standard for compressed data formats[1]. The compression format became integral to the second iteration of the Web Open Font Format (WOFF2), recognized by a Technology & Engineering Emmy Award in 2021 for standardizing font technology at W3C[1].
Brotli’s architecture improves over Deflate through several algorithmic innovations:
- Use of context models that dynamically adapt based on literals and copy distances.
- Encoding copy distances relative to past distances rather than absolute values.
- Application of move-to-front queues in entropy code selection.
- Joint entropy coding of literal and copy lengths.
- Integration of graph algorithms for optimal block splitting.
These improvements allow Brotli to compress more aggressively without compromising decompression speed or resource consumption[1].
A key differentiator is Brotli’s use of a predefined dictionary \(120\ \mathrm{KiB}\) in size containing more than 13,000 common substrings drawn from extensive corpora of text and HTML documents[1]. This dictionary complements the traditional sliding window dictionary limited to \(16\ \mathrm{MiB}\), enabling efficient compression especially for small files or those rich in common language patterns.
The fixed sliding window size balances performance with memory constraints, ensuring compatibility with resource-limited devices like mobile phones while maintaining reasonable decoding speed[1]. Larger window sizes can improve compression for bigger files but fall outside RFC 7932 compatibility.
Comparisons between Brotli and gzip reveal tangible benefits across common web asset types. JavaScript files compressed with Brotli are roughly 15% smaller, HTML files about 20% smaller, and CSS files approximately 16% smaller than their gzip counterparts[1][3]. Such reductions translate directly into faster page loads and reduced bandwidth consumption.
Compression levels play a crucial role in balancing file size against CPU usage during encoding. Brotli supports up to compression level 11, while gzip’s maximum is level 9[3]. Tests using large plaintext datasets such as "The Complete Works of William Shakespeare" demonstrate that at gzip’s top level (9), Brotli already achieves about 15% better compression ratios[3]. Increasing Brotli’s quality settings to levels 10 or 11 yields an additional savings between 5–8%, albeit at considerable computational cost: encoding times jump from under one second at lower levels up to nearly four seconds at level ten and eight seconds at level eleven on typical modern hardware setups such as an Intel i7 with SSD storage[3].
This performance trade-off makes it essential for deployment environments to consider whether the incremental savings justify increased CPU load during asset preparation, especially under high request volumes or continuous integration pipelines.
Browser support solidified rapidly after the public introduction of Brotli:
* Mozilla Firefox included support starting with version 44, released on 26 January 2016.
* Google Chrome enabled it from version 50, available since 20 April 2016.
* Opera supported it beginning with version 38, dated 8 June 2016.
* Microsoft Edge adopted it at version 15, released on 5 April 2017.
* Safari incorporated support from version 11, available since 5 October 2017.
* cURL added compile-time support via libbrotli as of version 7.57, released on 29 November 2017[1].
Server-side adoption followed suit with modules enabling brotli compression becoming available across major platforms:
* Apache HTTP Server supports brotli through mod_brotli starting from version 2.4.26.
* Microsoft IIS gained Brotli support via extensions from May 2018 onward.
* Microsoft Azure Front Door integrated dynamic edge compression using Brotli beginning on April 17, 2019.
* nginx includes Google's ngx_brotli module since December 2016.
* Node.js offers native encoding/decoding capabilities since version 11.7.0.
* Amazon CloudFront supports automatic edge-based brotli compression as of September 2020.
* LiteSpeed Web Server incorporated static file brotli support starting with version 5.2 in July 2017.
* Caddy server has served statically compressed .br files since version 0.9.4 from December 21, 2016.
* lighttpd mod_deflate added .br support starting with version 1.4.56 from November 2020.
Additional tools like PeaZip and extensions for archivers such as 7zip-zstd also provide brotli integration for compression and extraction workflows[1].
Despite this broad ecosystem integration, some tooling challenges remain due to the lack of a magic number identifying .br streams, complicating detection for raw stream handling utilities like libarchive[1].
Dropbox reimplemented Brotli in Rust in 2016 aiming for improved security properties against potentially malicious clients interacting over networked systems[1]. Rust’s memory safety features help mitigate vulnerabilities inherent in C/C++ implementations without sacrificing performance.
Brotli represents a substantive evolution beyond gzip’s longstanding dominance in web content compression by combining advanced coding techniques with pragmatic constraints tailored to modern web asset profiles and device capabilities. Its adoption by major browsers and servers attests to its effectiveness in reducing bandwidth usage while accelerating page loading times.
Operationally, careful consideration must be given when employing highest-level compressions due to increased CPU overheads during encoding phases; however, these costs are often outweighed by transmission savings over millions of requests.
As web performance remains critical across diverse devices globally, Brotli's combination of algorithmic sophistication, practical implementation choices like dictionary use and window sizing, plus wide industry backing make it a cornerstone technology for efficient internet data delivery today.
Generating summary…