Sensitivity and Specificity Calculator

Calculate sensitivity, specificity, predictive values, and diagnostic accuracy from a confusion matrix.

Diagnostic test accuracy
Enter the four outcome counts from your diagnostic test.

About sensitivity and specificity

Sensitivity and specificity describe how well a diagnostic test separates people or cases with a condition from those without it. The calculation begins with a confusion matrix containing four counts. True positives are affected cases correctly classified as positive, while false negatives are affected cases that the test misses. True negatives are unaffected cases correctly classified as negative, while false positives are unaffected cases incorrectly flagged as positive. Keeping these groups distinct makes the meaning of every result clear. Sensitivity, also called the true positive rate or recall, is TP divided by TP plus FN. It answers: among all cases that truly have the condition, what proportion did the test detect? A highly sensitive screening test produces few false negatives. Specificity, also called the true negative rate, is TN divided by TN plus FP. It answers: among all cases that truly do not have the condition, what proportion did the test correctly reject? A highly specific confirmation test produces few false positives. Positive predictive value is TP divided by TP plus FP, and negative predictive value is TN divided by TN plus FN. These predictive values describe the probability that an observed result is correct in the tested population. Unlike sensitivity and specificity, they can change substantially when condition prevalence changes. A positive result from the same assay may therefore have a different predictive value in a high-risk clinic than in broad population screening. Accuracy is TP plus TN divided by all observations. It is easy to understand, but it can hide poor minority-class performance when one outcome is much more common. Use integer counts from one consistent study population and the same decision threshold. Do not enter percentages in place of counts. When comparing tests, consider confidence intervals, sample size, prevalence, study design, and the consequences of each error type rather than selecting the largest single percentage. Medical decisions also require clinical context, validated thresholds, and professional judgment. This calculator provides deterministic point estimates for education, research checks, quality assurance, and machine-learning classification review; it does not replace a complete statistical analysis or clinical interpretation.

Sensitivity and specificity examples

These confusion matrices illustrate common diagnostic performance patterns.

Confusion matrixKey resultsInterpretation
TP 80, FP 10, TN 90, FN 20Sensitivity 80%; specificity 90%; accuracy 85%The test detects four in five affected cases and correctly rejects nine in ten unaffected cases.
TP 95, FP 20, TN 180, FN 5Sensitivity 95%; specificity 90%; accuracy 91.67%High sensitivity makes this result pattern useful when missed cases are especially costly.
TP 40, FP 5, TN 95, FN 10Sensitivity 80%; specificity 95%; accuracy 90%The low false-positive count produces high specificity and an 88.89% positive predictive value.

How to calculate diagnostic accuracy

  1. Count the true-positive, false-positive, true-negative, and false-negative outcomes from one test population.
  2. Enter each non-negative count in its matching field.
  3. Select Calculate Metrics to compute sensitivity, specificity, predictive values, and accuracy.
  4. Interpret the metrics together and consider prevalence, sample size, and the cost of each error.

Sensitivity and specificity FAQ

What is the difference between sensitivity and specificity?

Sensitivity measures the share of actual positive cases that a test detects. Specificity measures the share of actual negative cases that it correctly rejects.

What is a good sensitivity or specificity?

There is no universal cutoff because acceptable performance depends on the use case and the consequences of errors. Screening often prioritizes sensitivity, while confirmation may prioritize specificity.

Why do predictive values change with prevalence?

Predictive values condition on the test result, so the proportion of affected people in the tested population matters. Positive predictive value usually rises as prevalence rises, even if sensitivity and specificity stay fixed.

Can accuracy be misleading?

Yes, especially when one class is much more common than the other. A classifier can have high accuracy while performing poorly on the rare but important class.

Can I enter percentages instead of counts?

No, enter the four observed counts from the confusion matrix. The calculator converts those counts into percentages using the appropriate denominators.