# Shannon Coding Calculator

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

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/8163/. Also, please do not modify any references to the original work (if any) contained in this content.

### 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.

## 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.

#### Similar calculators

**

**PLANETCALC, Shannon Coding Calculator

## Comments