Shannon entropy calculator

Paste a string, a key or a short text and see how much information each symbol carries on average. The calculator counts every character (or byte, or word), applies Shannon's formula and compares the result with the maximum possible for that many different symbols.

Entropy per symbol2.0404
Total information (entropy × length)
22.44
Symbols in the text
11
Different symbols
5
Maximum for this many symbols
2.3219
Efficiency (entropy ÷ maximum)
87.9 %
Most frequent symbols
a 5 · b 2 · r 2 · c 1 · d 1

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste or type the text. Spaces count as symbols (shown as ␣ in the frequency row).
  2. Choose the symbols: characters, UTF-8 bytes or words separated by spaces.
  3. Choose the unit and read the entropy per symbol, the total information and the most frequent symbols.

Formula

For a text of n symbols where symbol i occurs cᵢ times, pᵢ = cᵢ ÷ n and

H = −Σ pᵢ · log(pᵢ)

Total information = H × n. With k different symbols the maximum is log(k), reached when they all occur equally often; efficiency = H ÷ log(k).

Worked example

abracadabra has 11 characters: a 5, b 2, r 2, c 1, d 1.

  • H = −(5/11·log₂ 5/11 + 2·2/11·log₂ 2/11 + 2·1/11·log₂ 1/11) = 2.0404 bits per character.
  • Total: 2.0404 × 11 = 22.44 bits.
  • Maximum for 5 symbols: log₂ 5 = 2.3219 bits, so the efficiency is 87.9 %.

Tips

  • Entropy is about this string only. It treats symbols as independent and ignores their order: abab and aabb get the same value.
  • Compare like with like. Characters and bytes give different numbers for non-Latin text; pick one mode and keep it.
  • Random-looking keys made of hex digits approach 4 bits per character, Base64 keys approach 6, once they are long enough for every symbol to appear.

Frequently asked questions

What is Shannon entropy?

It is the average amount of information per symbol, H = −Σ p·log₂(p), where p is how often each symbol occurs. A string of one repeated letter has entropy 0; a string where four letters appear equally often has 2 bits per symbol.

Does high entropy mean a strong password?

Not by itself. This calculator measures how evenly the characters of this particular string are spread, not how the password was chosen. A random 12-character password and a common word can both look varied. For passwords, use the password strength checker, which estimates guessing effort.

Which unit should I use?

Bits (base 2) are the usual choice in computing: they tell you how many binary digits an ideal code needs per symbol. Nats use the natural logarithm and appear in statistics and machine learning; hartleys use base 10. 1 nat = 1.4427 bits.

Why does the byte count differ from the character count?

In UTF-8 Latin letters take one byte, but Cyrillic and accented letters take two and many emoji four. In bytes mode the entropy is computed over those byte values, which is what a compressor sees.

What does efficiency mean?

Entropy divided by log(k), where k is the number of different symbols. 100 % means every symbol appears equally often; lower values mean some symbols dominate and the text is more predictable.

More in Developer

All tools in this category: Developer ·Updated November 7, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.