Introduction
Brotli is a compression method from Google, first used inside WOFF2 web fonts and
published for general use in 2015. The format is RFC 7932. Its main job is compressing
web pages, scripts and style sheets in transit: browsers ask for it with
Accept-Encoding: br, and it usually makes text smaller than
gzip does. A .br file is a
Brotli stream saved to disk, most often a file compressed ahead of time, such as
app.js.br, for a web server to send as it is.
Structure
A Brotli stream has no magic number, file name or checksum, so a .br file
can only be recognised by its extension. It is a stream of bits:
0Stream header the window size, from 1 KB to 16 MB1 to 7 bits…Meta-blocks each a header with its length and a last flag, then the compressed datarepeated
Each meta-block combines LZ77 copies of earlier data with Huffman coding chosen by
context, so the code for a byte can depend on the bytes before it. Brotli also has a
built-in dictionary of about 120 KB of common words and phrases from web pages and other
text, which copies can refer to; this is why it does so well on small text files. The
dictionary is exactly 122,784 bytes (CRC-32 5136CB04); the bytes are served as
brotli-dictionary.bin
and described on the commands page. A stream header may also use Google’s
large-window extension.
The stream and meta-blocks and
commands and distances pages give the
details.
Two later extensions are described on their own pages. Shared
dictionaries (RFC 9841) let a stream use LZ77 dictionaries and custom word lists and transforms supplied from
outside, and define a framing format. Over HTTP the dictionary-compressed codings
dcb and dcz (RFC 9842) put a
fixed header with a magic number and the SHA-256 hash of the dictionary in front of a shared brotli (or
Zstandard) stream. They are formats of their own, with their own headers and extensions, so they have their
own pages: .DCB, Dictionary-Compressed Brotli and
.DCZ, Dictionary-Compressed Zstandard.
In the explorer, a file that starts with the framing signature 91 0A 42 52 opens as a framing
container (its chunks, metadata and resources; each resource opens as a decoded file, with the dictionary it
names by pointer), and one that starts with 91 00 as a shared dictionary file (its LZ77
dictionary, word lists, transform lists and maps). Both are recognised by their signatures, because Brotli
itself has none and 0x91 is not a valid first byte for a stream. A plain .br stream
cannot say that it needs a dictionary, so it is always read as RFC 7932.
Not described
Checked against RFC 7932 in the November 2026 re-check, and the large-window extension against the
google/brotli sources read on 2026-11-13. RFC 9841 and RFC 9842 and
google/brotli’s shared_dictionary.c were read on 2026-11-19 for the two newer pages.
Everything in those documents is on the pages; the static dictionary’s bytes are on the site as
brotli-dictionary.bin.
Not part of the format: the reference decoder’s source in RFC 7932 Appendix D is one implementation of the decoding rules, which the RFC’s text defines; the source adds nothing a stream can contain.
Known, not yet covered
- Reference: HighwayHash, the 256-bit hash the framing format names for dictionary references
(RFC 9841 gives only its name and type number, 3, not the algorithm). The Zstandard half of
dczis on the DCZ and Zstandard pages. - Viewer: a framing chunk that continues the previous chunk’s stream (codec 1, “keep decoder”) is not decoded: the decoder cannot be resumed, so that resource stops there and says so.
- Viewer: a framing chunk that names its dictionary by hash cannot be matched: the hash is HighwayHash, which the RFC does not describe. The chunk is read as far as it can be, with its references to the missing dictionary listed. A dictionary supplied from outside the container is not accepted for a hash reference.
- Viewer: a custom static dictionary (word lists, transform lists, context map) and several
prefix dictionaries joined are decoded as RFC 9841 section 3 says, and the LZ77 dictionary was checked
byte for byte against the
brotlitool, but no available encoder writes custom word lists, so those were checked only against streams made by hand. The order in which several prefix dictionaries are joined (the order they are listed in) and the pointer of a dictionary reference (the offset of the chunk in the container) are the readings the RFC’s text allows; the RFC does not give a worked example of either. - Viewer: a plain
.brfile is still recognised only by its extension, and a stream cannot say that it was made with a dictionary: opened alone it is read as RFC 7932, where a reference past the window is a word of the static dictionary. Without a dictionary a stream that needs one gives wrong bytes or an error, not a warning.
Unknown
Nothing in the format itself. Brotli’s own streams have no checksum, so a viewer can say only that a stream is well formed.
Links
Software
- brotli – Google’s command-line tool (macOS, Linux, Windows)
- Web browsers – decode Brotli responses from web servers (all platforms)