ArticleslgStudy

computer science

Brotli

Brotli is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Brotli rather than just read about it. In short: Brotli ( BROT-lee; from Alemannic German: Brötli [ˈb̥røːtli]) is a lossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd-order context modelling.

Brotli — main illustration
Brotli — illustration

Key takeaways

  • Brotli belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Brotli to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Brotli from memory before moving on to harder problems.

Reference excerpt

Brotli ( BROT-lee; from Alemannic German: Brötli [ˈb̥røːtli]) is a lossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding 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. As successor to gzip, it is supported by all major web browsers and has become increasingly popular, as it provides better compression than gzip.

Name While Google's zopfli implementation of the deflate compression algorithm is named after Zöpfli, the Swiss German diminutive word for Zopf (braided buttery bread, Zöpfli is its snack-sized variant), brotli is named after Brötli, the Swiss German diminutive word for Brot (bread), a general term for bread rolls.

History Google employees Jyrki Alakuijala and Zoltán Szabadka developed Brotli in 2013 to decrease the size of Web Open Font Format (WOFF) files. Alakuijala and Szabadka completed the Brotli specification during 2013–2016. 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 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, 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 approved the Brotli compressed data format specification as an informational request for comment (RFC 7932) 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 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. However, with the exception of Pale Moon and Basilisk, web browsers will only accept Brotli-compressed content over HTTPS by default. In 2016 Dropbox reimplemented Brotli in Rust 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).

Implementations Google's own implementation of the Brotli specification was released under the terms of the permissive free software MIT license in 2016. A formal validation of the Brotli specification was independently implemented by Mark Adler, one of the co-authors of the zlib/gzip compression format and library. Adler's implementation was released under the terms of the similarly permissive Apache License. Other implementations of the specification also exist, including one in the source-to-source Haxe 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 brotli similar to gzip, 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

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Brotli

Start with the simplest possible case. Write down what Brotli claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Brotli before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Brotli ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Brotli

In research
Brotli appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Brotli in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Brotli is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data compression, Free computer libraries, Lossless compression algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Brotli outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Brotli” →

How to study Brotli in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Brotli means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Brotli out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Brotli in simple terms?

Brotli ( BROT-lee; from Alemannic German: Brötli [ˈb̥røːtli]) is a lossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd-order context modelling.

Why does Brotli matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Brotli?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Brotli.

Tags

  • Data compression
  • Free computer libraries
  • Lossless compression algorithms

Keep exploring