Build Huffman trees from text or custom frequencies. Compare fixed bits, encoded bits, and lengths. Export tables, charts, and summaries for quick analysis today.
This classic frequency set is commonly used to demonstrate Huffman coding behavior.
| Symbol | Frequency | Probability | Notes |
|---|---|---|---|
| A | 45 | 0.45 | Most frequent symbol, usually receives a short code. |
| B | 13 | 0.13 | Mid-frequency symbol with moderate bit length. |
| C | 12 | 0.12 | Often grouped with nearby frequencies during merging. |
| D | 16 | 0.16 | May receive a shorter code than B or C. |
| E | 9 | 0.09 | Less frequent symbol with longer code potential. |
| F | 5 | 0.05 | Rare symbol, usually assigned the longest code. |
pi = fi / Σf
Each symbol probability equals its frequency divided by the total frequency or total weight.
H = -Σ pi log2(pi)
Entropy is the theoretical lower bound for average code length in bits.
L = Σ pi li
Multiply each symbol probability by its Huffman code length, then sum the values.
Efficiency = (H / L) × 100
Redundancy = 100 - Efficiency
These metrics show how close the actual code is to the entropy limit.
Fixed bits per symbol = ceil(log2(n))
Fixed total bits = total weight × fixed bits per symbol
Huffman encoded bits = Σ (fi × li)
Savings = Fixed total bits - Huffman encoded bits
It builds prefix-free Huffman codes from text or manual frequency data, then reports entropy, average code length, efficiency, fixed-length comparison, and estimated compression savings.
When multiple symbols share equal frequencies, more than one optimal tree may exist. The exact bit patterns can change, but the average code length remains optimal.
Entropy is the theoretical lower bound in bits per symbol. Average code length is the actual weighted length produced by the Huffman tree.
Yes. In text mode, you can count spaces and newlines as real symbols. This is helpful when estimating compression for natural language text.
No. In manual mode, each line can represent any token you choose, including letters, words, markers, or special placeholders like [space].
It compares the estimated fixed-length bit total with the Huffman encoded bit total. A larger ratio means stronger compression under the chosen assumptions.
It gives a simple baseline. By comparing Huffman bits with a uniform code using ceil(log2 n) bits per symbol, you can estimate savings clearly.
Yes. The page includes CSV export for spreadsheets and PDF export for reports, making it easier to save or share your Huffman analysis.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.