Sensitivity and Specificity Calculator
Enter the four cells of a confusion matrix, true positives, false positives, false negatives, and true negatives, to get sensitivity, specificity, PPV, NPV, and overall accuracy as percentages.
Example: with True positives (TP) 90 · False positives (FP) 20 · False negatives (FN) 10 · True negatives (TN) 80 → Sensitivity (recall): 90.0%.
- Specificity80.0%
- PPV (precision)81.8%
- NPV88.9%
Computed by the calculator below using its default values. Change any input to see your own numbers.
Sensitivity and specificity are properties of the test; PPV and NPV also shift with prevalence.
Two questions the test answers
Sensitivity and specificity describe a test from the point of view of the truth. Sensitivity asks: of everyone who truly has the condition, what share does the test catch? It is TP / (TP + FN). Specificity asks the mirror question: of everyone truly without it, what share does the test correctly clear? That is TN / (TN + FP). A test can be strong on one and weak on the other, which is why both matter.
What a positive result is worth
Sensitivity and specificity are fixed properties of the test, but a patient wants to know something else: given my positive result, how likely am I to actually have this? That is the positive predictive value, TP / (TP + FP). It depends on how common the condition is in the tested group, so the same test yields a different PPV in a screening clinic than in a high-risk ward. Negative predictive value works the same way for a clean result.
How it’s calculated
From the 2x2 table: sensitivity = TP / (TP + FN); specificity = TN / (TN + FP); positive predictive value = TP / (TP + FP); negative predictive value = TN / (TN + FN); accuracy = (TP + TN) / (TP + FP + FN + TN). All are shown as percentages.
PPV and NPV depend on the prevalence of the condition in your sample, so they do not transfer to a population with a different base rate. This tool is educational, not a substitute for clinical judgment.
The 2x2 table and its formulas
| Term | Formula | Reads as |
|---|---|---|
| Sensitivity | TP / (TP + FN) | Of the truly positive, the share caught |
| Specificity | TN / (TN + FP) | Of the truly negative, the share cleared |
| PPV | TP / (TP + FP) | Of the positives, the share truly positive |
| NPV | TN / (TN + FN) | Of the negatives, the share truly negative |
| Accuracy | (TP + TN) / total | The share of all calls that are correct |
Standard diagnostic-test definitions. PPV and NPV depend on prevalence in your sample.
Common mistakes
- Swapping false positives and false negatives. FN are missed true cases (they hurt sensitivity); FP are false alarms (they hurt specificity).
- Reading PPV as a fixed test property. It shifts with prevalence, unlike sensitivity and specificity.
- Judging a test by accuracy alone. With a rare condition, a test that calls everyone negative scores high accuracy yet catches nobody.
Frequently asked questions
How do you calculate sensitivity and specificity?
Sensitivity = TP / (TP + FN) is the share of true cases the test detects. Specificity = TN / (TN + FP) is the share of true non-cases it correctly clears. Enter your four counts and the tool returns both as percentages.
What is the difference between PPV and sensitivity?
Sensitivity is the chance a truly positive person tests positive. PPV is the reverse: the chance a person who tested positive is truly positive. PPV also depends on how common the condition is.
Why does prevalence change PPV and NPV?
Predictive values weigh true results against false ones, and that mix depends on how many people actually have the condition. In a low-prevalence group, even a good test produces many false positives, lowering PPV.
Is a highly accurate test always good?
Not necessarily. For a rare condition, calling everyone negative gives high accuracy but zero sensitivity. Look at sensitivity, specificity, and predictive values together.
Can I use this for medical decisions?
No. This calculator is an educational tool. For any diagnosis or treatment question, rely on a qualified clinician who can weigh the test alongside your history and symptoms.