Biology & Life Sciences
Advanced

Shannon Diversity Index

Measures species diversity in a community.

Formula

H=−∑piln⁡piH = -\sum p_i \ln p_i

Variables

p_iProportion of species i

How it works

The Shannon Diversity Index combines two ideas: how many species are present and how evenly individuals are distributed among them. Each species contributes \(p_i \ln p_i\), so very common species and very rare species affect the total differently; the minus sign makes the final value positive. It is rooted in information theory, where the index measures the uncertainty in predicting the species identity of a randomly chosen individual: the less predictable the community, the higher the diversity.

When to use it

Use this when you want a single number to compare biodiversity across sites, habitats, treatments, or time points, especially in ecology, microbiology, and conservation biology. It is most useful when species abundance data are available, not just a presence/absence list.

Worked example, step by step

Suppose a sample contains 3 species with counts 40, 35, and 25. Step 1: Find the total number of individuals: 40 + 35 + 25 = 100. Step 2: Convert counts to proportions: \(p_1 = 40/100 = 0.40\) \(p_2 = 35/100 = 0.35\) \(p_3 = 25/100 = 0.25\) Step 3: Compute each term using natural logs: \(0.40\ln(0.40) = 0.40(-0.9163) = -0.3665\) \(0.35\ln(0.35) = 0.35(-1.0498) = -0.3674\) \(0.25\ln(0.25) = 0.25(-1.3863) = -0.3466\) Step 4: Sum the terms: \(\sum p_i\ln p_i = -0.3665 - 0.3674 - 0.3466 = -1.0805\) Step 5: Apply the minus sign: \(H = -(-1.0805) = 1.0805\) Final answer: \(H \approx 1.08\).

Common mistakes to avoid

  • Using raw species counts instead of proportions that sum to 1
  • Forgetting the negative sign, which makes the index appear negative
  • Mixing logarithm bases without noting that the numeric value changes

Did You Know?

Low genetic diversity endangers species like cheetahs, leaving them dangerously vulnerable to disease.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026