Sensitivity and specificity calculator

Enter the four cells of a diagnostic 2×2 table, true and false positives and negatives, to get sensitivity, specificity, positive and negative predictive values with 95 % Wilson confidence intervals, likelihood ratios, accuracy and the diagnostic odds ratio. Add a prevalence to see the predictive values in another population.

Have the condition, test positive.
Do not have the condition, test positive.
Have the condition, test negative.
Do not have the condition, test negative.
Optional, for example 1 for 1 %. Predictive values depend on it; sensitivity and specificity do not.
Sensitivity (true positive rate)90% (82.56%, 94.48%)
Specificity (true negative rate)95.56% (94%, 96.72%)
Positive predictive value (PPV)
69.23% (60.84%, 76.52%)
Negative predictive value (NPV)
98.85% (97.9%, 99.37%)
Positive likelihood ratio LR+
20.25
Negative likelihood ratio LR−
0.104651
Accuracy
95%
Prevalence in the table
10%
Youden's index J
0.855556
Diagnostic odds ratio
193.5

The ranges in brackets are 95 % Wilson score confidence intervals. PPV and NPV from the table are valid only if its prevalence matches the population where the test is used.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter TP, FP, FN and TN from your 2×2 table (reference standard against test result).
  2. Read sensitivity and specificity at the top, then the predictive values, likelihood ratios and summary measures.
  3. To see how the test would perform where the condition is more or less common, enter that prevalence in percent.

Formulas

  • Sensitivity = TP/(TP + FN), specificity = TN/(TN + FP)
  • PPV = TP/(TP + FP), NPV = TN/(TN + FN)
  • LR+ = sensitivity/(1 − specificity), LR− = (1 − sensitivity)/specificity
  • Accuracy = (TP + TN)/total, Youden’s J = sensitivity + specificity − 1, DOR = (TP·TN)/(FP·FN)
  • At prevalence P: PPV = sens·P / (sens·P + (1 − spec)(1 − P)), NPV = spec·(1 − P) / (spec·(1 − P) + (1 − sens)·P)

Worked example

A test is checked on 1000 people: TP = 90, FP = 40, FN = 10, TN = 860.

  • Sensitivity 90/100 = 90% (95 % CI 82.56% to 94.48%), specificity 860/900 = 95.56%.
  • PPV 90/130 = 69.23%, NPV 860/870 = 98.85%.
  • LR+ = 0.9/0.044444 = 20.25, LR− = 0.104651, accuracy 95%, DOR 193.5.

The table’s prevalence is 10%. In a screening population with 1% prevalence the same test has a PPV of only 16.98% and an NPV of 99.89%.

Tips and common mistakes

  • Make sure rows and columns are not swapped: FP are healthy people with a positive test, FN are ill people with a negative test.
  • Sensitivity and specificity describe the test; PPV and NPV describe a test result in a given population.
  • High accuracy can hide a poor test when the condition is rare: a test that is always negative is 99 % accurate at 1 % prevalence.

Frequently asked questions

What is the difference between sensitivity and specificity?

Sensitivity is the share of people with the condition whom the test catches, TP/(TP + FN). Specificity is the share of people without it whom the test correctly clears, TN/(TN + FP). A sensitive test rarely misses; a specific test rarely raises false alarms.

Why does the PPV change with prevalence?

When the condition is rare, even a small false-positive rate among the many healthy people produces more false positives than there are true ones. In the example, a PPV of 69.23 % at 10 % prevalence falls to 16.98 % at 1 %.

How are likelihood ratios used?

Multiply the pre-test odds by LR+ after a positive result or by LR− after a negative one to get the post-test odds. LR+ above 10 or LR− below 0.1 is usually considered a large change.

Which confidence interval is used?

The Wilson score interval, which behaves well even when a proportion is close to 0 % or 100 % or the counts are small, unlike the simple ±1.96·SE interval.

More in Math

All tools in this category: Math ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.