Sensitivity & Specificity Calculator

Sensitivity, specificity and accuracy of a test

How it is calculated

Enter the four cells of the 2×2 table as counts of people: tp (diseased, test positive), fn (diseased, test negative), tn (healthy, test negative) and fp (healthy, test positive). Then:

sensitivity = TP / (TP + FN), specificity = TN / (TN + FP), accuracy = (TP + TN) / (TP + FN + TN + FP)

each shown as a percentage. The counts cannot be negative, and the tool needs at least one diseased person (TP + FN above zero) and at least one healthy person (TN + FP above zero); with only one group it shows nothing. Predictive values are not computed here, because they also depend on how common the condition is in the group tested.

Worked example

300 people were tested: 100 had the condition and 200 did not. The test found 90 of the 100 (TP = 90, FN = 10) and cleared 160 of the 200 (TN = 160, FP = 40).

  1. Sensitivity = 90 / 100 = 90.00%
  2. Specificity = 160 / 200 = 80.00%
  3. Accuracy = (90 + 160) / 300 = 83.33%

The test misses 1 in 10 real cases and wrongly flags 1 in 5 healthy people.

Try this example →

Common mistakes

  • Putting percentages or rates in the boxes: they need counts of people, and the percentages are calculated for you.
  • Swapping false positives and false negatives, which swaps the sensitivity and specificity story.
  • Reading accuracy as the whole picture: if almost everyone is healthy, a test can have high accuracy and still miss most of the sick.
  • Treating sensitivity as the chance that a positive result is correct: that is the positive predictive value, which also depends on how common the condition is.

About this calculator

Every diagnostic test is judged against a 2×2 table of true positives, false positives, true negatives, and false negatives, and from those four counts come the metrics that define how good the test actually is: Sensitivity = TP / (TP + FN), the fraction of people who truly have the condition that the test correctly flags, and Specificity = TN / (TN + FP), the fraction of people without the condition the test correctly clears — with overall accuracy = (TP + TN) / total tested.

These two numbers matter for different reasons: high sensitivity is prioritized for screening tests where missing a real case (a false negative) is dangerous, while high specificity is prioritized when a false positive would trigger unnecessary invasive follow-up, which is why the same underlying test math is applied differently to a cancer screen versus a confirmatory diagnostic assay.

Epidemiologists and biostatisticians evaluating new diagnostic tools, laboratory professionals validating assay performance, and medical and public health students learning test-characteristic statistics all use this calculation as the standard first step in judging any diagnostic test's real-world usefulness.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators