ForHosting KIT · Math

Simpson's diversity index

Counts of 10, 20, 5 and 15 give 50 individuals in four species and a diversity index just above seven in ten: the chance that two random individuals differ. Enter one count per species to get the diversity index and the dominance behind it. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Counts
10, 20, 5, 15
You get
Species count
4
Total count
50
Diversity index
0.7142857143
Dominance
0.2857142857

Simpson's diversity index answers one sampling question: if you pick two individuals at random from a finite list of species counts, what is the probability that they belong to different species? This calculator accepts a non-empty list of non-negative counts, sums them to a total N, and applies the finite-sample formula one minus the sum of n times n minus one over N times N minus one.

What Simpson's diversity index measures

Simpson's diversity index is a two-draw probability, not a vague evenness slogan. Simpson's diversity index is the complement one minus D: the chance the two draws belong to different species. When a single species holds every individual, D is one and the diversity index is zero.

When many species share the sample evenly, D is small and the diversity index approaches one. The finite-sample form is the right one whenever you have counts rather than known population proportions, because the second draw is without replacement. Textbooks disagree on names—some write D for dominance, some write D for one minus lambda, some print the inverse Simpson one over lambda as an effective species number.

What you enter and what you get

Each entry is the count of one species in the sample—classically integer individuals, though non-negative reals are accepted for aggregated or rarefied tables. At most ten thousand entries are allowed. The total of all counts N must be at least two; a single individual cannot support a two-draw probability, so a total less than two is rejected with a clear message rather than returning NaN.

Numeric fields are rounded to twelve significant digits for stable goldens across runtimes. Example: counts ten, twenty, five, and fifteen give N equal to fifty, four species, a moderate dominance below zero point three, and a diversity index above zero point seven, reflecting a mixed sample rather than a monoculture.

Where Simpson's diversity index helps

Classroom labs and statistics courses need a live oracle so students can type a short count vector from a quadrat, a bird point-count, or a made-up table and see the pair probability update without installing R or a spreadsheet template that silently changes the formula. Biodiversity monitoring programs reduce each plot's raw counts to a short list of indices before storing time series; automating the finite-sample diversity index removes drift when technicians copy cells across sheets.

Environmental scorecards and restoration reports need a reproducible different-species probability when arguing that a post-disturbance community is still dominated by a few opportunistic taxa. Research notebooks that already compute Shannon entropy can add this complementary evenness-sensitive lens without pulling a full vegan package for a single closed formula.

Plot and survey summaries

Turn per-species counts from a vegetation plot or point-count into the probability that two random individuals differ.

How do I calculate Simpson's diversity index from species counts?

Send a non-empty counts array of non-negative numbers whose total N is at least 2.

Are zero counts allowed?

An all-zero vector is rejected because N would be less than two.

Why must the total count be at least 2?

The index is the probability of two draws without replacement, so it needs at least two individuals. With a single individual there is no second draw, and the calculator rejects the list instead of returning an empty number.

What do a value of 0 and a value close to 1 mean?

A value of 0 means one species holds every individual, so two draws always match. Values close to 1 mean many species share the sample evenly, so two random individuals almost always belong to different species.

Why does my textbook give a different Simpson number?

Textbooks use the letter D differently: some mean the same-species probability, some its complement, and some print the inverse Simpson as an effective number of species. Here the diversity index is always the chance that two individuals differ.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/simpsons-diversity-index

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/simpsons-diversity-index \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"counts":[10,20,5,15]}'
{
  "counts": [
    10,
    20,
    5,
    15
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.simpsons_diversity_index",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

A total below two cannot support a pair of draws, so those requests fail with invalid_input instead of returning a hollow number.

What Simpson's diversity index measures

Given a finite sample whose species i contributes n_i individuals and whose total is N, imagine drawing one individual uniformly, then drawing a second individual from the remaining N minus one. The chance those two belong to the same species is the Simpson dominance D, equal to the sum over i of n_i times (n_i minus one), divided by N times (N minus one). An infinite-population cousin one minus the sum of squared p_i is close for large N but is defined even for N equals one, which this endpoint refuses: a pair probability is undefined until two individuals exist. This calculator commits to one contract: diversity_index is always the without-replacement probability that two random individuals differ, and dominance is always D. That keeps homework, dashboards, and APIs from mixing the same-species probability with the different-species probability under one overloaded letter.

Input contract, response fields, and validation

POST a JSON body with a required counts field: a non-empty array of non-negative finite numbers, or a comma, space, or semicolon separated string of the same. Aliases n, species_counts, values, and abundances are accepted. Missing field, empty list, non-numeric tokens, booleans, and negative values fail with invalid_input and are not billed. On success the body echoes the cleaned counts, species_count (number of strictly positive entries), total_count N, diversity_index (one minus D), dominance (finite-sample D), plus formula and method strings for display and audit. Pair the numbers with your own species names client-side; this endpoint is deliberately name-free so privacy and localization stay in your user interface.

Where a Simpson diversity API earns its keep

Mobile field apps can call the same parse endpoint from offline-synced count lists once connectivity returns, billing only successful tasks at the published $0.002 base price with no model tokens and no outbound network from the worker.

Classroom and homework checks

Students submit a short species-count vector and compare the returned diversity_index to a hand calculation of one minus D.

Monitoring pipelines and tests

Pin a deterministic Simpson diversity JSON fixture in CI so a changed formula cannot slip into a dashboard unnoticed.

What is the difference between diversity_index and dominance?

dominance is D, the probability two random individuals are the same species. diversity_index is the complement 1−D, the probability they are different species—higher means more diversity.

Why must the total count be at least two?

Finite-sample D divides by N(N−1). With fewer than two individuals you cannot draw a pair, so the index is undefined and the task fails with invalid_input.

What does the Simpson's diversity index calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →