Skip to main content

Sensitivity & Specificity Calculator

Ready to calculate
Full 2×2 Table Analysis.
PPV · NPV · Accuracy.
Likelihood Ratios.
100% Free.
No Data Stored.

How it Works

01Enter 2×2 Table Values

Input TP, FP, FN, TN from your diagnostic test evaluation.

02Compute All Metrics

Sensitivity, specificity, PPV, NPV, and accuracy computed instantly.

03Get Likelihood Ratios

LR+ and LR− quantify diagnostic strength of positive and negative results.

04Youden's Index

J = Sensitivity + Specificity − 1 summarizes overall diagnostic performance.

Introduction

The sensitivity and specificity calculator provides a comprehensive evaluation of diagnostic test performance from a 2×2 contingency table. By entering the counts of true positives (TP), false positives (FP), false negatives (FN), and true negatives (TN), this tool computes all key diagnostic accuracy metrics: sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), accuracy, likelihood ratios, and Youden's index.

No other two metrics are more fundamental to evaluating a diagnostic test than sensitivity and specificity. Together, they characterize the complete discriminatory ability of a test across all possible outcome combinations. They are properties of the test itself — independent of disease prevalence — making them the gold standard for comparing tests across different populations.

This comprehensive calculator goes beyond simple sensitivity and specificity computation. It computes positive and negative predictive values (which depend on prevalence), positive and negative likelihood ratios (which quantify the diagnostic value of a test result), overall accuracy, and Youden's J index (sensitivity + specificity − 1), a single metric summarizing overall diagnostic performance.

The complete 2×2 table analysis is the foundation of evidence-based medicine, clinical trial analysis, machine learning classifier evaluation, and any binary classification problem. Whether you are evaluating a new COVID-19 test, validating a machine learning model, or assessing a quality control inspection procedure, this calculator provides the complete diagnostic picture.

All results include confidence intervals where applicable, helping you quantify the uncertainty in your estimates based on sample size.

The formula

From 2×2 Table (TP, FP, FN, TN):

Sensitivity = TP / (TP + FN)
Specificity = TN / (TN + FP)
PPV = TP / (TP + FP)
NPV = TN / (TN + FN)
Accuracy = (TP + TN) / (TP + FP + FN + TN)
Prevalence = (TP + FN) / Total

Likelihood Ratios:
LR+ = Sensitivity / (1 − Specificity)
LR− = (1 − Sensitivity) / Specificity

Youden's Index:
J = Sensitivity + Specificity − 1

Real-World Example

Calculation In Practice

Example: PCR Test Evaluation
Tested 1,000 patients (500 confirmed positive, 500 confirmed negative):
  • TP = 475, FN = 25 (sensitivity group)

  • TN = 470, FP = 30 (specificity group)
  • Sensitivity = 475/500 = 0.950 (95%)
    Specificity = 470/500 = 0.940 (94%)
    PPV = 475/(475+30) = 93.1%
    NPV = 470/(470+25) = 94.9%
    Accuracy = (475+470)/1000 = 94.5%
    LR+ = 0.95/(1−0.94) = 15.83
    LR− = (1−0.95)/0.94 = 0.053
    Youden's J = 0.95 + 0.94 − 1 = 0.89

    Typical Use Cases

    1

    Clinical Diagnostic Test Validation

    Full accuracy analysis of new medical tests before regulatory approval and clinical adoption.
    2

    COVID-19 and Infectious Disease Tests

    Comprehensive PCR, antigen, and antibody test performance evaluation.
    3

    Machine Learning Model Evaluation

    Compute all classification metrics from the confusion matrix for binary classifiers.
    4

    Quality Control Inspection Systems

    Evaluate automated inspection accuracy in detecting defective vs compliant products.
    5

    Security Threat Detection

    Assess intrusion detection sensitivity, specificity, and accuracy for cybersecurity systems.

    Technical Reference

    Complete Metric Reference:
  • TP Rate (Sensitivity) = TP/(TP+FN)

  • TN Rate (Specificity) = TN/(TN+FP)

  • FP Rate = FP/(FP+TN) = 1−Specificity

  • FN Rate = FN/(FN+TP) = 1−Sensitivity

  • PPV (Precision) = TP/(TP+FP)

  • NPV = TN/(TN+FN)

  • F1 Score = 2×PPV×Sensitivity/(PPV+Sensitivity)

  • Matthews Correlation: MCC = (TP×TN−FP×FN)/√[(TP+FP)(TP+FN)(TN+FP)(TN+FN)]
  • Confidence Intervals (Wilson method recommended):
    For proportions: use Wilson score or Clopper-Pearson exact method

    Key Takeaways

    The combined sensitivity-specificity calculator delivers the complete diagnostic picture from a single 2×2 table entry. Sensitivity and specificity characterize the test; PPV and NPV characterize the test result in the context of your population's disease prevalence; likelihood ratios quantify the strength of evidence for or against a condition.

    Youden's index (J = Sensitivity + Specificity − 1) provides a single summary of overall test quality, ranging from 0 (no diagnostic value) to 1 (perfect). It is the most commonly used single metric for selecting the optimal classification threshold on an ROC curve.

    For decision-making in clinical contexts, always pair these metrics with clinical consequences: what is the harm of a false negative? A false positive? This context determines the optimal sensitivity-specificity tradeoff for any diagnostic test or screening program.

    Frequently Asked Questions

    What is the 2x2 contingency table?
    A 2×2 table cross-classifies test results (positive/negative) against true conditions (positive/negative), producing four cells: TP, FP, FN, TN. All diagnostic metrics derive from these four numbers.
    What is PPV and how does it differ from sensitivity?
    PPV (positive predictive value) = TP/(TP+FP): the probability the condition is present given a positive test. Sensitivity = TP/(TP+FN): the probability of a positive test given the condition is present. PPV depends on prevalence; sensitivity does not.
    What is NPV?
    NPV (negative predictive value) = TN/(TN+FN): the probability the condition is absent given a negative test. High NPV is desirable when you need to rule out a condition.
    What is accuracy in diagnostic testing?
    Accuracy = (TP+TN)/Total: the fraction of all test results that are correct. However, accuracy can be misleading for rare conditions — a test that always says "negative" is 99% accurate if prevalence is 1%.
    What is Youdens index?
    Youden's J = Sensitivity + Specificity − 1. It ranges from 0 (no discrimination) to 1 (perfect). It is the vertical distance from the ROC curve to the diagonal chance line.
    What are likelihood ratios?
    LR+ = Sensitivity/(1−Specificity): how much a positive result increases the odds of disease. LR− = (1−Sensitivity)/Specificity: how much a negative result decreases odds. LR+ > 10 or LR− < 0.1 are considered strong evidence.
    How does prevalence affect PPV?
    Even with high sensitivity and specificity, PPV falls dramatically at low prevalence. At 1% prevalence with 95% sensitivity and 95% specificity, PPV is only about 16% — most positive results are false positives.
    What is the F1 score?
    F1 = 2×(PPV×Sensitivity)/(PPV+Sensitivity). It is the harmonic mean of precision (PPV) and recall (sensitivity), widely used in machine learning to balance both metrics.
    What is the Matthews Correlation Coefficient (MCC)?
    MCC is a balanced metric for binary classification, accounting for all four cells of the confusion matrix. It ranges from −1 (perfect misclassification) to +1 (perfect classification), with 0 indicating random chance.
    When should I use accuracy vs sensitivity/specificity?
    Accuracy is appropriate for balanced datasets. For imbalanced datasets (rare conditions), accuracy is misleading — use sensitivity, specificity, PPV, NPV, or AUC instead.

    Author Spotlight

    The ToolsACE Team - ToolsACE.io Team

    The ToolsACE Team

    Our specialized research and development team at ToolsACE brings together decades of collective experience in financial engineering, data analytics, and high-performance software development.

    Statistical AnalysisSoftware Engineering Team