01
The 2 × 2 table
| Disease present | Disease absent | |
|---|---|---|
| Test positive | True positive (TP) | False positive (FP) |
| Test negative | False negative (FN) | True negative (TN) |
sensitivity = TP ÷ (TP + FN) · specificity = TN ÷ (TN + FP)
PPV = TP ÷ (TP + FP) · NPV = TN ÷ (TN + FN)
LR+ = sensitivity ÷ (1 − specificity) · LR− = (1 − sensitivity) ÷ specificity
02
Worked example
A test is applied to 1,000 people, 100 of whom have the disease: 90 true positives, 10 false negatives, 30 false positives and 870 true negatives.
| Measure | Value | 95% CI |
|---|---|---|
| Sensitivity | 90.0% | 82.6% to 94.5% |
| Specificity | 96.7% | 95.3% to 97.7% |
| Positive predictive value | 75.0% | 66.6% to 81.9% |
| Negative predictive value | 98.9% | 97.9% to 99.4% |
| Likelihood ratio + | 27.0 | |
| Likelihood ratio − | 0.10 |
03
What each measure tells you
- Sensitivity: of the people with the disease, the share the test detects. A highly sensitive test rarely misses cases, so a negative result helps rule the disease out.
- Specificity: of the people without the disease, the share the test correctly clears. A highly specific test rarely raises false alarms, so a positive result helps rule it in.
- PPV and NPV: of those who test positive (or negative), the share for whom the result is right. These are what a patient with a result in hand wants to know.
- Likelihood ratios: how much a result shifts the odds of disease. They do not depend on prevalence.
04
Predictive values depend on prevalence
Sensitivity and specificity belong to the test. PPV and NPV also depend on how common the disease is in the people tested. Keep the same test (90% sensitive, 96.7% specific) but apply it to 1,000 people of whom only 1% have the disease:
| Prevalence | TP | FP | FN | TN | PPV | NPV |
|---|---|---|---|---|---|---|
| 10% | 90 | 30 | 10 | 870 | 75.0% | 98.9% |
| 1% | 9 | 33 | 1 | 957 | 21.4% | 99.9% |
At 1% prevalence nearly four in five positives are false. You do not need to rebuild the table to see this: enter the prevalence of the setting where the test will be used in the optional box, and the calculator recomputes PPV and NPV for it. Predictive values from a study only carry over to settings with a similar prevalence; from a case-control design they are not meaningful at all.
05
Confidence intervals
The likelihood ratios get intervals by the log method: exp(ln LR ± 1.96 × SE), with SE(ln LR+) = √(1/TP − 1/(TP + FN) + 1/FP − 1/(FP + TN)). In the example LR+ is 27.0 (18.9 to 38.6) and LR− is 0.10 (0.06 to 0.19). Each proportion gets a Wilson score interval, which behaves well for values near 0% or 100% and for small groups: see the confidence interval calculator for the formula. A sensitivity estimated from 20 diseased people has a wide interval however good the point estimate looks.
06
Common mistakes with sensitivity and specificity
- Carrying a PPV to another population. The same test, 90% sensitive and 96.7% specific, has a PPV of 75.0% at 10% prevalence but 21.4% at 1%.
- Reading sensitivity as the chance that a positive result is right. In the worked example sensitivity is 90.0% but PPV is 75.0%: one positive in four is false.
- Judging a test by its accuracy. At 10% prevalence, calling everyone negative is 90.0% accurate; this test is 96.0% accurate.
- Using a simple (Wald) interval on small counts. For 9 of 10 cases detected it runs from 71.4% to 108.6%, past 100%; the Wilson interval used here gives 59.6% to 98.2%.
Trust
How this page is checked
- The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
- The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
- Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.
Cite this page
Sciloom. (2026). Sensitivity and specificity calculator. Zebra Nine Studio Inc. https://sciloom.si/sensitivity-specificity-calculator
Frequently asked questions
How do I calculate sensitivity and specificity?
Sensitivity is true positives divided by everyone with the disease (TP + FN). Specificity is true negatives divided by everyone without it (TN + FP).
What is the difference between sensitivity and PPV?
Sensitivity starts from people who have the disease and asks how many test positive. PPV starts from people who test positive and asks how many have the disease. PPV changes with prevalence; sensitivity does not.
What is a good likelihood ratio?
A positive likelihood ratio above about 10 or a negative one below about 0.1 shifts the probability of disease substantially. Values near 1 barely change it.
What is Youden’s J?
Sensitivity plus specificity minus 1. It runs from 0 for a useless test to 1 for a perfect one and is often used to choose a cut-off.