Sensitivity & Specificity Calculator

Calculate sensitivity, specificity, PPV, NPV, likelihood ratios, and Youden's J from a confusion matrix. Includes PPV/NPV table at different prevalence levels.

Sensitivity & Specificity Calculator

Confusion Matrix

Test +Test −
Disease +
Disease −
Sensitivity (Recall)
85.00%
TP/(TP+FN) = 85/(85+15) — 95% CI: [78.0%, 92.0%]
Specificity
99.44%
TN/(TN+FP) = 895/(895+5) — 95% CI: [99.0%, 99.9%]
PPV (Precision)
94.44%
TP/(TP+FP) = 85/(85+5) — at observed prevalence
NPV
98.35%
TN/(TN+FN) = 895/(895+15)
LR+
153.00
Positive likelihood ratio: how much a + test increases odds
LR−
0.1508
Negative likelihood ratio: how much a − test decreases odds

Complete Diagnostic Metrics

MetricValueInterpretation
Accuracy98.00%Overall correct classification rate
Prevalence (observed)10.00%Proportion with condition in sample
False Positive Rate0.56%1 − Specificity
False Negative Rate15.00%1 − Sensitivity (miss rate)
Youden\'s J0.8444Good discriminating ability (−1 to +1)
Diagnostic Odds Ratio1,014.33Higher = better discrimination

PPV & NPV at Different Prevalence Levels

PrevalencePPVNPV
0.10%13.28%99.98%
1.00%60.71%99.85%
5.00%88.95%99.21%
10.00%94.44%98.35%
20.00%97.45%96.37%
50.00%99.35%86.89%

Visual: Confusion Matrix

TP: 85
FN: 15
FP: 5
TN: 895
Planning notes, formulas, and examples

About the Sensitivity & Specificity Calculator

Sensitivity and specificity are the core measures of diagnostic test performance. Sensitivity measures how well a test detects the condition when it is present, while specificity measures how well it rejects the condition when it is absent.

This calculator takes a 2×2 confusion matrix and computes sensitivity, specificity, predictive values, likelihood ratios, Youden's J, diagnostic odds ratio, and confidence intervals. It also shows how PPV and NPV shift with prevalence, which matters a lot when a test is used for screening rather than confirmation.

That gives you a more complete picture than accuracy alone, especially for medical tests and other binary classifiers.

When This Page Helps

Diagnostic tests are rarely judged by one number alone. Sensitivity, specificity, and prevalence-adjusted predictive values answer different questions, so seeing them together helps separate a good screening test from a good confirmatory test.

How to Use the Inputs

  1. Enter the four cells of the confusion matrix: TP, FP, FN, TN.
  2. Or click a preset for common diagnostic scenarios.
  3. Optionally enter a custom prevalence to include in the PPV/NPV table.
  4. Set the confidence level for interval estimates.
  5. Review sensitivity, specificity, and predictive values.
  6. Examine likelihood ratios for clinical utility assessment.
  7. Check the PPV/NPV table at different prevalence levels.
Formula used
Sensitivity = TP / (TP + FN) Specificity = TN / (TN + FP) PPV = TP / (TP + FP) NPV = TN / (TN + FN) Likelihood Ratios: LR+ = Sensitivity / (1 − Specificity) LR− = (1 − Sensitivity) / Specificity Prevalence-adjusted PPV: PPV = (Sens × Prev) / (Sens × Prev + (1−Spec) × (1−Prev)) Youden's J = Sensitivity + Specificity − 1

Example Calculation

Result: Sensitivity = 85.0%, Specificity = 99.4%

With 85 true positives, 5 false positives, 15 false negatives, and 895 true negatives: sensitivity is 85% (catches 85% of diseased patients) and specificity is 99.4% (correctly identifies 99.4% of healthy patients). LR+ = 152.2, indicating a positive result is very informative.

Tips & Best Practices

  • A sensitive test (high sensitivity) is good for "ruling out" — if the test is negative, the condition is unlikely (SnNOut mnemonic).
  • A specific test (high specificity) is good for "ruling in" — if the test is positive, the condition is likely (SpPIn mnemonic).
  • PPV depends heavily on prevalence. Even highly specific tests produce many false positives when screening low-prevalence conditions.
  • LR+ > 10 and LR− < 0.1 indicate a very useful diagnostic test.
  • Youden's J = 0 means the test is useless (no better than flipping a coin). J = 1 means perfect discrimination.
  • Never rely on accuracy alone for imbalanced conditions — a rare disease test that always says "negative" has high accuracy but zero sensitivity.

The Base Rate Fallacy and Screening Programs

When screening for rare conditions (low prevalence), even highly accurate tests produce more false positives than true positives. If a disease affects 1 in 1,000 people and the test has 99% sensitivity and 99% specificity, a positive result still only means ~9% chance of disease (PPV ≈ 9%). This counter-intuitive result is the base rate fallacy, and the prevalence table in this calculator makes it explicit.

ROC Analysis and Threshold Selection

Sensitivity and specificity depend on the chosen diagnostic threshold. Lowering the threshold increases sensitivity but decreases specificity (more false alarms). The ROC curve plots all possible sensitivity-specificity pairs. Youden's J maximizes the sum of sensitivity and specificity, providing one optimal threshold. Other criteria weight false positives and false negatives differently.

Multi-Step Diagnostic Strategies

In practice, single tests are often insufficient. A common strategy uses a sensitive screening test followed by a specific confirmatory test. The first test catches most cases (high sensitivity); the second test weeds out false positives (high specificity). Serial testing multiplies specificities and reduces overall false positive rate at the cost of some sensitivity.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Sensitivity = P(test positive | disease present) — how well the test detects disease. PPV = P(disease present | test positive) — how likely disease is given a positive test. They answer different questions and are affected differently by prevalence.