Brotli and Zstandard
In short: Brotli and Zstandard (zstd) are modern compression methods that beat gzip in ratio or speed. Brotli is common on the web, zstd for servers and files.
In more detail: Both build on LZ77 and entropy coding but use larger windows, better models and prior knowledge.
In Depth
- Brotli: Developed by Google. Contains a built-in dictionary of common web terms (HTML, CSS, JS). For static files at a high level (up to 11) 15 to 25 % smaller than gzip. High levels are slow to compress, decompression is fast. Browsers send
Accept-Encoding: br. - Zstandard: From Facebook (Yann Collet). Very fast levels and many settings, custom dictionaries for small data, multi-core compression. Popular in Linux packages, file systems (Btrfs, ZFS), databases and backups.
- Choice on the web: Static files precompressed with Brotli 11, dynamic responses rather level 4 to 5 or gzip.
- Security: Compressed responses containing secrets were the target of attacks such as BREACH. See LZ77 and Deflate.
- Zstd in browsers: Increasingly supported (
zstdas content encoding).
See also: HTTP/2