View Source Math ↗

HRVSTCompress

lossless Huffman + LZW laboratory · everything runs locally in this file

Input

Type or paste text, or load a sample dataset. All codecs run live on every keystroke (byte-level UTF-8).

Huffman coding

Min-heap priority queue → binary prefix tree → variable-length codes. Leaves carry byte value, printable character and frequency; edges carry the 0/1 bit weights.

Prefix property: no code is a prefix of another, so the bitstream decodes unambiguously left-to-right. Drag to pan · scroll to zoom · double-click to reset.

Code table

Bitstream (per-symbol colors)

LZW dictionary coding

Starts with all 256 single bytes, then learns longer phrases as it scans. Output is a stream of dictionary codes.

Dictionary (learned entries)

Code stream

Information-theory dashboard

Live metrics. Shannon entropy is the theoretical floor: no uniquely-decodable code can beat it on average.

Raw size
–
Huffman size
–
Huffman ratio
–
LZW size (12-bit codes)
–
LZW ratio
–
Shannon limit
–
Huffman avg length
–
Round-trip
–