The Shannon entropy calculator above measures how much information a source produces per symbol. Give it a string and it counts the frequency of every distinct character and treats those frequencies as a probability distribution. Give it a list of probabilities or raw counts and it uses them directly. Either way it returns the entropy in bits per symbol, the maximum entropy the same alphabet could achieve, the redundancy that gap represents, and the total information in the whole message.
Arb Digital publishes this alongside its other free developer tools because entropy is quoted constantly and calculated correctly rather less often. The number gets used as a stand-in for randomness, for compressibility, for password strength and for diversity, and only some of those uses survive contact with the definition. This page shows the frequency table it derived, so you can see exactly what distribution produced the number rather than taking it on trust.
What This Shannon Entropy Calculator Does
In text mode the tool builds a frequency table of the characters in your input, converts each count to a probability by dividing by the total length, and applies Shannon's formula. The bars underneath show every symbol's probability, sorted by frequency, so a distribution dominated by one character is immediately visible. In distribution mode you supply the probabilities yourself, which is what you want when the symbols are not characters at all — outcomes of a die, categories in a dataset, states of a system.
Alongside the entropy it reports three companions. Maximum entropy is the base-2 logarithm of the alphabet size, which is the entropy a uniform distribution over the same symbols would have. Redundancy is one minus the ratio of actual to maximum entropy, expressed as a percentage, and it estimates how much of the message is predictable. Total information is entropy per symbol multiplied by message length, and it is the theoretical floor on how few bits a perfect symbol-by-symbol encoder would need.
A boundary worth stating clearly, because it is the single most common confusion: this page measures the information content of an observed distribution. Our password entropy calculator estimates how hard a password is to guess, and our password combination calculator counts the size of a keyspace from a character set and a length. Those are different questions with different answers, and the section below explains why applying this page's number to a password will flatter it badly.
How to Use It
- Choose the input type. Text mode derives the distribution from what you paste; distribution mode uses the numbers you type.
- Paste your text or your probabilities. Counts work as well as probabilities — entering 5, 2, 2, 1, 1 gives the same result as the equivalent fractions.
- Pick the logarithm base. Base 2 gives bits, which is almost always what you want. Base e gives nats, used in machine learning. Base 10 gives hartleys.
- Use the normalisation switches to fold case together or drop whitespace, both of which change the alphabet and therefore the answer.
- Read the bars before you read the number. If one symbol dominates, low entropy is telling you something obvious rather than something subtle.
The Formula and How It Is Calculated
Shannon entropy is the expected value of the information content of a symbol: H = −Σ pₓ log₂ pₓ, summed over every symbol with a non-zero probability. Each term is a probability multiplied by the number of bits that outcome carries, and the minus sign exists only because the logarithm of a probability is negative. Symbols with probability zero contribute nothing, which the tool handles explicitly rather than producing a not-a-number from log(0).
Work through the default text. In abracadabra there are eleven characters: a appears five times, b twice, r twice, c once and d once. The probabilities are 5/11, 2/11, 2/11, 1/11 and 1/11. The a term is 0.4545 × 1.1375 = 0.5170 bits. Each b and r term is 0.1818 × 2.4594 = 0.4472 bits. Each c and d term is 0.0909 × 3.4594 = 0.3145 bits. Adding them gives 2.0404 bits per symbol. Maximum entropy for five distinct symbols is log₂5 = 2.3219, so redundancy is 1 − 2.0404/2.3219 = 12.1 percent, and total information is 11 × 2.0404 = 22.44 bits.
That total is the interesting number. Storing eleven characters as ASCII takes 88 bits. Storing them with a three-bit fixed code for the five symbols takes 33. The entropy bound says 23 bits is the floor for any symbol-by-symbol code, and a Huffman code for this distribution achieves 23 — one bit above the bound, because Huffman codes must use whole numbers of bits per symbol. The gap between 2.04 and the achievable 2.09 is the price of integer code lengths.
Why This Number Is Not Password Strength
Feed a twelve-character password into text mode and you will get something around 3.3 bits per symbol, or roughly 40 bits total. That number looks reassuring and is close to meaningless as a measure of guessing difficulty, for two reasons.
The first is that character-frequency entropy assumes symbols are drawn independently. A password is not a random draw from its own letter frequencies — it is usually a word, a date, a keyboard pattern or a substitution of one of those. The distribution that matters is the distribution over passwords an attacker would try, not the distribution over letters within the one you chose. "aaaaaaaaaaaa" and a truly random twelve-character string can be told apart by this measure, but "Password1234" and a random string of the same character classes cannot.
The second is that entropy is an average, and guessing difficulty is governed by the head of the distribution rather than its mean. A distribution where one candidate has probability one half has an entropy that can be arbitrarily large while still being guessed on the first attempt half the time. That is why guessing resistance is measured with min-entropy — the negative log of the single largest probability — rather than Shannon entropy. NIST Special Publication 800-63B, Digital Identity Guidelines moved away from composition-rule entropy scoring for exactly this reason and recommends checking candidate passwords against lists of known and breached values instead.
Use this page when you want to know how much information a source carries. Use the password entropy calculator when you want an estimate of how hard something is to guess.
Entropy, Compression and the Limits of the Bound
Shannon's source coding theorem says a source cannot be compressed below its entropy without loss, and can be compressed arbitrarily close to it given a good enough code. That makes entropy the natural benchmark for a compressor: divide the compressed size in bits by the number of symbols and compare against the number this page gives you.
The catch is which entropy you are comparing against. The figure here is the zero-order entropy, which assumes each symbol is independent of the ones around it. Real text is nowhere near independent — a q is followed by a u almost always, and "th" is far more common than the individual letter frequencies predict. Higher-order models that condition on the previous one, two or three symbols report much lower entropy for the same text, which is why a general-purpose compressor routinely beats the zero-order bound by a wide margin without violating any theorem. MIT's open course 6.050J Information and Entropy works through the progression from zero-order models to conditional ones in detail.
The practical reading: if a file's measured zero-order entropy is close to 8 bits per byte, it is already compressed or encrypted and further compression will not help. If it is 4 bits per byte, there is at least half the file's size available to a compressor, and probably more once correlations are exploited.
Maximum Entropy and What Redundancy Really Measures
Maximum entropy for an alphabet of n symbols is log₂n, achieved only when every symbol is equally likely. This tool computes it from the number of distinct symbols it actually observed, not from some assumed alphabet, and that distinction matters. A message using only the letters a and b has a maximum entropy of 1 bit, so a perfectly balanced ab-string scores 1.00 and 0 percent redundancy — even though, judged against the full lowercase alphabet, it is extremely predictable.
So redundancy here answers a specific question: given the symbols this source actually uses, how far from uniform is it? That is the right question for checking whether a random generator is biased, and the wrong question for judging whether a message is predictable in an absolute sense. If you want the second, supply a distribution over the full intended alphabet and give the unused symbols a probability of zero — distribution mode accepts zeros precisely so you can do that.
Short inputs also inflate the apparent randomness. Ten characters cannot produce a reliable estimate of a frequency distribution; each symbol carries a tenth of the probability mass whether or not that reflects the underlying source. Treat entropy from anything under a few hundred symbols as indicative. Our standard deviation calculator and normal distribution calculator are useful for the same reason: small samples flatter every summary statistic.
Where Entropy Is Genuinely the Right Tool
Decision-tree learning uses entropy directly. Information gain is the entropy of the labels before a split minus the weighted average entropy after it, and the algorithm picks the split that reduces uncertainty most. Distribution mode is exactly the input format for that calculation: enter the class counts in each branch and compare.
Diversity measurement in ecology uses the same formula under the name of the Shannon index, applied to species counts. Cryptographic and random-number testing uses it as a cheap first screen — not proof of randomness, but a fast way to catch a generator that is obviously stuck. Log analysis uses it to flag fields whose value distribution has collapsed, which usually means a producer has started emitting a constant where it used to emit variety.
It also has a role in feature selection: a column whose values are almost all identical has near-zero entropy and carries almost no information for a model, which is a defensible reason to drop it before training. If you are comparing documents rather than measuring one, the cosine similarity calculator is the better fit, and the hash generator is what you want if the goal is a fingerprint rather than a measurement.
Arb Digital designs and builds fast, well-instrumented web applications. If you need the analysis behind a product as well as the interface in front of it, we can help.
See Web Design & Development Talk to Arb DigitalCommon Mistakes to Avoid
- Quoting entropy without the base — 2.04 bits and 1.41 nats are the same quantity. A number with no unit is not comparable to anything.
- Using per-symbol entropy as password strength — it assumes independent draws and ignores the head of the guessing distribution, so it overstates weak passwords badly.
- Comparing entropy across different alphabets — a value of 3 bits means something very different over 8 symbols than over 256.
- Reading zero-order entropy as a hard compression limit — it ignores correlation between symbols, and real compressors routinely beat it.
- Estimating from a tiny sample — under a few hundred symbols the frequency table is mostly noise, and the entropy inherits that noise.
Related Free Tools From Arb Digital
Estimate guessing difficulty with the password entropy calculator, size a keyspace with the password combination calculator, summarise a numeric sample with the standard deviation calculator, and work with probabilities directly using the probability calculator. For text measurement rather than information measurement, the character counter breaks a string down by unit, and the Base64 encoder and decoder shows what encoding does to size. The full free online tools hub lists everything else.
Frequently Asked Questions
It measures the average amount of information a symbol from a source carries, in bits. Equivalently it is the average number of yes-or-no questions needed to identify a symbol drawn from the distribution, given an optimal questioning strategy.
No. This page measures the information content of an observed distribution. Password strength is about how hard a secret is to guess, which depends on the attacker's candidate list and is better described by min-entropy than by Shannon entropy.
Because your symbols are not equally likely. Maximum entropy is log base 2 of the alphabet size and is reached only by a perfectly uniform distribution. The gap between the two is reported here as redundancy.
Yes. Distribution mode normalises whatever you enter by dividing through by the total, so raw counts such as 5, 2, 2, 1, 1 give the same entropy as the equivalent fractions.
They are the same quantity measured with different logarithm bases: base 2 gives bits or shannons, base e gives nats, and base 10 gives hartleys. One nat is about 1.443 bits and one hartley is about 3.322 bits.
No. Entropy is a first screen, not a proof. A repeating sequence that cycles through every symbol equally often scores maximum entropy under a zero-order model while being completely predictable to anyone who spots the cycle.
No. The frequency counting and the entropy calculation both run in your browser, and the page makes no network request after it loads. Nothing you paste is transmitted or stored.