Repolode
google

google/brotli

Brotli is a generic-purpose lossless compression format and reference library, specified in RFC 7932, with compression ratios comparable to top general-purpose methods.

Stars
15,088
Forks
1,395
Open issues
128
Last commit
2 hours ago

What is it?

Brotli is a lossless compression algorithm that combines a modern variant of LZ77, Huffman coding and second-order context modeling. It aims for compression ratios close to the best general-purpose methods while running at speeds similar to deflate, which it is designed to outperform on density.

The format is defined in RFC 7932, and the project provides the reference encoder and decoder code in C. Command-line installation is available through common Linux package managers and Homebrew, and the repository includes CMake and Bazel build setups, plus a Python module installable with pip.

Brotli is a stream format with no built-in checksums or uncompressed length metadata, so corruption of raw ranges in the compressed stream may go undetected by the decoder. Benchmarks for the format are published by third parties such as the Squash Compression Benchmark.

Key features

  • 01Lossless compression based on LZ77, Huffman coding and context modeling
  • 02Format specified in RFC 7932
  • 03Reference C implementation with CMake and Bazel builds
  • 04Python module installable via pip
  • 05Available from common Linux package managers and Homebrew

Use cases

  • Compressing web assets such as HTML, CSS and JavaScript for HTTP transfer
  • Storing data where a higher compression ratio than deflate is needed
  • Adding Brotli compression support to C or Python applications

Quick start

  1. 1

    Install the brotli command-line tool via a package manager (Debian/Ubuntu)

    apt install brotli
  2. 2

    Install the brotli tool on macOS with Homebrew

    brew install brotli
  3. 3

    Install the Python module from PyPI

    pip install brotli

Things to know

  • Brotli is a stream format with no built-in checksums or uncompressed length, so corruption in raw ranges may go undetected.

Topics

#compression#lossless-compression#codec#python#rfc-7932

FAQ

What is brotli?
Brotli is a generic-purpose lossless compression format and reference library, specified in RFC 7932, with compression ratios comparable to top general-purpose methods. Brotli is a lossless compression algorithm that combines a modern variant of LZ77, Huffman coding and second-order context modeling. It aims for compression ratios close to the best general-purpose methods while running at speeds similar to deflate, which it is designed to outperform on density.
Is brotli free to use? What license does it have?
brotli is open source under the MIT license. Check the license terms before using it in commercial products.
Is brotli still maintained?
Actively maintained. The last commit to brotli was on Nov 6, 2026.
What can I use brotli for?
Compressing web assets such as HTML, CSS and JavaScript for HTTP transfer Storing data where a higher compression ratio than deflate is needed Adding Brotli compression support to C or Python applications
How do I install brotli?
Install the brotli command-line tool via a package manager (Debian/Ubuntu): apt install brotli Install the brotli tool on macOS with Homebrew: brew install brotli Install the Python module from PyPI: pip install brotli
Where can I get brotli?
The source code and installation instructions are on GitHub: https://github.com/google/brotli

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects