Skip to content

Brotli

A lossless compression format and reference library that shrinks data more than deflate at similar speed.

Stars
15.1k
Forks
1.4k
Licence
MIT
Language
TypeScript
Last update
9 days ago
Type
Library

What it is

Brotli is a general-purpose lossless compression algorithm, defined in RFC 7932, that makes data smaller without losing any of it. The project provides the reference implementation and format spec. The README says it compresses comparably to the best general-purpose methods and is similar in speed to deflate while producing denser output.

  • Compress text or web assets with the Brotli encoder and decompress them with a matching decoder
  • Install the Python brotli module with pip and compress or decompress data in scripts
  • Build the library from source with CMake and link it into a C or C++ project
  • Install brotli on Linux or macOS through a system package manager such as apt or Homebrew

Great for

  • Developers who want smaller compressed files or web payloads than deflate offers
  • People building tools that need a standardized, MIT-licensed compression format
  • Engineers who use Python and want to install the brotli module with pip
  • Maintainers who need a C build via CMake for embedding compression

Not ideal for

  • People who only need to unzip files: the README does not describe a end-user archiving tool, and most people will use existing apps for that
  • Anyone who needs built-in checksums or length metadata, since the README notes Brotli streams contain none and corruption in raw ranges may go unnoticed
Step-by-step guide: how to use BrotliInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python (for the pip module) · CMake (for building from source)

    Install the Python module

    pip install brotli

    Install on Debian-based Linux

    apt install brotli

    Install on macOS with Homebrew

    brew install brotli
  2. 2

    Run it

    • Install the Python module with pip install brotli, or the brotli package from your system package manager
    • Import the brotli module in Python and call its compress and decompress functions on a byte string
    • Check the round trip by confirming the decompressed output matches the original input
  3. 3

    Get the most out of it

    • Use the tip-of-the-tree Python build from git if you need unreleased changes, per the README
    • Read the Python readme linked in the README for source installs, development, and testing
    • Consult the Squash and Large Text benchmarks linked in the README to compare Brotli against other methods on your data
    • Use the CMake options listed in the README (such as build type and install prefix) to customize a build

Downloads

Strengths

  • Based on a public standard (RFC 7932) with an MIT license
  • The README reports compression ratios comparable to top general-purpose methods
  • Available through many package managers and language ports, per the README

Trade-offs

  • The README warns the format has no checksums or length data, so integrity checks must be added separately
  • Several related decoders and ports are third-party projects that the authors do not vouch for
  • The README is truncated and gives little detail on API usage

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.