Calculate the Shannon-Wiener diversity index (H′) from species counts for any number of species, with evenness, or from three species proportions.

Uses natural logarithms (ln). Each count is divided by the total, so proportions that sum to 1 also work.

Separate counts with commas, spaces or new lines, e.g. 40, 25, 20, 15. Do not use thousands separators.

Optional settings

Shannon-Wiener Index Formula

The Shannon-Wiener Index is a biodiversity measure used to describe both richness (how many species are present) and evenness (how evenly individuals are distributed among those species). It is also commonly called the Shannon-Wiener or Shannon-Weaver diversity index.

H' = - Σᵢ₌₁S pᵢ ln(pᵢ)

If you begin with species counts instead of proportions, convert each species count into a proportion first.

pᵢ = (nᵢ) / (N)
  • H' = Shannon-Wiener Index
  • S = total number of species in the sample
  • pi = proportion of the total sample belonging to species i
  • ni = count of individuals in species i
  • N = total number of individuals across all species
  • ln = natural logarithm

How to Use the Shannon-Wiener Index Calculator

  1. Determine the share of the sample represented by each species.
  2. Enter the count of individuals for each species, or choose a three-proportion mode and enter each species proportion.
  3. Make sure all proportions are between 0 and 1.
  4. The proportions must sum to 1. In the three-proportion modes, choose which species proportion to find, or enter all three known proportions.
pmissing = 1 - Σ pᵢ

Once the proportions are known, the calculator multiplies each proportion by its natural logarithm, adds those terms together, and applies a negative sign to produce the final diversity value.

How to Interpret the Result

For comparable samples and species definitions, a larger Shannon value indicates greater diversity by this index. The index rises when more species are present and when their abundances are more evenly distributed. It falls when one or a few species dominate most of the sample.

0 ≤ H' ≤ ln(S)

The minimum value is 0, which occurs when the sample is entirely dominated by a single species. The maximum depends on the number of species and occurs when every species has the same proportion.

H'ₘₐₓ = ln(S)

For example, if there are three species and each makes up one-third of the community, the index reaches its maximum for a three-species system.

H'ₘₐₓ = ln(3) ≈ 1.099
Community Pattern What Happens to the Index
One species is overwhelmingly dominant The index is low
Several species are present, but one is still much more common The index is moderate
Many species are present with similar abundances The index is high
Species counts become more evenly distributed The index increases

Example Calculation

Assume a habitat contains three species with proportions 0.50, 0.30, and 0.20.

H' = - [(0.50ln 0.50) + (0.30ln 0.30) + (0.20ln 0.20)]
H' ≈ 1.03

This is below ln(3), the maximum for three equally abundant species. The value alone does not establish a universal diversity category.

Why Ecologists Use This Index

The Shannon-Wiener Index is popular because it captures two important features of biodiversity at the same time:

  • Richness: more species generally increase the index.
  • Evenness: a more balanced distribution also increases the index.

Because of this, the index is often used in ecology, conservation biology, environmental monitoring, forestry, soil science, and water quality studies.

Common Input Mistakes

  • Entering raw counts instead of proportions.
  • Using proportions that do not add up to 1.
  • Entering negative values or values greater than 1.
  • Comparing results from samples collected with very different methods or effort levels.

Helpful Notes

  • The index is dimensionless, so it has no units.
  • The natural logarithm is the standard version used in most ecological applications.
  • Species with zero observed individuals do not increase the index.
  • Adding a rare species usually increases the index slightly; adding a common species in a more balanced way increases it more.

Related Diversity Concept: Evenness

If you want to know how evenly species are distributed apart from richness, you can compute Pielou's evenness using the Shannon result.

J' = (H') / (ln(S))

Use observed species with positive proportions for S. Evenness is undefined when only one species is observed; otherwise, a value closer to 1 indicates more similar proportions.