Entropy Calculator

Enter your event probabilities (up to 6 values) and choose a logarithm base to compute the Shannon entropy of your distribution. The calculator returns the entropy value in bits (or nats/hartleys depending on base), plus a breakdown chart showing how each probability contributes to the total uncertainty.

How many distinct outcomes does your probability distribution have?

Base 2 gives entropy in bits — the standard for information theory.

Enter a value between 0 and 1.

Results

Shannon Entropy

--

Unit

--

Sum of Probabilities

--

Maximum Possible Entropy

--

Normalized Entropy (0–1)

--

More Math Tools

Frequently Asked Questions

What is Shannon entropy?

Shannon entropy, introduced by Claude E. Shannon in 1948, is a measure of the uncertainty or randomness in a probability distribution. The higher the entropy, the more unpredictable or disordered the distribution. It is the foundational concept of information theory and is used to quantify the average amount of information produced by a random source.

How is Shannon entropy calculated?

Shannon entropy is calculated using the formula H(X) = −∑ P(xᵢ) · log_b(P(xᵢ)), where P(xᵢ) is the probability of each event and b is the logarithm base. Events with probability 0 contribute nothing to the sum (since 0 · log(0) is defined as 0 by convention). The result gives the average number of bits (or nats/hartleys) needed to encode an outcome.

What are bits, nats, and hartleys?

These are units of information entropy depending on the logarithm base used. Base 2 produces entropy in bits (the most common in computing and information theory). Base e (≈2.718) gives nats, used in physics and machine learning. Base 10 yields hartleys (also called bans or dits), used in some engineering contexts.

When is Shannon entropy at its maximum?

Entropy is maximized when all events are equally probable. For n events, maximum entropy equals log_b(n). For example, a fair 4-sided die has maximum entropy of log₂(4) = 2 bits. The more skewed the distribution, the lower the entropy — a certain outcome (probability = 1) produces zero entropy.

How is Shannon entropy used in information theory?

Shannon entropy is used to measure data compression limits, design efficient codes (Huffman coding), evaluate the randomness of passwords, analyze decision trees in machine learning, and quantify the information content of messages. It sets the theoretical lower bound on the average code length needed to represent a symbol from a source.

Do my probabilities need to sum to exactly 1?

Yes — a valid probability distribution requires all probabilities to sum to 1. This calculator checks the sum and displays it so you can verify. If they don't sum to 1, your entropy result won't be meaningful. You can normalize your values beforehand by dividing each by the total sum.

What is normalized entropy?

Normalized entropy divides the computed Shannon entropy by the maximum possible entropy for the same number of events (log_b(n)). The result falls between 0 and 1: a value of 1 means perfect uniformity (maximum uncertainty), while a value of 0 means a completely certain outcome. It lets you compare entropy across distributions with different numbers of events.

How is entropy related to password strength?

Password entropy estimates how hard a password is to guess. It's calculated as log₂(C^L), where C is the size of the character set used and L is the password length. A higher bit count means a stronger password. For example, an 8-character password using 95 printable ASCII characters has about 52.6 bits of entropy.