# Shannon Coding Calculator

Generate Shannon coding for a set of symbols based on their probabilities.

### Using the calculator

To generate Shannon coding for a set of symbols, enter the symbol probabilities in the "Symbols probability table" by specifying the name and corresponding value (probability). Once you've entered the probabilities, click the "Calculate" button.
The calculator will determine the weighted path length, Shannon entropy, and display the Shannon coding table. #### Symbols probability table

NameValue
Items per page:

Digits after the decimal point: 2
Weighted path length

Shannon entropy

The file is very large. Browser slowdown may occur during loading and creation.

## Shannon Coding

Shannon coding, developed by Claude Shannon, is a lossless data compression technique that constructs a prefix code based on a set of symbols and their probabilities. Unlike Huffman coding, Shannon coding does not achieve the lowest expected codeword length, but it provides an efficient encoding scheme.

In Shannon coding, the symbols are sorted in order of probability, and codewords are assigned based on the binary expansions of the cumulative probabilities. The number of bits used for each symbol's codeword is determined by the formula: , where represents the number of bits and is the cumulative probability of the symbol. denotes the ceiling function (which rounds x up to the next integer value)

By using the calculator, you can easily generate Shannon coding for a set of symbols and explore the weighted path length, Shannon entropy, and corresponding codewords.

URL copied to clipboard

#### Similar calculators

PLANETCALC, Shannon Coding Calculator