homechevron_rightProfessionalchevron_rightComputers

Shannon coding

This online calculator generates Shannon coding based on a set of symbols and 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.

This online calculator produces Shannon coding for a set of symbols given their probabilities. You can find a bit of theory below the calculator.

Symbols probability table

arrow_upwardarrow_downwardNamearrow_upwardarrow_downwardValue
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

In the field of data compression, Shannon coding, named after its creator, Claude Shannon, is a lossless data compression technique for constructing a prefix code based on a set of symbols and their probabilities (estimated or measured). It is suboptimal in the sense that it does not achieve the lowest possible expected codeword length like Huffman coding does, and never better but sometimes equal to the Shannon-Fano coding calculator.

In Shannon coding, the symbols are arranged in order from most probable to least probable, and assigned codewords by taking the first $l_{i}=\left\lceil -\log _{2}p_{i}\right\rceil$ bits from the binary expansions of the cumulative probabilities $\sum \limits _{k=1}^{i-1}p_{k}.$ Here $\lceil x\rceil$ denotes the ceiling function (which rounds $x$ up to the next integer value).1

URL copied to clipboard

Similar calculators

PLANETCALC, Shannon coding