Specificity Calculator

Calculate specificity (true negative rate) from TP, FP, FN, TN. Includes false positive rate, confidence interval, prevalence-adjusted PPV table, and diagnostic metrics.

Specificity Calculator

Confusion Matrix

Test +Test −
Condition +
Condition −
Specificity (TNR)
99.78%
TN/(TN+FP) = 898/(898+2)
95% CI
[99.47%, 100.00%]
Confidence interval for specificity
False Positive Rate
0.22%
1 − Specificity = FP/(FP+TN)
FP per 1000 Tested
2.2
Expected false positives in 1,000 healthy individuals
Sensitivity
90.00%
True positive rate (for comparison)
Youden\'s J
0.8978
Good discrimination

All Diagnostic Metrics

MetricValue
Specificity99.78%
Sensitivity90.00%
Accuracy98.80%
PPV97.83%
NPV98.90%
LR+405.00
LR−0.1002
False Positive Rate0.22%
False Negative Rate10.00%

Impact of Prevalence on PPV

PrevalencePPVNPVFP per TP
0.10%28.85%99.99%2.5
0.50%67.05%99.95%0.5
1.00%80.36%99.90%0.2
2.00%89.21%99.80%0.1
5.00%95.52%99.48%0.0
10.00%97.83%98.90%0.0
20.00%99.02%97.56%0.0
50.00%99.75%90.89%0.0

Visual: Specificity Gauge

0% (all FP)Spec = 99.8%100% (no FP)
Planning notes, formulas, and examples

About the Specificity Calculator

Specificity is a diagnostic test's ability to correctly identify negative cases — those without the condition. A highly specific test produces few false positives, making it excellent for "ruling in" a diagnosis (SpPIn: Specificity Positive rules In). Specificity is calculated as TN/(TN+FP), the proportion of true negatives among all actual negatives.

This calculator computes specificity and its confidence interval from a confusion matrix, along with the false positive rate (1 − specificity), and shows how poor specificity at low prevalence can make PPV unacceptably low. The prevalence-impact table demonstrates how many false positives per true positive you can expect at different disease rates.

Specificity analysis is critical in clinical diagnostics, drug screening, security detection, industrial quality control, and any binary classification system where false alarms have significant consequences.

When This Page Helps

False positives have real costs: unnecessary follow-up testing, psychological distress from false positive cancer screens, wrongful drug test accusations, and wasted resources on false security alerts. This calculator quantifies these risks by computing the FPR, the expected false positives per 1,000 tested, and prevalence-adjusted predictive values. This calculator handles the repetitive math so you can compare scenarios, verify assumptions, and focus on interpreting the result.

How to Use the Inputs

  1. Enter the confusion matrix: TP, FP, FN, TN from your test results.
  2. Or select a preset for common diagnostic test scenarios.
  3. Review the specificity value and its 95% CI.
  4. Check the false positive rate and FP per 1,000 tested.
  5. Examine the prevalence table to understand real-world performance.
  6. Compare sensitivity to see the trade-off between detecting positives and avoiding false alarms.
  7. Assess Youden's J for overall discriminating ability.
Formula used
Specificity (True Negative Rate): TNR = TN / (TN + FP) False Positive Rate: FPR = FP / (FP + TN) = 1 − Specificity 95% CI for Specificity: TNR ± 1.96 × √(TNR(1−TNR) / (TN+FP)) Prevalence-adjusted PPV: PPV = (Sens × Prev) / (Sens × Prev + FPR × (1−Prev)) FP per TP ratio: = FPR × (1 − Prev) / (Sens × Prev)

Example Calculation

Result: Specificity = 99.78%

With 898 true negatives and only 2 false positives among 900 negative individuals, specificity is 99.78%. The FPR is just 0.22%, meaning approximately 2.2 false positives per 1,000 healthy people tested. At even 1% prevalence, the PPV would be 80.4%.

Tips & Best Practices

  • A specificity of 99% sounds excellent but still produces 10 false positives per 1,000 clean tests — potentially problematic for mass screening.
  • When comparing tests, even small specificity differences have huge impacts at low prevalence.
  • Confirmatory tests (second-stage diagnostic) should prioritize specificity over sensitivity.
  • The false positive rate directly determines how many unnecessary follow-ups your testing program generates.
  • Specificity is fixed by the test characteristics and doesn't change with prevalence, but PPV does.
  • Drug tests, security screening, and rare disease screening all demand very high specificity (>99%) to be useful.

The Specificity-PPV Crisis in Mass Screening

Consider screening a million people for a disease with 0.1% prevalence using a 95% sensitivity, 99% specificity test. Expected results: 950 true positives, 50 false negatives, 9,990 false positives, 989,010 true negatives. PPV = 950/(950+9,990) = 8.7%. Over 90% of positive results are false! This is why ultra-high specificity (>99.9%) is required for effective mass screening of rare conditions.

Two-Stage Testing Strategy

A powerful approach uses sequential testing. The first test has high sensitivity (catches all cases); the second has high specificity (eliminates false positives). If Test 1 has 99% sensitivity and 90% specificity, and Test 2 has 95% specificity, the combined specificity is approximately 90% × 95% + 10% × 5% = 99.5%, dramatically reducing false positives.

Specificity in Machine Learning

In ML classification, specificity equals the true negative rate and is particularly important for imbalanced datasets. The ROC curve plots sensitivity (true positive rate) against 1−specificity (false positive rate) across all classification thresholds, providing a threshold-independent assessment of model performance.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Specificity measures the proportion of actual negatives that are correctly identified by the test. A specificity of 99% means that among 100 healthy people, 99 will correctly test negative and 1 will have a false positive result.