Skip to main content

Specificity and Sensitivity Calculator

In diagnostic testing, clinical screening, and binary classification, specificity measures the proportion of true negatives correctly identified by a test.

Condition present and test result positive.

Condition present but test result negative (missed cases).

Condition absent and test result negative.

Condition absent but test result positive (false alarms).

Calculated Result
90%

Specificity (True Negative Rate)

Sensitivity (Recall, TPR)

85%

Specificity (TNR)

90%

Positive Predictive Value (PPV, Precision)

80.95%

Negative Predictive Value (NPV)

92.31%

Accuracy

88.33%

F1 Score

0.8293

Matthews Correlation Coefficient (MCC)

0.7412

Positive Likelihood Ratio (LR+)

8.5

Negative Likelihood Ratio (LR-)

0.167

Diagnostic Odds Ratio (DOR)

51

Prevalence

33.33%

Total Cases

300

Spec 90% | Sens 85% — PPV 81% | NPV 92.3% | LR+ 8.5

Calculation Breakdown

  1. Verify the contingency tableTP=85, FN=15, TN=180, FP=20. Total = 300.TP + FN + TN + FP = N
  2. Calculate Sensitivity (True Positive Rate)TP / (TP + FN) = 85 / 100 = 0.85Sensitivity = TP / (TP + FN)
  3. Calculate Specificity (True Negative Rate)TN / (TN + FP) = 180 / 200 = 0.9Specificity = TN / (TN + FP)
  4. Calculate Predictive ValuesPPV = TP / (TP + FP) = 0.8095. NPV = TN / (TN + FN) = 0.9231PPV = TP / (TP + FP), NPV = TN / (TN + FN)
  5. Calculate Likelihood RatiosLR+ = Sensitivity / (1 - Specificity) = 8.5. LR- = (1 - Sensitivity) / Specificity = 0.167LR+ = TPR / FPR, LR- = FNR / TNR
  6. Calculate Diagnostic Odds RatioDOR = (TP × TN) / (FP × FN) = 51DOR = LR+ / LR- = (TP × TN) / (FP × FN)

Diagnostic Test Metrics

Interactive visualization based on your current inputs

Percentage
0.023466992SpecificitySensitivityPPVNPVMetricPercentage (%)

What Is the Specificity and Sensitivity Calculator?

Specificity, also known as the True Negative Rate (TNR), quantifies a diagnostic test’s capacity to identify individuals who do not possess a target disease or trait.

A test with 100% specificity never generates false positive diagnoses, meaning every identified negative case is truly disease-free.

How Does the Specificity and Sensitivity Calculator Work?

Test subjects are categorized into a 2x2 contingency matrix comparing actual health status against test readings.

Specificity divides True Negatives by the total number of individuals without the disease (TN + FP).

Sensitivity divides True Positives by the total number of individuals with the disease (TP + FN).

Likelihood ratios and diagnostic odds ratios are synthesized from the sensitivity and specificity values.

Specificity and Sensitivity Calculator Formula & Variables

The core mathematical equation utilized by this calculator is expressed as:

Specificity=TNTN+FP,Sensitivity=TPTP+FN\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}}, \quad \text{Sensitivity} = \frac{\text{TP}}{\text{TP} + \text{FN}}

Variable Definitions

SymbolVariable Meaning & Units
TNTrue Negatives (healthy individuals correctly identified as negative)
FPFalse Positives (healthy individuals incorrectly identified as positive)
TPTrue Positives (affected individuals correctly identified as positive)
FNFalse Negatives (affected individuals incorrectly identified as negative)

Specificity measures the true negative rate: the probability that a healthy individual tests negative. Sensitivity measures the true positive rate: the probability that an affected person tests positive.

How to Use the Specificity and Sensitivity Calculator

  1. Enter the counts of True Positives and False Negatives from your trial.
  2. Enter the counts of True Negatives and False Positives.
  3. Review the calculated Sensitivity and Specificity percentages.
  4. Check PPV, NPV, and likelihood ratios to understand clinical utility.

Step-by-Step Example Calculation

Clinical screening test evaluation with 300 subjects

Input Values:

tp:90
fn:10
tn:160
fp:40
Worked Steps: With 160 TN and 40 FP, specificity is 80.00%. With 90 TP and 10 FN, sensitivity is 90.00%. Accuracy is 83.33%.

Understanding Your Result

Specificity above 95% indicates an outstanding ability to rule in a condition when positive (SpPIn rule).

High sensitivity rules out a condition when negative (SnNOut rule).

The Youden index (Sensitivity + Specificity - 1) summarizes overall effectiveness from 0 to 1.

Factors That Affect the Result

  • Threshold/Cutoff selection: raising the positive threshold increases specificity but lowers sensitivity.
  • Spectrum bias: testing only severe cases and clear healthy controls artificially inflates metrics.
  • Sample size: small cohorts lead to wide confidence intervals for both metrics.

When Should You Use This Calculator?

  • Evaluating diagnostic medical tests and clinical laboratory assays.
  • Benchmarking machine learning classifiers on imbalanced test datasets.
  • Auditing screening protocols in epidemiological studies.

Assumptions & Limitations

  • Requires an established reference standard ("gold standard") to define true condition status.
  • Assumes binary classification without ambiguous or inconclusive test results.

Frequently Asked Questions

Calculation Accuracy & Reference Note

All ratios, predictive metrics, and diagnostic odds ratios are calculated to full double precision.

Standard Reference: Altman, D. G., & Bland, J. M. (1994). "Diagnostic tests 1: Sensitivity and specificity." BMJ, 308(6943), 1552.

Explore more tools and calculators in Statistics Calculators