brotli
Compress or decompress data using Brotli
TLDR
Compress a file, creating a compressed version next to the file
Decompress a file, creating an uncompressed version next to the file
Compress a file specifying the output filename
Decompress a Brotli file specifying the output filename
Specify the compression quality (1=fastest (worst), 11=slowest (best))
SYNOPSIS
brotli [OPTION]... [files]...
PARAMETERS
-c, --stdout
write to standard output, don't delete input files
-d, --decompress
decompress input files
-f, --force
overwrite existing output files
-h, --help
display this help and exit
-k, --keep
keep input files (default for -d)
-l, --small-window
use small sliding window (20-24 bits)
-m, --large-window
use large sliding window (24-30 bits)
-n, --no-copy-stat
don't copy input file(s) stat to output file(s)
-o, --output=FILE
output to FILE (only 1 input file allowed)
-q N, --quality=N
compression level from 0 to 11 (default 11)
-v, --verbose
verbose mode (show extra information)
-Z, --best
alias for -q 11 (highest compression)
-z, --compress
alias for no -d (compress)
DESCRIPTION
Brotli is a generic-purpose lossless compression algorithm and tool developed by Google, optimized for speed and compression density, particularly for web content over HTTP. It surpasses gzip and deflate in compression ratio while maintaining competitive decompression speeds.
The brotli command compresses or decompresses files using quality levels from 0 (fastest, lowest ratio) to 11 (slowest, highest ratio). It supports streaming output to stdout, dictionary files for better compression on similar data sets, and advanced features like large-window modes for huge files. Output files typically use .br extension.
Ideal for archiving, reducing bandwidth in web serving, and storage optimization. Decompression is very fast, making it suitable for latency-sensitive applications. The tool preserves file permissions and timestamps by default (unless overridden).
CAVEATS
High quality levels (9-11) are CPU-intensive and slow on large files.
Does not support multi-threading natively; use pbrotli for parallel compression.
Limited window sizes may underperform on very repetitive or huge data.
EXAMPLES
brotli file.txt → creates file.txt.br
brotli -d -c file.txt.br → decompress to stdout
brotli -q 6 -o out.br input.txt → compress at quality 6
QUALITY TRADE-OFFS
0-2: fast, poor ratio.
3-5: balanced speed/ratio.
6-8: good for web.
9-11: max ratio, slow.
HISTORY
Developed by Google engineers starting 2013, publicly released June 2016 as open-source (MIT license). Command-line tool from official C reference implementation, widely adopted in browsers (Chrome, Firefox) and servers (nginx, Apache) for .br content encoding.


