Brotli is a
lossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka. It uses a combination of the general-purpose
LZ77
LZ77 and LZ78 are the two lossless data compression algorithms published in papers by Abraham Lempel and Jacob Ziv in 1977 and 1978.
They are also known as Lempel-Ziv 1 (LZ1) and Lempel-Ziv 2 (LZ2) respectively. These two algorithms form the basis ...
lossless compression algorithm,
Huffman coding
In computer science and information theory, a Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. The process of finding or using such a code is Huffman coding, an algorithm developed by ...
and 2nd-order
context modelling.
Brotli is primarily used by
web servers and
content delivery networks to
compress HTTP content, making internet websites load faster. A successor to
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
, it is supported by all major web browsers and has become increasingly popular, as it provides better compression than gzip.
History
Google employees
Jyrki Alakuijala and Zoltán Szabadka initially developed Brotli in 2013 to decrease the size of transmissions of
WOFF web font. Alakuijala and Szabadka completed the Brotli specification during 20132016. The specification was accompanied with a reference implementation developed by two additional authors, Evgenii Kliuchnikov and Lode Vandevenne, who had previously developed Google's
zopfli implementation of
deflate and
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
compatible compression in 2013.
[.] Unlike zopfli, which was a reimplementation of an existing data format specification, Brotli was a new data format and allowed the authors to improve compression ratios even further.
The Brotli specification was generalized in September 2015 for HTTP stream compression (content-encoding type "br"). This generalized iteration also improved the compression ratio by using a predefined dictionary of frequently used words and phrases. The version of Brotli released in September 2015 by the Google software engineers contained enhancements in generic
lossless data compression
Lossless compression is a class of data compression that allows the original data to be perfectly reconstructed from the compressed data with no loss of information. Lossless compression is possible because most real-world data exhibits Redundanc ...
, with particular emphasis on use for
HTTP compression. The encoder was partly rewritten, with the result that the compression ratio improved, both the encoder and the decoder have been sped up, the streaming API was improved, and more compression quality levels have been added. Additionally, the new release shows performance improvements across platforms, with decoding memory reduction.
The
Internet Engineering Task Force
The Internet Engineering Task Force (IETF) is a standards organization for the Internet standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
approved the Brotli compressed data format specification as an informational
request for comment () in July 2016.
[.] The Brotli data format is an integral part of the 2nd iteration of the
Web Open Font Format,
which was recognized in a 2021 Technology & Engineering Emmy Award from the
National Academy of Television Arts & Sciences
The National Academy of Television Arts and Sciences (NATAS), also known as the National Television Academy until 2007, is an American professional service organization founded in 1955 for "the advancement of the arts and sciences of televisio ...
for font technology standardization at W3C.
Brotli support has been added over the years to web browsers, with 96% of worldwide users using a browser that supports the format, as of July 2022.
In 2016
Dropbox
Dropbox is a file hosting service operated by the American company Dropbox, Inc., headquartered in San Francisco, California, that offers cloud storage, file synchronization, personal cloud, and Client (computing), client software. Dropbox w ...
reimplemented Brotli in
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
to fulfill their requirement to be more secure against a malicious client.
Algorithm
Brotli's new file format allows its authors to improve upon Deflate by several algorithmic and format-level improvements: the use of context models for literals and copy distances, describing copy distances through past distances, use of move-to-front queue in entropy code selection, joint-entropy coding of literal and copy lengths, the use of graph algorithms in block splitting, and a larger backward reference window are example improvements.
Unlike most general-purpose compression algorithms, Brotli uses a predefined dictionary, roughly 120 KiB in size, in addition to the dynamically populated ("sliding window") dictionary. The predefined dictionary contains over 13000 common words, phrases and other substrings derived from a large
corpus of text and HTML documents.
Using a predefined dictionary has been shown to increase compression where a file mostly contains commonly used words.
Brotli's sliding window is limited to 16
MiB. This enables decoding on mobile phones with limited resources, but makes Brotli underperform on compression benchmarks having larger files. The constraints of the small window size can be alleviated by using ''Large Window Brotli'', which is not compatible with RFC 7932 (Brotli proper).
Name
While Google's ''zopfli'' implementation of the deflate compression algorithm is named after Zöpfli, the
Swiss German
Swiss German (Standard German: , ,Because of the many different dialects, and because there is no #Conventions, defined orthography for any of them, many different spellings can be found. and others; ) is any of the Alemannic German, Alemannic ...
word for a snack-sized
braided buttery bread, ''brotli'' is named after Brötli, the Swiss German word for a
bread roll.
[.] Google's own implementation of the Brotli specification was released under the terms of the
permissive free software MIT license
The MIT License is a permissive software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts very few restrictions on reuse and therefore has high license compatibility.
Unl ...
in 2016. A formal validation of the Brotli specification was independently implemented by
Mark Adler,
one of the co-authors of the
zlib
zlib ( or "zeta-lib", ) is a software library used for data compression as well as a data format. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compre ...
/
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
compression format and library. Adler's implementation was released under the terms of the similarly permissive
Apache License
The Apache License is a permissive free software license written by the Apache Software Foundation (ASF). It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute modified versions of the software ...
. Other implementations of the specification also exist, including one in the source-to-source
Haxe
Haxe is a high-level cross-platform programming language and compiler that can produce applications and source code for many different computing platforms from one code-base. It is free and open-source software, released under an MIT License. ...
language.
Applications
Brotli compression is generally used as an alternative to gzip on the web, as Brotli provides better overall compression.
Compared to gzip compression, JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller.
The reference implementation does ship a command-line program similar to , but use in the Unix-like world as a simple compressor is scarce.
Libarchive developers find the raw stream format of
.br
files difficult to support, as there is no
magic number to indicate the file format.
Industry support
Browsers and other clients
*
Mozilla Firefox introduced support for the "br" content-encoding method in version 44 (released on 26 January 2016).
*
Google Chrome
Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
has supported the "br" content-encoding method since version 50 (released on 20 April 2016).
[.]
*
Opera
Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
has supported the "br" content-encoding method since version 38 (released 8 June 2016).
*
Microsoft Edge
Microsoft Edge is a Proprietary Software, proprietary cross-platform software, cross-platform web browser created by Microsoft and based on the Chromium (web browser), Chromium open-source project, superseding Edge Legacy. In Windows 11, Edge ...
has supported the "br" content-encoding method since version 15 (released on 5 April 2017).
*
Safari
A safari (; originally ) is an overland journey to observe wildlife, wild animals, especially in East Africa. The so-called big five game, "Big Five" game animals of Africa – lion, African leopard, leopard, rhinoceros, African elephant, elep ...
has supported the "br" content-encoding method since version 11 (released on 5 October 2017).
*
cURL has a compile-time option to support the "br" content-encoding method using libbrotli as of version 7.57, released on 29 November 2017.
*
7zip is available extended with Brotli by 7zip-zstd.
*
PeaZip supports Brotli .BR format for compression and extraction
Web servers
* For
Apache HTTP Server
The Apache HTTP Server ( ) is a free and open-source software, free and open-source cross-platform web server, released under the terms of Apache License, Apache License 2.0. It is developed and maintained by a community of developers under the ...
, the "br" content-encoding method has been supported by the
mod_brotli' module since version 2.4.26.
*
Microsoft IIS has a supported extension since May 2018 that adds support for the "br" content-encoding method.
*
Microsoft Azure Front Door can dynamically compress content on the edge using Brotli since its launch on April 17, 2019.
*
nginx has a
ngx_brotli' module provided by Google since December 2016.
*
Node.js features a built-in native en- and decoder since version 11.7.0, which can be used to support the "br" content-encoding.
*
Amazon CloudFront can automatically compress cacheable responses at the edge using Brotli, as of September 2020.
*
LiteSpeed Web Server has included the "br" content-encoding method for static files only since version 5.2 in July 2017.
*
Cloudflare CDN offers a brotli option to compress data between its edge node and the user.
*
NaviServerbr>
added supportin version 4.99.17b1
*
Caddy serves statically compressed .br files since version 0.9.4 from December 21, 2016.
*
lighttpd mod_deflate supports .br since 1.4.56
from November 2020.
References
;Notes
:- .
External links
* Brotli reference implementation at
{{Google FOSS
Free computer libraries
Lossless compression algorithms
Data compression