> SECTOR_05 // ENCODERS & DECODERS // COMPRESSION_STEPS
Huffman & LZ77 Step by Step
Type any text and watch Huffman coding build its tree merge by merge, then read the code table, the encoded bits, the average code length against the entropy, and decode bits back. Switch to LZ77 to see the window and lookahead move across the text and the (distance, length, character) tokens come out. Everything runs on your device.
LOCAL_PROCESSING // NO_UPLOAD
- Type or paste text, or open a text file. Both methods work on the same text, so you can compare them.
- Huffman: the characters are counted, then the two lightest pieces are joined again and again until one tree is left. Step through the merges, then read each character's code (frequent characters get short codes), the encoded bits, and how the average code length compares with the entropy, the theoretical minimum for this kind of code. Paste bits in the decoder to read them back with the same tree.
- LZ77: a window of already seen characters slides along the text. At each position the longest match is replaced by a token (distance back, length, next character). Change the window and lookahead sizes to see how the tokens change.
- Both results are checked by decoding them again, and can be copied or saved as CSV.