Sensitivity and Specificity Calculator (PPV, NPV, LR)
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free sensitivity and specificity calculator. Enter true and false positives and negatives to get PPV, NPV, likelihood ratios and accuracy.
- Positive predictive value
- 0
- Negative predictive value
- 0
- LR+
- 0
- LR−
- 0
- Accuracy
- 0
- PPV and NPV at that prevalence
- 0
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the sensitivity and specificity calculator
- Enter the true positives (TP): people with the condition who tested positive.
- Enter the false positives (FP): people without the condition who tested positive.
- Enter the false negatives (FN): people with the condition who tested negative.
- Enter the true negatives (TN): people without the condition who tested negative.
- Optionally enter a different prevalence to see how the test would perform in another population.
The sensitivity and specificity calculator shows sensitivity, specificity, positive and negative predictive values (PPV and NPV), positive and negative likelihood ratios (LR+ and LR−), accuracy, and the PPV and NPV at the prevalence you enter.
The 2 × 2 table
Diagnostic test results are summarised in a 2 × 2 table comparing the test with a reference standard (the best available way of knowing who really has the condition):
| Condition present | Condition absent | |
|---|---|---|
| Test positive | True positives (TP) | False positives (FP) |
| Test negative | False negatives (FN) | True negatives (TN) |
With the default data, 100 people have the condition (90 TP and 10 FN) and 900 don't (30 FP and 870 TN), a total of 1,000.
Sensitivity and specificity
Sensitivity = TP ÷ (TP + FN)
Sensitivity is the proportion of people with the condition who test positive. For the default data, it's 90 ÷ 100 = 90%. A highly sensitive test rarely misses the condition, so a negative result helps rule it out.
Specificity = TN ÷ (TN + FP)
Specificity is the proportion of people without the condition who test negative. For the default data, it's 870 ÷ 900 ≈ 96.7%. A highly specific test rarely gives false alarms, so a positive result helps rule the condition in.
Clinicians remember this with the mnemonics SnNout (a highly Sensitive test, when Negative, rules out) and SpPin (a highly Specific test, when Positive, rules in).
Sensitivity and specificity are properties of the test itself and don't depend on how common the condition is, though they can vary between populations with different severity or types of the condition.
Predictive values
Patients and clinicians usually want to know something different: if the test is positive, how likely is it that I have the condition?
Positive predictive value (PPV) = TP ÷ (TP + FP)
Negative predictive value (NPV) = TN ÷ (TN + FN)
For the default data, PPV = 90 ÷ 120 = 75% and NPV = 870 ÷ 880 ≈ 98.9%. So a positive result means a 75% chance of having the condition, and a negative result means about a 98.9% chance of not having it.
Unlike sensitivity and specificity, predictive values depend heavily on prevalence: how common the condition is in the group being tested. In the default data, the prevalence is 100 ÷ 1,000 = 10%.
Why prevalence matters so much
If the same test is used in a population where only 1% have the condition, the PPV falls dramatically. Out of 1,000 people, 10 have the condition and 990 don't. The test finds 9 of the 10 (90% sensitivity) but also gives false positives to about 33 of the 990 (3.3% of them, because specificity is 96.7%). So of about 42 positive results, only 9 are true: a PPV of about 21.4%. The sensitivity and specificity calculator shows this when you enter 1% as the prevalence.
This is why screening tests used in the general population, where most conditions are rare, often produce many false positives, and why positive screening results are usually confirmed with a second, more specific test. The Bayes theorem calculator explains the same effect from a probability point of view.
Likelihood ratios
Likelihood ratios combine sensitivity and specificity into a single figure that shows how much a result changes the odds of the condition:
LR+ = sensitivity ÷ (1 − specificity)
LR− = (1 − sensitivity) ÷ specificity
For the default data, LR+ = 0.9 ÷ 0.0333 = 27 and LR− = 0.1 ÷ 0.9667 ≈ 0.103. A positive result multiplies the pre-test odds by 27; a negative result multiplies them by about 0.10. As a rough guide, an LR+ above 10 or an LR− below 0.1 is often described as giving a large and often conclusive change in probability. Likelihood ratios don't depend on prevalence, so they can be applied to any patient's pre-test probability.
Accuracy
Accuracy = (TP + TN) ÷ total
For the default data, accuracy is 960 ÷ 1,000 = 96%. Accuracy is easy to understand but can be misleading when the condition is rare. A test that always says "negative" would be 99% accurate in a population with 1% prevalence, while missing every case. Sensitivity, specificity and predictive values give a much better picture.
A worked example
A new test is evaluated in 1,000 people, 100 of whom have the condition. It correctly identifies 95 of them (5 are missed) and gives false positives to 50 of the 900 without it.
- Sensitivity: 95 ÷ 100 = 95%.
- Specificity: 850 ÷ 900 ≈ 94.4%.
- PPV: 95 ÷ 145 ≈ 65.5%.
- NPV: 850 ÷ 855 ≈ 99.4%.
- LR+: 0.95 ÷ 0.0556 ≈ 17.1.
At a prevalence of 20%, for example in a specialist clinic, the PPV rises to about 81.0%. Enter TP = 95, FP = 50, FN = 5, TN = 850 and a prevalence of 20% in the sensitivity and specificity calculator to check.
Who uses a sensitivity and specificity calculator
Clinicians use it to interpret test results and explain them to patients. Medical researchers use it to evaluate new diagnostic tests. Public health specialists use it to plan screening programmes. Data scientists use the same measures, often called recall and precision, to evaluate classification models. Students use it in evidence-based medicine and statistics courses.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.
Sensitivity and specificity in machine learning
In machine learning, sensitivity is called recall or the true positive rate, and PPV is called precision. Specificity is the true negative rate, and 1 − specificity is the false positive rate. A receiver operating characteristic (ROC) curve plots sensitivity against the false positive rate at different thresholds, showing the trade-off. The same 2 × 2 table, called a confusion matrix, is used to evaluate spam filters, fraud detection and image classifiers. The sensitivity and specificity calculator works for any of these.
The trade-off between sensitivity and specificity
Many tests give a continuous result, such as a blood level, and a cut-off is chosen to decide what counts as positive. Lowering the cut-off catches more true cases, raising sensitivity, but also flags more healthy people, lowering specificity. Raising it does the opposite. The right cut-off depends on the consequences: for a serious condition that's treatable if caught early, a high sensitivity may matter most; for a condition where a false positive leads to risky further tests, a high specificity may matter more.
Common mistakes
- Confusing sensitivity with PPV. Sensitivity is about people with the condition; PPV is about people with a positive result.
- Applying predictive values from one population to another with a different prevalence.
- Relying on accuracy alone when the condition is rare.
- Using a flawed reference standard, which distorts every measure.
Testing twice
When a positive screening test is followed by a second, independent test, and only people positive on both are treated as positive, specificity rises and the PPV improves a lot, while sensitivity falls a little because some true cases are missed by one of the tests. This is the logic behind confirmatory testing. If the two tests' errors are independent, the combined sensitivity is roughly the product of the two sensitivities, and the combined false positive rate is roughly the product of the two false positive rates. In practice, errors are often correlated, so the gain is smaller. You can use the sensitivity and specificity calculator on each stage separately, entering the positives from the first test as the population for the second.
Confidence intervals
Sensitivity, specificity and predictive values from a study are estimates. With small numbers, the true values could be quite different. A sensitivity of 90% based on 10 cases is much less certain than one based on 1,000. Research papers usually report 95% confidence intervals for each measure. If you're comparing tests using the sensitivity and specificity calculator, check how many cases each figure is based on.
Sources and further reading
- Sensitivity and specificity on Wikipedia: definitions, examples and the trade-off.
- Positive and negative predictive values on Wikipedia: how prevalence affects them.
- Trevethan R. Sensitivity, specificity, and predictive values: foundations, pliabilities, and pitfalls in research and practice, Frontiers in Public Health (2017).
Frequently asked questions
What is the difference between sensitivity and specificity?
Sensitivity is the proportion of people with the condition who test positive; specificity is the proportion without it who test negative.
Why is the PPV so low for rare conditions?
When few people have the condition, even a small false positive rate produces more false positives than true positives.
What is a good likelihood ratio?
An LR+ above 10 or an LR− below 0.1 is often described as giving a large change in probability.
Does prevalence affect sensitivity?
Not directly. Sensitivity and specificity are properties of the test, while PPV and NPV depend on prevalence.
What are recall and precision?
Machine learning names for sensitivity and PPV.
Is the sensitivity and specificity calculator free?
Yes. It's free, needs no sign-up, and works in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.