Tip: Hover over nodes to see the path from root. Click on a character node to highlight it in the frequency table.
| Character | Frequency |
|---|
| Character | Code | Bits |
|---|
Average bits per character: 0.00
Huffman coding is a lossless data compression algorithm that assigns variable-length codes to characters based on their frequencies. More frequent characters get shorter codes, while less frequent ones get longer codes.
The algorithm builds a binary tree (the Huffman tree) where each leaf node represents a character. The path from the root to a leaf defines the binary code for that character. Left branches are labeled with 0, and right branches with 1.