Sensitivity and Specificity Calculator
Sensitivity, specificity, predictive values, likelihood ratios, and accuracy from a 2x2 table.
What it does
Sensitivity and specificity describe how a test behaves in people who do and do not have a condition. Sensitivity is the share of diseased people who test positive; specificity is the share of healthy people who test negative.
The same 2x2 table also yields positive and negative predictive values. Those two numbers answer the question a patient usually asks: given this result, what is the chance the condition is present or absent?
The defaults describe 100 people with the condition and 100 without it. Ninety of the 100 diseased people test positive, and 90 of the 100 healthy people test negative. Sensitivity, specificity, PPV, and NPV all land at 90%, with likelihood ratios of 9.00 and 0.11 and accuracy of 90%.
Predictive values depend on how common the condition is in the tested group, while sensitivity and specificity are properties of the test at a fixed threshold. A test with 90% sensitivity can still have a low PPV when the condition is rare.
How to use
- Enter true positives, the people with the condition who test positive.
- Enter false positives, the people without the condition who test positive.
- Enter false negatives, the people with the condition who test negative.
- Enter true negatives, the people without the condition who test negative.
- Press Calculate to see sensitivity, specificity, predictive values, and likelihood ratios.
- Check that the four counts describe the same testing threshold and population.
Formula
- TP
- True positives, diseased people who test positive.
- FP
- False positives, healthy people who test positive.
- FN
- False negatives, diseased people who test negative.
- TN
- True negatives, healthy people who test negative.
- PPV
- Share of positive results that are truly positive.
- NPV
- Share of negative results that are truly negative.
Sensitivity needs at least one person with the condition, so TP + FN must be above zero. Specificity needs at least one person without it, so TN + FP must be above zero. PPV and NPV can be undefined when no positive or no negative results occur; the tool labels that case instead of dividing by zero.
Worked example
Example: 90 true positives and 90 true negatives
Defaults: TP = 90, FP = 10, FN = 10, TN = 90.
- Sensitivity = 90 / (90 + 10) = 90 %.
- Specificity = 90 / (90 + 10) = 90 %.
- PPV = 90 / (90 + 10) = 90 %.
- NPV = 90 / (90 + 10) = 90 %.
- LR+ = 0.90 / (1 - 0.90) = 9.00; LR- = (1 - 0.90) / 0.90 = 0.11.
- Accuracy = (90 + 90) / 200 = 90 %.
Reference table
| Measure | Formula | Example |
|---|---|---|
| Sensitivity | TP / (TP + FN) | 90 % |
| Specificity | TN / (TN + FP) | 90 % |
| PPV | TP / (TP + FP) | 90 % |
| NPV | TN / (TN + FN) | 90 % |
| LR+ | Sensitivity / (1 - specificity) | 9.00 |
| LR- | (1 - sensitivity) / specificity | 0.11 |
| Accuracy | (TP + TN) / all results | 90 % |
Limits
- PPV and NPV depend on the prevalence in the tested group.
- Sensitivity and specificity apply to one test threshold, not every possible cutoff.
- Spectrum bias can change results when the tested group differs from the original study group.
- The tool reports point estimates only, without confidence intervals or adjustment for verification bias.
Common mistakes
- Swapping the diseased and healthy rows when entering counts.
- Using PPV as if it were sensitivity.
- Comparing PPV values from groups with different prevalence.
- Reading LR+ as a nine-fold rise in the chance of disease.
- Treating a highly sensitive test as a perfect rule-out in every population.
Try it yourself
Quick checks. Answers sit tucked under each question.
What are the measures for TP = 80, FP = 20, FN = 10, and TN = 90?
Sensitivity 88.9 %, specificity 81.8 %, PPV 80 %, NPV 90 %, LR+ 4.89, LR- 0.14, and accuracy 85 %.
TP = 45, FP = 5, FN = 5, TN = 45. What changes from the default example?
The proportions are the same, so sensitivity, specificity, PPV, and NPV are 90 %, LR+ is 9.00, LR- is 0.11, and accuracy is 90 %.
There are no people with the condition in the table. What happens?
The tool stops with an error because sensitivity needs TP + FN above zero.
Questions
What is the difference between sensitivity and PPV?
Sensitivity is the share of diseased people who test positive. PPV is the share of positive results that come from diseased people.
Why do PPV and NPV change with prevalence?
They use the mix of diseased and healthy people in the tested group, while sensitivity and specificity condition on disease status.
What does a likelihood ratio of 9.00 mean?
A positive result is nine times more likely in people with the condition than in people without it. It multiplies the pretest odds, not the pretest probability.
Can sensitivity be 100%?
Yes, if every diseased person tests positive. That does not make the test perfect because false positives can still occur.
Should I use accuracy to compare tests?
Accuracy is easy to read but can hide poor performance when one outcome is much more common than the other.
What if there are no positive results?
PPV is undefined because the denominator is zero. The tool reports that instead of inventing a value.