# Canonical Huffman code

From Just Solve the File Format Problem

A **Canonical Huffman code** is essentially a set of tiebreaking rules that establish a single "canonical" Huffman codebook (see Huffman coding), given the set of encoded symbols and their corresponding code lengths (in bits). The main benefit of using a canonical Huffman code is that it reduces the amount of information needed to represent a Huffman codebook. Specifically, you only need to know that code length of each symbol.

From a file format perspective, the term is normally used with "static" (non-adaptive) Huffman compression schemes in which the Huffman codebook to use is stored in the file prior to the encoded data. Canonical Huffman coding is common, though not universal, in such formats.