Home › Guides › The Shannon diversity index, with a worked example

For ecology and biology students

The Shannon diversity index, with a worked example

Two meadows can hold the same number of species and still differ in diversity. The Shannon index counts both how many species there are and how evenly the individuals are spread among them.

In short

For each species, find its share p of all the individuals counted. Then H′ = −Σ p ln p, and the evenness J′ = H′ ÷ ln S, where S is the number of species. A higher H′ means a more diverse sample; J′ runs from 0, when one species dominates, to 1, when all are equally common.

Step by step

Counts of 40, 30, 20 and 10 individuals (N = 100)
SpeciesCountp−p ln p
A400.40.3665
B300.30.3612
C200.20.3219
D100.10.2303

Adding up the last column gives H′ = 1.2799. With S = 4 species, ln 4 = 1.3863, so J′ = 1.2799 ÷ 1.3863 = 0.9232: a fairly even community.

Which logarithm?

The Shannon index can use the natural logarithm (giving units called nats), log base 2 (bits) or log base 10. The results differ only by a constant factor, but values computed with different bases can't be compared. JigWell uses the natural logarithm, the most common choice in ecology.

Simpson's index alongside

Simpson's index D = Σ p² is the chance that two individuals picked at random (with replacement) belong to the same species: 0.30 here. Many people report 1 − D (0.70, the chance that they differ) or 1 ÷ D (3.33, the effective number of equally common species). Some textbooks use the finite-sample form Σ n(n − 1) ÷ N(N − 1), which gives a slightly lower D.

Worked example

The same four counts entered in JigWell:

Worked example 1: Field biology & survey → Biodiversity, richness & similarity
Species richness, S4
Individuals, N100
Shannon H′ (nats)1.2799
Evenness J′0.9232
Simpson D0.3
1 − D0.7
1 ÷ D3.333

Computed by JigWell's Field biology & survey → Biodiversity, richness & similarity tool (biodiversity) with counts = [40, 30, 20, 10].

Do it in JigWell

  1. Open Field biology & survey → Biodiversity, richness & similarity.
  2. Type the count for each species as a list, for example 40, 30, 20, 10. Zeros are ignored.
  3. Read the richness, Shannon H′ and evenness, and the Simpson family side by side.
  4. To estimate how many species a survey missed, use Field biology & survey → Biodiversity, richness & similarity; to compare two sites, Field biology & survey → Biodiversity, richness & similarity.

Download JigWell, freeMore guides

For 64-bit Windows. Over 110 science and field tools; no internet, no account.

Good to know

Sources