Renyi Entropy Calculator
Inputs
- Inputs: probabilities 0.5000, 0.2500, 0.1250 and 0.1250 with alpha = 2.00.
- Power sum: sum of p^alpha = 0.3438.
- Renyi entropy: log2(0.3438) / (1 - 2.00) = 1.5406 bits.
- Renyi entropy result: 1.5406 bits - Shannon entropy of the same distribution is 1.7500 bits.
Shannon entropy answers one question - how uncertain is this distribution on average? Alfred Renyi's generalisation, from 1961, answers a family of questions at once. His entropy carries a parameter, alpha, that tunes which outcomes matter: turn alpha down and the rare outcomes speak louder; turn it up and the measure cares only about the likeliest ones. At alpha = 2 it becomes the collision entropy that hashing and randomness extraction run on; in the limit at alpha = 1 it is Shannon's entropy itself; and as alpha grows without bound it hardens into the min-entropy that governs worst-case guessing.
Enter four probabilities and an alpha and this calculator returns the Renyi entropy in bits, with the same distribution's Shannon entropy and min-entropy alongside - the three always line up in a fixed order, which makes the page its own checksum. The worked examples cover a dyadic distribution, a 0.4-0.3-0.2-0.1 split, and the uniform distribution where the whole family agrees.
Worked examples
Collision entropy of a dyadic split
(0.5 · 0.25 · 0.125 · 0.125 · 2)
| Renyi entropy | 1.5406 |
| Shannon entropy (alpha = 1 limit) | 1.7500 bits |
| Min-entropy (alpha = infinity) | 1.0000 bits |
| Effective alphabet size 2^H | 2.9091 |
Collision entropy of a 40-30-20-10 split
(0.4 · 0.3 · 0.2 · 0.1 · 2)
| Renyi entropy | 1.7370 |
| Shannon entropy (alpha = 1 limit) | 1.8464 bits |
| Min-entropy (alpha = infinity) | 1.3219 bits |
| Effective alphabet size 2^H | 3.3333 |
Uniform distribution at alpha = 3
(0.25 · 0.25 · 0.25 · 0.25 · 3)
| Renyi entropy | 2.0000 |
| Shannon entropy (alpha = 1 limit) | 2.0000 bits |
| Min-entropy (alpha = infinity) | 2.0000 bits |
| Effective alphabet size 2^H | 4.0000 |
Shannon with a tuning knob
The formula raises each probability to the power alpha, sums, takes the base-2 logarithm, and divides by (1 - alpha). The division is what makes the family interpolate rather than merely transform: it is calibrated so that a uniform distribution over four outcomes scores exactly 2.0000 bits at every alpha, as the third worked example confirms - when nothing distinguishes the outcomes, the tuning knob has nothing to tune.
The first worked example shows the knob working. The dyadic distribution 0.5, 0.25, 0.125, 0.125 at alpha = 2 has a power sum of 0.3438, and log2 of that, divided by (1 - 2), gives 1.5406 bits. Its Shannon entropy is 1.7500 bits. The Renyi value sits below Shannon's, as it must at alpha = 2: squaring the probabilities amplifies the dominant outcome's share, and the measure reports a distribution that is effectively more predictable than the average-case view suggests.
The supporting figure called the effective alphabet size translates bits back into outcomes: 2 raised to the entropy. The dyadic distribution's 2.9091 says it behaves, for collision purposes, like a uniform choice among about that many outcomes - fewer than the four that nominally exist, because the probabilities are unequal.
- Renyi entropy = log2(sum of p^alpha) / (1 - alpha), in bits.
- Alpha = 2 is collision entropy; the alpha -> 1 limit is Shannon entropy; alpha -> infinity is min-entropy.
- Renyi entropy never increases as alpha grows - the family is ordered.
- 2^H is the effective alphabet size: the equivalent number of uniform outcomes.
Collision entropy and the alpha = 2 case
At alpha = 2 the power sum is the probability that two independent draws from the distribution agree - the collision probability. Its negative logarithm is the collision entropy, and it is the working quantity wherever duplicates matter: hash collisions, birthday-style coincidences, and the extractors that distil weak random sources into strong ones, whose output length is governed by collision and min-entropy rather than by Shannon's average.
The second worked example prices a realistic split: 0.4, 0.3, 0.2, 0.1. The power sum is 0.3000 exactly, the collision entropy is 1.7370 bits, and the effective alphabet is 3.3333 - the distribution collides exactly as a uniform choice among three and a third outcomes would. Its Shannon entropy, 1.8464 bits, is more flattering; its min-entropy, 1.3219 bits, set entirely by the 0.4 outcome, is less so. The three numbers are three honest answers to three different questions.
Which question is yours depends on the adversary. Average-case coding and compression live at Shannon's setting. Anything involving an opponent who gets to aim at the likeliest outcome - password guessing, nonce reuse, fingerprint collisions - lives at alpha = 2 or beyond.
| Alpha | Name | For 0.5 / 0.25 / 0.125 / 0.125 | Governed by |
|---|---|---|---|
| 0 | Hartley entropy | 2.0000 bits | How many outcomes exist at all |
| 1 (limit) | Shannon entropy | 1.7500 bits | The average outcome |
| 2 | Collision entropy | 1.5406 bits | The chance two draws agree |
| Infinity | Min-entropy | 1.0000 bits | The single likeliest outcome |
Worked examples
Example 1: Probability of outcome 1 0.5; Probability of outcome 2 0.25; Probability of outcome 3 0.125; Probability of outcome 4 0.125; Alpha (order) 2. Renyi entropy = 1.5406. Supporting values: Shannon entropy (alpha = 1 limit) 1.7500 bits; Min-entropy (alpha = infinity) 1.0000 bits; Effective alphabet size 2^H 2.9091. Inputs: probabilities 0.5000, 0.2500, 0.1250 and 0.1250 with alpha = 2.00. Power sum: sum of p^alpha = 0.3438. Renyi entropy: log2(0.3438) / (1 - 2.00) = 1.5406 bits. Renyi entropy result: 1.5406 bits - Shannon entropy of the same distribution is 1.7500 bits.
Example 2: Probability of outcome 1 0.4; Probability of outcome 2 0.3; Probability of outcome 3 0.2; Probability of outcome 4 0.1; Alpha (order) 2. Renyi entropy = 1.7370. Supporting values: Shannon entropy (alpha = 1 limit) 1.8464 bits; Min-entropy (alpha = infinity) 1.3219 bits; Effective alphabet size 2^H 3.3333. Inputs: probabilities 0.4000, 0.3000, 0.2000 and 0.1000 with alpha = 2.00. Power sum: sum of p^alpha = 0.3000. Renyi entropy: log2(0.3000) / (1 - 2.00) = 1.7370 bits. Renyi entropy result: 1.7370 bits - Shannon entropy of the same distribution is 1.8464 bits.
Example 3: Probability of outcome 1 0.25; Probability of outcome 2 0.25; Probability of outcome 3 0.25; Probability of outcome 4 0.25; Alpha (order) 3. Renyi entropy = 2.0000. Supporting values: Shannon entropy (alpha = 1 limit) 2.0000 bits; Min-entropy (alpha = infinity) 2.0000 bits; Effective alphabet size 2^H 4.0000. Inputs: probabilities 0.2500, 0.2500, 0.2500 and 0.2500 with alpha = 3.00. Power sum: sum of p^alpha = 0.0625. Renyi entropy: log2(0.0625) / (1 - 3.00) = 2.0000 bits. Renyi entropy result: 2.0000 bits - Shannon entropy of the same distribution is 2.0000 bits.
Min-entropy and worst-case guessing
Min-entropy is the family's pessimist: -log2 of the largest probability, nothing else. For the dyadic distribution that is -log2 of 0.5, exactly 1.0000 bits - an attacker who always guesses the likeliest outcome succeeds half the time, and the measure refuses to be comforted by the long tail of unlikely outcomes behind it. Cryptographic key generation is specified in min-entropy for exactly this refusal.
The gap between min-entropy and Shannon entropy is a distribution's honesty gap. The 0.4-0.3-0.2-0.1 split carries 1.8464 Shannon bits but only 1.3219 min-entropy bits; a designer quoting the first figure for a guessing-resistance claim is overpromising by half a bit, which in guessing terms is the difference between an attacker needing three tries and needing two. This page prints both so the gap is never hidden.
Where Renyi entropy is used
Beyond cryptography, the family appears wherever a single diversity number must be tuned to a purpose. Ecologists meet it as the profile behind Hill numbers - species diversity at alpha = 0 counts species, at alpha = 1 weighs them evenly in the Shannon sense, at alpha = 2 emphasises the common ones. Econometricians use it for income and market concentration. In each field the argument for the family is the same: rather than pretending one setting is canonical, report the profile and let the reader see whether the conclusion survives the turning of the knob.
The discipline this page enforces - probabilities that sum to 1, an alpha that is positive and not exactly 1 - is the family's entry price. At alpha = 1 the formula's denominator vanishes and Shannon's separate formula takes over, which is why Shannon entropy is returned as its own figure here rather than as a computable setting of the dial.
Reading the effective alphabet size
Of the supporting figures, the effective alphabet size is the one practitioners quote most, because it converts an abstract bit count into a headcount. A source with a Renyi entropy of 1.7370 bits and an effective size of 3.3333 is, for collision purposes, a fair three-and-a-third-sided die - a statement a designer can reason about directly when sizing a hash output or a sampling scheme.
The uniform example is the calibration point: four equal probabilities give 2.0000 bits and an effective size of exactly 4.0000 at every alpha. Any departure of the effective size below the outcome count is a pure measure of inequality in the distribution - the tax the skew imposes, stated in the units the application actually cares about.
FAQs
What Renyi entropy does the dyadic distribution give at alpha = 2?
1.5406 bits. The power sum is 0.3438, and log2 of it divided by (1 - 2) gives the collision entropy - below the same distribution's Shannon entropy of 1.7500 bits, as the ordering requires.
Why is Renyi entropy below Shannon entropy here?
Because alpha = 2 squares the probabilities, amplifying the dominant outcome's weight. The measure reports the distribution as effectively more predictable than the average-case Shannon view. Renyi entropy never increases as alpha grows.
What is the effective alphabet size of 2.9091 telling me?
That the dyadic distribution collides like a uniform choice among about 2.9091 outcomes - fewer than the four that exist, because the probabilities are unequal. It is 2 raised to the entropy, and it is the figure designers size things with.
When should I use min-entropy instead?
When an adversary aims at the likeliest outcome - password and nonce guessing above all. Min-entropy counts only the largest probability: 1.0000 bits for the dyadic split, 1.3219 for the 0.4-0.3-0.2-0.1 split. Shannon's figure would overpromise in both cases.
Why can't I set alpha to exactly 1?
The formula divides by (1 - alpha), which is zero there. Shannon entropy is the limit as alpha approaches 1, computed by its own formula - which is why this page returns it as a separate supporting figure rather than a dial setting.
What does the uniform example prove?
Calibration. Four equal probabilities give 2.0000 bits at alpha = 3, and the same at every alpha, with an effective alphabet of exactly 4.0000. When nothing distinguishes the outcomes, the tuning knob has nothing to tune - any entropy implementation should reproduce that.