Entropy of a String Calculator – Shannon Bits per Character

Entropy of a String Calculator

Measure the Shannon entropy of any text in bits per character with H = - sum of p times log2(p), then read the total information content, redundancy against the maximum possible entropy, and a password search-space strength estimate all in one place.

🔐Choose a Mode

🎯Try a Sample String

📝String Inputs

Every character counts. Frequencies are read exactly as typed.

Uncheck to fold uppercase into lowercase before counting.

Uncheck to strip spaces, tabs, and newlines from the string.

Auto adds 26 lower, 26 upper, 10 digits, 32 symbols as found.

Only used when the mode above is set to manual.

Sets the crack-time estimate for the password entropy card.

Controls rounding on entropy and information values.

Lists each distinct character, its p, and -p log2 p term.

Shannon Entropy 0 bits per character
Total Information 0 bits for the whole string
Redundancy 0% vs max entropy of alphabet
Password Search Space 0 bits - strength tier

🔢Formula Snapshot

H-Sum p log2 p
H x Ltotal bits
log2 kmax entropy
L log2 Npassword bits

📊Entropy by Character Distribution

DistributionExampleDistinct kH (bits/char)Meaning
Single characteraaaaaa10.00No uncertainty
Two, equalababab21.00One coin flip each
Two, skewed 3:1aaab20.81Bias lowers H
Four, equalabcdabcd42.00log2(4) = 2
Eight, equalabcdefgh83.00log2(8) = 3
10 digits, equal0123456789103.32log2(10)
26 letters, equalabc...xyz264.70log2(26)
English prosetypical text~27~4.00Real-world value

🔗Character Class Pool Sizes

Character ClassPool NBits per CharExample Symbols
Lowercase only264.70a b c ... z
Uppercase only264.70A B C ... Z
Digits only103.320 1 2 ... 9
Lower + digits365.17a-z 0-9
Lower + upper525.70a-z A-Z
Alphanumeric625.95a-z A-Z 0-9
+ symbols946.55full printable ASCII
Hex digits164.000-9 a-f

🗄String Entropy Comparison Grid

String / TypeLengthDistinctH (bits/char)Total bitsRating
aaaa410.000.00None
1234442.008.00Very weak
abcd442.008.00Very weak
password872.7522.0Weak
mississippi1141.8220.0Low
Tr0ub4dor&311103.2836.1Fair
Hex 16 char16164.0064.0Good
Random 16 mix16164.0064.0Strong
4 word passphrase28~15~3.90~109Strong

🔓Password Entropy and Crack Time

Entropy (bits)Strength TierCombinationsAt 1 Trillion / s
Under 28Very weakUnder 268 millionInstant
28 to 35WeakBillionsSeconds
36 to 59FairTrillionsMinutes to days
60 to 79StrongQuintillionsYears
80 to 99Very strong10^24 plusMillennia
100 to 127Excellent10^30 plusCosmic
128 and upCryptographic10^38 plusInfeasible

Formula Breakdown

Probability p = count / LFor each distinct character, its probability is how many times it appears divided by the string length L. In aaab, a has p = 3/4 and b has p = 1/4.
Shannon H = -Sum p log2 pSum the term -p times log2(p) across every distinct character. For aaab, H = -(0.75 log2 0.75 + 0.25 log2 0.25) = 0.81 bits per character.
log2(x) = ln(x) / ln(2)Base-2 logarithms measure information in bits. One bit is the uncertainty of a single fair coin flip, so log2(2) = 1.
Total = H x LMultiply entropy per character by the length to get total information content, the theoretical minimum bits needed to encode the exact string.
Max H = log2(k)The most entropy possible for k distinct characters is log2(k), reached only when every character is equally likely. A uniform 4-symbol string has H = log2(4) = 2.
Redundancy = 1 - H / HmaxHow far the string falls below its own maximum, as a percentage. Predictable, repetitive text has high redundancy; uniform random text approaches 0.
Password H = L x log2(N)Search-space entropy assumes each of L positions is drawn from a pool of N possible characters. A 12-char password from 94 symbols carries 12 x log2(94) = 78.7 bits.

💡Practical Entropy Tips

Length beats complexity: Password entropy is L times log2(N), so length L is a linear multiplier. A 16-character lowercase password holds 16 x 4.70 = 75 bits, beating an 8-character full-ASCII password at 8 x 6.55 = 52 bits. Add characters before you add exotic symbols.
Shannon is not strength: The Shannon entropy of the exact text can look high while the password is still guessable. Tr0ub4dor&3 has about 3.28 bits per character, yet a dictionary attack cracks it fast. Use the charset entropy card for real resistance, and prefer long random or passphrase strings.

For example, you’d think that a lengthy password must be safe… but according to concept of entropy, it isn’t. If all 12 characters is the same letter, we know exactly what each one will be. There is no uncertainty, which means there are 0 bits of actualy information. This makes it less secure and also compresses well.

The page has a calculator that measure that randomness (based off Claude Shannon’s original 1948 formula). It will tell you how many bits of actual info your text contain, and how many are simply predictable noise. It all comes back to Shannon entropy, the sum (technically, the negative sum) of the base-two logarithm of each character’s probability times that probability itself.

How Entropy Measures Password Randomness

Entropy is average surprise. For a given alphabet size, the entropy will be highest when each character have an equal chance of appearing; that’s as surprising as possible. But something like abab is perfect alternating. It has an entropy of one bit per character. Each position resolve the uncertainty of a single fair coin flip. Skew that probability really far towards one letter and the entropy decrease.

Plug your text into the calculator above and it do the math for you (no more having to look up logs yourself). It even shows you what characters is pulling the score down.

So why do security audits goes wrong? Most people mix up two distinct form of entropy. Shannon entropy examines the string you typed, looking for patterns by measuring how often each character occur; this tells us how compressible your string is. But what matters for password strength isn’t Shannon entropy; rather, it’s search-space entropy, which takes into account that the attacker doesn’t know your string, they need to guess one out of a set of possible strings.

And here, too, the tool makes a clear distinction. It estimates the effort required of a hacker who want to bruteforce his or her way in. It also calculates the theoretical minimum number of bits that would of been required to encode your string exactly. Take, for instance, the old standby Tr0ub4dor and 3. That’s not simple to look at… Symbols, numbers, and mixed case. With that many characters, drawing from a pool of 94 possible ASCII ones, it has a lot of search-space entropy. But it isn’t too much in terms of randomness; it can be guessed based on human patterns. Despite having a high bit count due to both length and character variety, it gets cracked immediately by a dictionary attack.

The discrepancy is what makes long random passphrases so good compared to short complex passwords. Extra length exponentially raises your security; extra weird characters just add a little more to the pool.

Another interesting perspective, perhaps of particular interest to data engineers, is the redundancy metric. This metric measures how close your string’s true entropy match its highest potential entropy based on its unique collection of characters. If it’s very high, the text is predictable, hence easily compressed. Typical English writing have a lot of redundancy (this is why gzip does so well). A uniformly random string will have nearly zero redundancy and won’t budge an inch. One number, one percent, tells you how much headroom there is for any compression algorithm to make things smaller without reaching theoretical limits.

The inputs can change to match your requirements. Case sensitivity is toggled on/off. This increases the size of alphabet, so that A and a become separate symbols, increasing the entropy if both are included. Whitespace stripping take out any obvious padding that tends to reduce the score of shorter strings. Password mode allows you to specify your own character set by hand (useful for things like base-16 tokens, or base-64 passwords that don’t match regular old ASCII).

To summarize: Entropy measures ignorance. It’s a way to quantify how predictable a pattern is. If the number of bits is small, then there is an obvious pattern. If the number of bits are large, well, you can’t guess that string. You can use this to check your homework or test your encryption keys. You can even use it just for fun if you’re curious what your favorite password might be. But don’t go by your gut, just enter your string, select your mode and read the bits. The answer won’t lie. Not even when your gut says otherwise.

Entropy of a String Calculator – Shannon Bits per Character