This online calculator generates Shannon coding based on a set of symbols and their probabilities
This online calculator produces Shannon coding for a set of symbols given their probabilities. You can find a bit of theory below the calculator.
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 bits from the binary expansions of the cumulative probabilities Here denotes the ceiling function (which rounds up to the next integer value).1