Skip to content

Sensitivity & Specificity Calculator

Enter true positives, false positives, false negatives and true negatives to get sensitivity, specificity, predictive values, likelihood ratios, the diagnostic odds ratio, accuracy, F1 and Youden's J — each proportion with a Wilson 95% confidence interval. A second mode starts from sensitivity, specificity and prevalence and shows, person by person, why a positive result means less when a condition is rare. Free, no sign-up, and it runs in your browser.

Start from
Rows: the test result. Columns: the reference standard. Enter whole-number counts without thousands separators.
Condition presentCondition absentTotal
Test positive0
Test negative0
Total000

Enter TP, FP, FN and TN to see sensitivity, specificity, predictive values and likelihood ratios.

How to Use the Sensitivity & Specificity Calculator

  1. 1. Choose your starting point. Use A 2 × 2 table of counts when you have study data, or Sensitivity, specificity and prevalence when you know the test's characteristics and want predictive values for a particular population.
  2. 2. Enter the counts. Compare every test result with the reference standard: true positives (TP), false positives (FP), false negatives (FN) and true negatives (TN). Row and column totals fill in so you can check them.
  3. 3. Read the table of measures. Each proportion comes with a Wilson 95% confidence interval; likelihood ratios and the diagnostic odds ratio use the log method.
  4. 4. Explore prevalence. In the second mode, change the prevalence and watch the positive predictive value move while sensitivity and specificity stay fixed.

Formulas: What Each Measure Tells You

MeasureFormulaQuestion it answers
SensitivityTP / (TP + FN)Of people with the condition, what share test positive?
SpecificityTN / (TN + FP)Of people without it, what share test negative?
Positive predictive valueTP / (TP + FP)If the test is positive, how likely is the condition?
Negative predictive valueTN / (TN + FN)If the test is negative, how likely is its absence?
Positive likelihood ratioSensitivity / (1 − specificity)How much does a positive result raise the odds?
Negative likelihood ratio(1 − sensitivity) / specificityHow much does a negative result lower the odds?
Diagnostic odds ratio(TP × TN) / (FP × FN)One-number summary of discrimination, LR+ / LR−
Youden's JSensitivity + specificity − 1How far above a useless test (J = 0)?
F1 score2TP / (2TP + FP + FN)Harmonic mean of PPV and sensitivity

Proportions get Wilson score intervals, which stay inside 0–100% and behave well when a value is near 100%, where the simple Wald interval fails. Likelihood ratios use the log method of Simel, Samsa and Matchar (1991): SE(ln LR+) = √(1/TP − 1/(TP + FN) + 1/FP − 1/(FP + TN)), with the mirror-image formula for LR−.

Worked Example: A Rapid Test in 1,000 People

A rapid test is checked against a laboratory reference in 1,000 people, 100 of whom have the infection. It is positive in 90 of the 100 (TP = 90, FN = 10) and in 40 of the 900 without it (FP = 40, TN = 860). Press Load example to enter these counts.

MeasureEstimate95% CI
Sensitivity90.0%82.6% – 94.5%
Specificity95.6%94.0% – 96.7%
Positive predictive value69.2%60.8% – 76.5%
Negative predictive value98.9%97.9% – 99.4%
Positive likelihood ratio20.2514.85 – 27.61
Negative likelihood ratio0.100.06 – 0.19

Sensitivity is 90 / 100 = 90.0% and specificity 860 / 900 = 95.6%. Of the 130 positive results, 90 are correct, so PPV = 69.2%. A positive result multiplies the odds of infection by about 20 (LR+ = 0.900 / (40/900) = 20.25), and a negative result cuts them to about a tenth (LR− = 0.10). Youden's J is 0.856 and the diagnostic odds ratio 193.5.

Why the Positive Predictive Value Collapses at Low Prevalence

Sensitivity and specificity belong to the test; predictive values belong to the test and the population. Switch to the second mode and enter a sensitivity of 90%, a specificity of 95% and a prevalence of 1%, as in community screening. Out of 10,000 people, 100 have the condition and 90 of them test positive. Of the 9,900 who do not, 5% — 495 people — also test positive. So only 90 of the 585 positive results are real, and PPV = 15.4%, even though the test is the same one.

Sensitivity 90%, specificity 95%
PrevalencePPVNPV
0.1%1.8%100.0%
1%15.4%99.9%
5%48.6%99.4%
10%66.7%98.8%
20%81.8%97.4%
50%94.7%90.5%

This is Bayes' theorem at work: PPV = Se·π / (Se·π + (1 − Sp)(1 − π)), where π is the prevalence. When a condition is rare, the few true positives are swamped by false positives from the much larger healthy group, which is why screening programmes confirm positive results with a second, more specific test. (At 0.1% prevalence, NPV is 99.99%, shown rounded to 100.0%.)

Reporting and Common Mistakes

The STARD 2015 guidelines for diagnostic accuracy studies ask for the 2 × 2 table and estimates with 95% confidence intervals. A results sentence might read: "Sensitivity was 90.0% (95% CI 82.6–94.5%) and specificity 95.6% (95% CI 94.0–96.7%)." The Copy result button produces that line with the predictive values added.

  • Quoting PPV and NPV from a case-control sample. If you recruited 100 patients and 100 controls, the sample prevalence is 50% by design and the predictive values do not apply to anyone. Recompute them at a realistic prevalence.
  • Confusing sensitivity with PPV. Sensitivity is about people who have the condition; PPV is about people who test positive. They answer different questions.
  • Treating accuracy as the headline. With a rare condition, a test that calls everyone negative scores high accuracy and is useless. Report sensitivity and specificity separately.
  • Ignoring imperfect reference standards. If the reference test misses cases, every measure here is biased; say what the reference was.

Frequently Asked Questions

What is the difference between sensitivity and specificity?
Sensitivity is the share of people with the condition whom the test correctly calls positive; specificity is the share of people without it whom the test correctly calls negative. A highly sensitive test rarely misses cases, so a negative result helps rule the condition out. A highly specific test rarely raises false alarms, so a positive result helps rule it in.
Why do positive and negative predictive values change with prevalence?
Because they depend on how many people in the tested group have the condition. At low prevalence, even a small false-positive rate applied to the large healthy group produces more false positives than there are true positives, so PPV falls; NPV rises. Sensitivity and specificity, by contrast, do not change with prevalence in principle.
What is a good likelihood ratio?
A common guide treats LR+ above 10 and LR− below 0.1 as large, conclusive shifts in probability; 5–10 and 0.1–0.2 as moderate; 2–5 and 0.2–0.5 as small; and values near 1 as useless. Multiply the pre-test odds by the likelihood ratio to get the post-test odds, which is what makes likelihood ratios portable between populations.
How are the confidence intervals calculated?
Each proportion — sensitivity, specificity, PPV, NPV, accuracy and prevalence — uses the Wilson score interval. Likelihood ratios and the diagnostic odds ratio use the log method: the interval is built on the log scale and exponentiated. Intervals assume the cases are independent; clustered data, such as several lesions per patient, need wider ones.
What happens if one of the cells is zero?
Proportions still get a Wilson interval, which handles 0% and 100% gracefully. Likelihood ratios and the diagnostic odds ratio can become infinite or have undefined intervals: if FP is 0, LR+ is infinite and is shown as not estimable. Some researchers add 0.5 to each cell in that case; if you do, say so.
Is sensitivity the same as recall, and PPV the same as precision?
Yes. Machine-learning papers call sensitivity recall and PPV precision, and the F1 score is their harmonic mean. Specificity is sometimes called the true negative rate, and 1 − specificity the false positive rate.

Related Tools

More in Statistics Calculators

See all Statistics Calculators