Sensitivity and Specificity Calculator

Sensitivity & Specificity Calculator

Calculate sensitivity, specificity, PPV, NPV, likelihood ratios, accuracy, F1 score, and prevalence from a 2×2 confusion matrix. Built for diagnostic tests, screening programs, medical research, and any binary classification task.

Last updated: March 2026

Confusion Matrix

Condition +
Condition −
Test +

TP

FP

Test −

FN

TN

Enter valid non-negative whole-number counts for TP, FP, FN, and TN.

Sensitivity
80.0%
Specificity
90.0%
PPV (Precision)88.9%
NPV81.8%
Accuracy85.0%
F1 Score0.8421
LR+ (Likelihood Ratio +)8.000
LR− (Likelihood Ratio −)0.222
Prevalence50.0%
Total Cases (n)200

What are Sensitivity & Specificity?

Sensitivity and specificity are the core measures used to evaluate diagnostic tests and binary classification systems. Sensitivity measures how well a test detects people who have a condition, while specificity measures how well it correctly excludes people who do not have the condition.

These metrics come from a 2×2 confusion matrix consisting of true positives (TP), false positives (FP), false negatives (FN), and true negatives (TN). From these four values, all major performance metrics can be calculated.

Sensitivity = TP / (TP + FN): of all people with the condition, how many tested positive? Specificity = TN / (FP + TN): of all people without the condition, how many tested negative?

How to Use This Calculator

Enter the 2×2 Matrix

TP: Has condition and tests positive

FP: No condition but tests positive

FN: Has condition but tests negative

TN: No condition and tests negative

Formulas Used

Sensitivity = TP / (TP + FN)
Specificity = TN / (FP + TN)
PPV = TP / (TP + FP)
NPV = TN / (TN + FN)
Accuracy = (TP + TN) / (TP + FP + FN + TN)
Prevalence = (TP + FN) / total
F1 Score = 2TP / (2TP + FP + FN)
LR+ = Sensitivity / (1 − Specificity)
LR− = (1 − Sensitivity) / Specificity

Worked Example (Step-by-Step)

Example: Diagnostic Test on 200 People

TP = 80
FP = 10
FN = 20
TN = 90
Sensitivity = 80 / (80 + 20) = 80%
Specificity = 90 / (10 + 90) = 90%
PPV = 80 / (80 + 10) = 88.9%
NPV = 90 / (90 + 20) = 81.8%
Accuracy = (80 + 90) / 200 = 85%
Prevalence = (80 + 20) / 200 = 50%
LR+ = 0.8 / (1 − 0.9) = 8.0
LR− = (1 − 0.8) / 0.9 = 0.22
The test detects most true cases and correctly excludes most healthy individuals. A positive result is highly reliable, while a negative result is moderately reliable. The likelihood ratios indicate strong evidence when ruling in disease and moderate strength when ruling it out.

How to Interpret These Metrics

Sensitivity vs Specificity

High sensitivity minimizes missed cases and is especially useful for screening. High specificity minimizes false positives and is especially useful for confirmation. Most real-world tests involve a tradeoff between the two.

PPV & NPV Depend on Prevalence

Predictive values change depending on how common the condition is. Even highly accurate tests can have low PPV in rare diseases, because false positives may outnumber true positives.

Why Accuracy Can Mislead

Accuracy can look impressive in imbalanced populations while still hiding poor case detection. Always interpret accuracy alongside sensitivity and specificity rather than using it alone.

Likelihood Ratios

LR+ shows how much a positive result increases the odds of disease, while LR− shows how much a negative result decreases it. These are especially useful when moving from test performance to clinical decision-making.

Frequently Asked Questions

What is the difference between sensitivity and PPV?

Sensitivity measures how well a test detects disease among people who truly have it. PPV measures how likely a positive result is to be correct among all positive results.

Can a test have both high sensitivity and high specificity?

Yes. Some tests perform strongly on both measures, although changing the test threshold often creates a tradeoff between catching more true cases and avoiding more false positives.

Why do PPV and NPV change with prevalence?

Because predictive values depend on how many true cases exist in the tested population. As prevalence changes, the balance between true and false results changes too.

Why not use accuracy alone?

Accuracy can be misleading when one class is much more common than the other. A test may look accurate overall while still missing many real cases.

What do likelihood ratios tell me?

Likelihood ratios show how much a positive or negative result changes the odds of disease. They are especially useful for translating test performance into clinical interpretation.

When is high sensitivity more important than high specificity?

High sensitivity matters most when missing a case is costly, such as in early screening. High specificity matters more when false positives would lead to unnecessary follow-up or treatment.

Related Tools