ITEngineeringTools

Shannon Entropy Calculator

Measure information entropy per symbol from text, a JSON array of symbols or a probability distribution.

Input

Result

How it works

Text is counted by Unicode code point and keeps case and spacing. Use a JSON string array for multi-character symbols. Probability rows declare an alphabet and must sum to one within the displayed tolerance; declared zero-probability symbols count toward the maximum. A single-symbol alphabet uses a normalized value of zero.

Formula

H = −Σ p log₂(p), with 0 log₂(0) = 0. Maximum = log₂(alphabet size). Normalized entropy = H / maximum when maximum is positive.

Practical examples

Fair binary observations

Source mode: Text
Text, JSON string array or one symbol,probability per line: 01010101

Entropy: 1 bits/symbol

Multi-character source symbols

Source mode: Symbol array
Text, JSON string array or one symbol,probability per line: ["AA","AA","AA","BB"]

Entropy: 0.8112781245 bits/symbol

Declared but unused symbol

Source mode: Probabilities
Text, JSON string array or one symbol,probability per line: A,0.5
B,0.5
C,0

Maximum entropy: 1.584962501 bits/symbol

Technical references