Works on this device
Sensitivity Specificity Calculator
Find how well a test finds people with a condition (sensitivity) and clears people without it (specificity). Enter the four counts of a 2×2 table. The tool is for learning and for checking arithmetic; it is not a diagnosis, and test results should be discussed with a clinician.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Calculate.
Your result
How it was worked out
How to use this calculator
- Choose From a 2×2 table of counts if you have the counts of a study. Choose Likelihood ratios from sensitivity and specificity if you only have the two percentages.
- Enter the true positives, false positives, false negatives and true negatives. Each one is a count of people.
- Under More options you can choose the confidence level (95% at first) and the interval method (Wilson at first).
- Choose Calculate. The result shows each measure with its confidence interval, a table of all of them, and the working.
- To plan a study, choose Sample size for a study of sensitivity and specificity.
The 2×2 table
The columns are what the reference standard (the best available test) says. The rows are what the test you study says.
| Test result | Condition present | Condition absent |
|---|---|---|
| Test positive | True positives (TP) | False positives (FP) |
| Test negative | False negatives (FN) | True negatives (TN) |
The formulas
- Sensitivity = TP ÷ (TP + FN): the share of people with the condition who test positive.
- Specificity = TN ÷ (TN + FP): the share of people without the condition who test negative.
- Positive likelihood ratio LR+ = sensitivity ÷ (1 − specificity). Negative likelihood ratio LR− = (1 − sensitivity) ÷ specificity.
- Accuracy = (TP + TN) ÷ everyone. It depends on how many people in the table have the condition.
- Balanced accuracy = (sensitivity + specificity) ÷ 2. It equals the area under the ROC line through this one test result. Youden's index J = sensitivity + specificity − 1.
- Wilson score interval (Wilson, 1927): centre = (x + z²/2) ÷ (n + z²) and half-width = z × √(x(n − x)/n + z²/4) ÷ (n + z²), for x out of n. z is 1.96 for 95%.
- Clopper-Pearson exact interval (Clopper and Pearson, 1934): the limits come from the binomial distribution itself, through the beta distribution. It is wider than the Wilson interval.
- Likelihood ratio intervals: the log method for a ratio of two proportions (Katz and others, 1978): exp(ln LR ± z × √(1/x1 − 1/n1 + 1/x2 − 1/n2)).
Worked example
A study tests 1,000 people. 100 of them have the condition: the test is positive in 90 (TP) and negative in 10 (FN). 900 do not have it: the test is positive in 30 (FP) and negative in 870 (TN).
Sensitivity = 90 ÷ 100 = 90.00%, with a 95% Wilson interval of 82.56% to 94.48%. Specificity = 870 ÷ 900 = 96.67%, with an interval of 95.28% to 97.66%.
LR+ = 0.9 ÷ (1 − 0.966667) = 27. LR− = 0.1 ÷ 0.966667 = 0.1034. Accuracy = 960 ÷ 1,000 = 96.00%.
Sample size for a study
The sample size mode uses the formula of Buderer (1996). People needed with the condition = z² × sensitivity × (1 − sensitivity) ÷ d², where d is the margin of error. Divide by the prevalence to get the number of people to test. The same is done for the specificity with the people without the condition, and the larger number is the one to use.
Example: an expected sensitivity of 90%, a margin of 5 percentage points, 95% confidence and a prevalence of 20%: 1.959964² × 0.9 × 0.1 ÷ 0.05² = 138.3, so 139 people with the condition, and 138.3 ÷ 0.2 = 691.5, so 692 people to test.
What the numbers do not tell you
- Sensitivity and specificity do not say what a single result means for one person. That depends on how common the condition is. Use the Positive Predictive Value Calculator and the Negative Predictive Value Calculator for that.
- The Screening Result Explanation Worksheet shows the same numbers for a group of 1,000 people in plain words.
Limits you should know
- This tool is for learning and for checking arithmetic. It is not a diagnosis and not medical advice. Discuss test results with a clinician.
- The results are only as good as the study behind the counts. A biased choice of people or a poor reference standard gives misleading numbers, and no formula can correct that.
- No likelihood ratio interval is given when a count it uses is 0. The tool does not add 0.5 to empty cells.
- The one-point ROC area is not the area under a full ROC curve. A full curve needs the results of a test at many cut-offs.
- The sample size formula uses the normal approximation and assumes one random sample. Add people for drop-outs.
- Your numbers are worked out on your device. A file that you download or a page that you print contains the numbers you entered.