Shannon Diversity Index Calculator

Ecologists measure how diverse a community is with the Shannon index, which rewards both having many species and having them evenly spread. This calculator computes the index, written H, from a list of species counts. The method is the negative sum, over every species, of that species' proportion multiplied by the natural log of the proportion. First each count is divided by the grand total to get its proportion p. Then each p is multiplied by its natural log, the products are added, and the total is negated, because the logs of fractions are negative. A community of four species with counts of 40, 30, 20 and 10 gives proportions of 0.4, 0.3, 0.2 and 0.1, and an index of about 1.2799. A higher H means greater diversity, and for a fixed number of species it peaks when all are equally common, while a single dominant species pulls it down. Using the natural log, H is expressed in nats; log base 2 would give bits instead, a rescaling that does not change the ranking. Enter your counts, one per line or comma separated, to get the index. Every figure is computed deterministically from the formula, never estimated, with the method and a worked example shown below for verification.

The Shannon index sums each proportion times its natural log, negated: H = -sum(p ln p). Species counts of 40, 30, 20 and 10 give an index of 1.2799 nats.

Source: US Geological Survey (USGS). As at 25 June 2026.

Comma separated individual counts
Total individuals--
Number of species--
Shannon index H--

Shannon index formula

H = - sum over species of (p_i x ln p_i)
p_i = count of species i / total count
ln = natural logarithm, giving H in nats
H is largest when species are equally abundant

Each species contributes its proportion times the log of that proportion. Summing and negating gives the index, which rises with richness and evenness.

Worked example

Four species have counts of 40, 30, 20 and 10, a total of 100.

  1. Proportions: 0.4, 0.3, 0.2, 0.1
  2. 0.4 x ln 0.4 = -0.366516; 0.3 x ln 0.3 = -0.361192
  3. 0.2 x ln 0.2 = -0.321888; 0.1 x ln 0.1 = -0.230259
  4. Sum = -1.279855
  5. H = -(-1.279855) = 1.2799

The Shannon index is 1.2799 nats. These are the calculator's default inputs, so the result above matches the widget exactly.

Index for equally abundant species

With perfect evenness, H equals the natural log of the species count.

Species (equal)Maximum H
20.6931
41.3863
82.0794
162.7726

Biodiversity and community ecology metrics: US Geological Survey (USGS).

Shannon diversity index calculator: frequently asked questions

What is the Shannon diversity index?

The Shannon index, written H, measures the diversity of a community by combining richness, the number of species, and evenness, how balanced their abundances are. It is the negative sum over all species of each species' proportion multiplied by the natural log of that proportion.

How is each proportion found?

For each species, divide its count by the total count of all individuals. That fraction is the proportion p for that species. The index then multiplies each p by its natural log, sums the results and negates the total, since the logs of fractions are negative.

What does a higher H mean?

A higher H means greater diversity, driven by more species and a more even spread of individuals among them. A community with one dominant species has a low H, while one with many equally abundant species has a high H. For a given number of species, H is largest when all are equally common.

What units does H use?

When the natural logarithm is used, H is in natural units called nats. Using log base 2 gives bits and log base 10 gives decimal digits. The choice of base only rescales the index; this calculator uses the natural log, the most common convention in ecology.

Is the result computed automatically?

Yes. The page computes each proportion and the weighted log sum deterministically. No value is estimated or hard-coded, so changing the counts updates the index instantly.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.