Sensitivity and Specificity Calculator
Enter the true positive, false positive, false negative and true negative counts from your diagnostic test or screening study. The calculator instantly returns sensitivity (true positive rate), specificity (true negative rate), positive and negative predictive values, positive and negative likelihood ratios, and overall accuracy. Adjust the prevalence slider to see how PPV and NPV shift in different population settings.
Formula
Worked example
A test applied to 100 patients with the disease (90 TP, 10 FN) and 200 without (20 FP, 180 TN): Sensitivity = 90/100 = 90%; Specificity = 180/200 = 90%; LR+ = 0.90/(1-0.90) = 9.0; LR- = 0.10/0.90 = 0.11. At 20% prevalence, PPV = (0.90 x 0.20)/[(0.90 x 0.20)+(0.10 x 0.80)] = 18/26 = 69.2%, NPV = (0.90 x 0.80)/[(0.90 x 0.80)+(0.10 x 0.20)] = 72/74 = 97.3%.
What are sensitivity and specificity?
Sensitivity and specificity are two complementary measures of how well a diagnostic test or screening tool separates people who have a condition from those who do not. Sensitivity (also called the true positive rate) is the proportion of people WITH the condition who test positive. A highly sensitive test catches nearly every true case, so a negative result from a sensitive test is reassuring and can help rule out disease. Specificity (the true negative rate) is the proportion of people WITHOUT the condition who test negative. A highly specific test rarely misfires on healthy people, so a positive result from a specific test is strong evidence for disease. The two metrics trade off against each other: a very sensitive test may produce many false alarms, while a very specific test may miss some true cases. Choosing the right balance depends on the clinical context.
How to read the 2x2 contingency table
All four inputs come from a 2x2 table that cross-tabulates test result (positive or negative) against true disease status (present or absent). True Positives (TP): test positive, disease present. False Positives (FP): test positive, disease absent - the test fired incorrectly. False Negatives (FN): test negative, disease present - the test missed the condition. True Negatives (TN): test negative, disease absent - correct clearance. Sensitivity is computed from the disease-positive column (TP and FN), specificity from the disease-negative column (FP and TN). Accuracy uses all four cells.
Positive and negative predictive value: why prevalence matters
Sensitivity and specificity are properties of the test itself and do not change with the population being tested. Positive Predictive Value (PPV) and Negative Predictive Value (NPV), however, depend critically on how common the condition is. When a disease is rare, even a specific test will produce many false positives relative to true positives, pushing PPV down. Conversely, a sensitive test in a high-prevalence population produces very few false negatives relative to true negatives, pushing NPV up. The prevalence field in this calculator lets you apply Bayes theorem to see exactly how PPV and NPV shift as the underlying disease rate changes, without altering sensitivity or specificity.
Likelihood ratios and Youden's J index
Likelihood ratios combine sensitivity and specificity into a single, prevalence-independent index. The positive likelihood ratio (LR+) is sensitivity divided by the false positive rate (1 - specificity): it tells you how many times more likely a positive result is in a diseased person compared with a healthy person. An LR+ above 10 is conventionally considered large. The negative likelihood ratio (LR-) is the false negative rate divided by specificity: a value below 0.1 is considered strong evidence against disease. Youden's J index (sensitivity + specificity - 1) summarises overall discriminative ability on a 0-to-1 scale, where 0 indicates no better than chance and 1 indicates a perfect test. The F1 score provides a related harmonic-mean summary, balancing sensitivity and raw PPV from the contingency table.
Interpreting likelihood ratios
| LR+ value | LR- value | Diagnostic impact |
|---|---|---|
| >10 | <0.1 | Large (often conclusive) change in probability |
| 5 - 10 | 0.1 - 0.2 | Moderate change in probability |
| 2 - 5 | 0.2 - 0.5 | Small change in probability |
| 1 - 2 | 0.5 - 1 | Tiny, rarely important change |
| 1 | 1 | No diagnostic value (test is uninformative) |
Likelihood ratios (LR) indicate how much a test result changes the probability of disease. These benchmarks were proposed by Jaeschke et al. and are widely used in evidence-based medicine.
Frequently asked questions
What is the difference between sensitivity and specificity?
Sensitivity answers: "Of all the people who have the disease, what proportion does the test correctly identify?" It is the true positive rate and equals TP / (TP + FN). Specificity answers: "Of all the people who do not have the disease, what proportion does the test correctly clear?" It is the true negative rate and equals TN / (TN + FP). A sensitive test is best for ruling out disease (a negative result is reassuring). A specific test is best for ruling in disease (a positive result is convincing). Clinicians often use the mnemonics SnNout (Sensitive test, Negative result, rules Out) and SpPin (Specific test, Positive result, rules In).
Why does PPV depend on prevalence while sensitivity does not?
Sensitivity and specificity are calculated within each disease status group (positive or negative), so they reflect only the test's ability to sort - they do not change when prevalence changes. PPV, by contrast, is the probability of disease given a positive test, which depends on how many people with the disease are in the pool in the first place. In a high-prevalence population, most positives are true positives and PPV is high. In a low-prevalence screening programme, even a small false-positive rate can swamp the true positives, pulling PPV down sharply. This is why the same test can have a PPV of 90% in a specialist clinic and only 20% in mass community screening.
What is a good value for sensitivity and specificity?
There is no universal answer because the acceptable trade-off depends on the consequences of false positives and false negatives. In cancer screening, where missing a case (false negative) can be fatal, high sensitivity is paramount. In confirmatory testing before irreversible treatment, high specificity matters more to avoid treating people who don't have the disease. As a rough guide, tests with both sensitivity and specificity above 90% are generally considered excellent; 80-90% is good; 70-80% is fair. Likelihood ratios and Youden's J give a more unified picture of overall discriminative power.
How do likelihood ratios differ from predictive values?
Predictive values (PPV and NPV) give the post-test probability of disease in absolute terms, but they vary with prevalence. Likelihood ratios are prevalence-independent: LR+ = Sensitivity / (1 - Specificity) and LR- = (1 - Sensitivity) / Specificity. You can use a likelihood ratio with Bayes theorem or a Fagan nomogram to convert any pre-test probability (estimate of disease before testing) to a post-test probability, making them portable across different clinical settings with different baseline disease rates.
What is Youden's J and when is it useful?
Youden's J index equals Sensitivity + Specificity - 1. It ranges from 0 (a test no better than random guessing) to 1 (a perfect test). Because it combines both metrics into one number, it is especially useful when you want to find the optimal cut-off threshold along a ROC curve: the threshold that maximises J maximises the combined true positive rate and true negative rate. A J of 0.7 or above is generally considered strong discriminative ability.
What are false positive and false negative rates?
The false positive rate (FPR) is 1 - Specificity: the fraction of healthy people who test positive. The false negative rate (FNR) is 1 - Sensitivity: the fraction of diseased people who test negative. In ROC analysis, the FPR is plotted on the x-axis against sensitivity (the true positive rate) on the y-axis; a test with no discrimination would follow the diagonal line, while a perfect test would hug the top-left corner.
Sources
- Jaeschke R, Guyatt GH, Sackett DL. Users' guides to the medical literature. III. How to use an article about a diagnostic test. JAMA. 1994;271(5):389-391.
- Lalkhen AG, McCluskey A. Clinical tests: sensitivity and specificity. Continuing Education in Anaesthesia, Critical Care and Pain. 2008;8(6):221-223.