Huffman Encoding Visualizer

Original size:88 bits
Compressed size:0 bits
Space saved:100.00%

Huffman Tree

Character Node
Internal Node

Tip: Hover over nodes to see the path from root. Click on a character node to highlight it in the frequency table.

Character Frequencies

CharacterFrequency

Huffman Codes

CharacterCodeBits

Average bits per character: 0.00

How Huffman Encoding Works

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.