Sensitivity and Specificity Calculator

Sensitivity and Specificity Calculator

Growing AI Skill PRO

Enter Calculation

Formula

Sensitivity=TPTP+FN×100%\text{Sensitivity} = \frac{\text{TP}}{\text{TP} + \text{FN}} \times 100\%
Show calculation steps (4)
  1. Specificity (True Negative Rate)

    Specificity=TNTN+FP×100%\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}} \times 100\%

    Proportion of actual negatives correctly identified

  2. Positive Predictive Value (PPV)

    PPV=TPTP+FP×100%\text{PPV} = \frac{\text{TP}}{\text{TP} + \text{FP}} \times 100\%

    Proportion of positive test results that are true positives

  3. Negative Predictive Value (NPV)

    NPV=TNTN+FN×100%\text{NPV} = \frac{\text{TN}}{\text{TN} + \text{FN}} \times 100\%

    Proportion of negative test results that are true negatives

  4. Accuracy

    Accuracy=TP+TNTP+FN+TN+FP×100%\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FN} + \text{TN} + \text{FP}} \times 100\%

    Proportion of all results that are correct

Usage stats

Advertisement

Results

Sensitivity (True Positive Rate)
90%
ability to correctly identify positives
Specificity (True Negative Rate) 80%
Positive Predictive Value (PPV) 81.82%
Negative Predictive Value (NPV) 88.89%
Accuracy 85%

For reference only — not a substitute for a clinician's assessment.

Report an error on this page

What This Calculator Does

This tool measures the performance of a binary diagnostic test or classification model. From the four cells of a 2×2 confusion matrix — True Positives (TP), False Negatives (FN), True Negatives (TN), and False Positives (FP) — it computes sensitivity, specificity, positive and negative predictive values (PPV/NPV), and overall accuracy. These metrics are widely used in medicine, epidemiology, and machine learning.

Two by two confusion matrix showing TP, FP, FN and TN cells
A confusion matrix arranges predictions into true positives, false positives, false negatives and true negatives.

How to Use It

Enter the count of each outcome from your study or model. A "positive" usually means the condition is present (or the model predicts the positive class). TP and FP are cases the test called positive; TN and FN are cases the test called negative. Click calculate to see all five metrics as percentages.

The Formulas Explained

Sensitivity = TP / (TP + FN) tells you how well the test catches true cases — a high value means few sick patients are missed. Specificity = TN / (TN + FP) tells you how well it rules out healthy people — a high value means few false alarms. PPV = TP / (TP + FP) is the chance a positive result is real, and NPV = TN / (TN + FN) is the chance a negative result is truly negative. Accuracy = (TP + TN) / total summarizes overall correctness.

$$\text{Sensitivity} = \frac{\text{TP}}{\text{TP} + \text{FN}} \times 100\%$$

$$\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}} \times 100\%$$

$$\text{PPV} = \frac{\text{TP}}{\text{TP} + \text{FP}} \times 100\%$$

$$\text{NPV} = \frac{\text{TN}}{\text{TN} + \text{FN}} \times 100\%$$

$$\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FN} + \text{TN} + \text{FP}} \times 100\%$$

Advertisement
Diagram contrasting sensitivity from actual positives and specificity from actual negatives
Sensitivity is computed among actual positives, specificity among actual negatives.

Worked Example

Suppose a test gives TP = 90, FN = 10, TN = 80, FP = 20.

$$\text{Sensitivity} = \frac{90}{90 + 10} = 90\%$$

$$\text{Specificity} = \frac{80}{80 + 20} = 80\%$$

$$\text{PPV} = \frac{90}{90 + 20} \approx 81.82\%$$

$$\text{NPV} = \frac{80}{80 + 10} \approx 88.89\%$$

$$\text{Accuracy} = \frac{90 + 80}{200} = 85\%$$

Interpreting Sensitivity, Specificity, PPV and NPV

Sensitivity is the share of people who truly have the condition that the test correctly flags: \(\text{TP}/(\text{TP}+\text{FN})\). Specificity is the share of people without the condition that the test correctly clears: \(\text{TN}/(\text{TN}+\text{FP})\).

  • High sensitivity (SnNout): few false negatives, so a negative result helps rule the condition out.
  • High specificity (SpPin): few false positives, so a positive result helps rule the condition in.
  • Low sensitivity: many cases are missed, so a negative result is not very reassuring.
  • Low specificity: many healthy people test positive, so a positive result needs confirmation.

The threshold trade-off

Most tests produce a continuous value (a score, a concentration, a probability) that is turned into positive or negative by a cut-off. Lowering the cut-off usually raises sensitivity but lowers specificity. Raising it does the opposite. No threshold improves both at once for a given test, so the right cut-off depends on the relative cost of missed cases versus false alarms. An ROC curve plots this trade-off across all thresholds.

PPV and NPV depend on prevalence

PPV is \(\text{TP}/(\text{TP}+\text{FP})\) and NPV is \(\text{TN}/(\text{TN}+\text{FN})\). Unlike sensitivity and specificity, they change with how common the condition is in the group tested. When prevalence is low, even a good test produces many false positives compared with true positives, so PPV falls and NPV rises. When prevalence is high, the reverse happens. PPV and NPV from one study apply only to populations with a similar prevalence. See the table below.

Limits of accuracy

Accuracy is \((\text{TP}+\text{TN})/\text{total}\). On imbalanced data it can mislead. If only 1% of a sample has the condition, a test that calls everyone negative is 99% accurate yet has 0% sensitivity. Always read accuracy together with sensitivity, specificity and PPV/NPV.

These figures describe the sample you enter. They carry sampling uncertainty and are general information, not personal medical advice. Discuss any individual result with a qualified healthcare professional.

How Prevalence Changes PPV and NPV

The table assumes a test with 90% sensitivity and 90% specificity applied to 10,000 people. Only the prevalence changes.

Prevalence TP FN TN FP PPV NPV Accuracy
1% 90 10 8,910 990 8.33% 99.89% 90%
5% 450 50 8,550 950 32.14% 99.42% 90%
10% 900 100 8,100 900 50.00% 98.78% 90%
25% 2,250 250 6,750 750 75.00% 96.43% 90%
50% 4,500 500 4,500 500 90.00% 90.00% 90%

Worked check at 1% prevalence

Diseased: 10,000 × 0.01 = 100, so TP = 100 × 0.90 = 90 and FN = 10. Healthy: 9,900, so TN = 9,900 × 0.90 = 8,910 and FP = 990.

$$\text{PPV} = \frac{90}{90+990} = \frac{90}{1080} \approx 8.33\%, \qquad \text{NPV} = \frac{8910}{8910+10} = \frac{8910}{8920} \approx 99.89\%$$

Takeaway: with the same test, a positive result is correct only about 1 time in 12 at 1% prevalence, but 9 times in 10 at 50% prevalence. Accuracy stays at 90% in every row, which shows why accuracy alone hides this effect.

Advertisement

Key Terms and Glossary

Confusion matrix
A 2×2 table that cross-tabulates test results (positive/negative) against the true condition (present/absent). Its four cells are TP, FP, FN and TN.
True positive (TP)
A person with the condition whom the test correctly labels positive.
False positive (FP)
A person without the condition whom the test wrongly labels positive.
True negative (TN)
A person without the condition whom the test correctly labels negative.
False negative (FN)
A person with the condition whom the test wrongly labels negative.
Sensitivity (recall, true positive rate)
TP / (TP + FN). The proportion of people with the condition who test positive.
Specificity (true negative rate)
TN / (TN + FP). The proportion of people without the condition who test negative.
Positive predictive value (PPV, precision)
TP / (TP + FP). The proportion of positive results that are true positives.
Negative predictive value (NPV)
TN / (TN + FN). The proportion of negative results that are true negatives.
Accuracy
(TP + TN) / (TP + FP + TN + FN). The proportion of all results that are correct.
Prevalence
(TP + FN) / total. The proportion of the tested group that has the condition.
False positive rate
FP / (FP + TN), which equals 1 − specificity.
False negative rate
FN / (FN + TP), which equals 1 − sensitivity.

FAQ

What is the difference between sensitivity and specificity? Sensitivity measures how well a test detects people who have the condition; specificity measures how well it correctly clears people who do not.

Why do PPV and NPV differ from sensitivity/specificity? Predictive values depend on disease prevalence in your sample, while sensitivity and specificity are intrinsic test properties.

Can a test be 100% sensitive but useless? Yes — a test that calls everyone positive is 100% sensitive but 0% specific, so both numbers matter together.

Sources & References

Checked against these sources on . Not reviewed by a clinician. For general information only, not medical advice or a diagnosis. Talk to a doctor about any health concern.

Last updated:

Most popular in Health and Fitness

View all Health and Fitness calculators