Sensitivity and Specificity Calculator - Sensitivity, Specificity, PPV, NPV

This sensitivity and specificity calculator turns a 2x2 confusion matrix into sensitivity, specificity, prevalence, PPV, NPV, and the likelihood ratios.

Updated: July 8, 2026 • Free Tool

Sensitivity and Specificity Calculator

People who have the condition and tested positive.

People who have the condition but tested negative (missed cases).

People who do not have the condition and tested negative.

People who do not have the condition but tested positive.

Results

Sensitivity
0%
Specificity 0%
Prevalence 0%
Accuracy 0%
Positive Predictive Value 0%
Negative Predictive Value 0%
Positive Likelihood Ratio 0
Negative Likelihood Ratio 0

What Is the Sensitivity and Specificity Calculator?

A sensitivity and specificity calculator summarizes how well a diagnostic or screening test separates people who truly have a condition from those who do not. You enter the four outcomes of a 2x2 confusion matrix and it returns the two core operating characteristics of the test, plus prevalence, accuracy, the predictive values, and the likelihood ratios.

  • Evaluating a new screening test: Clinicians compare a candidate test against a reference standard before adopting it in practice.
  • Reading a study's test accuracy: Students and researchers turn a published confusion matrix into interpretable proportions.
  • Teaching epidemiology: Instructors show how the same test behaves differently as disease prevalence changes.

Sensitivity answers a practical question: of everyone who actually has the disease, what fraction does the test correctly flag? Specificity answers the mirror question: of everyone who is truly healthy, what fraction does the test correctly clear? Together they describe the test itself, independent of how common the disease is in the population you apply it to.

Because the numbers describe the test rather than the patient in front of you, they pair naturally with measures of association such as relative risk when you move from diagnosis to prognosis.

The four outcomes line up as a 2x2 table: the rows are the true disease state, the columns are the test result, and each person falls into exactly one cell. Laying the counts out this way makes it obvious why sensitivity and specificity are called the 'true positive' and 'true negative' rates, and why they are counted along the rows rather than down the columns.

Because sensitivity and specificity describe a test while relative risk describes an outcome, many epidemiology courses teach both side by side with a relative risk calculator to connect test accuracy to patient prognosis.

How the Sensitivity and Specificity Calculator Works

The calculator arranges your counts into a 2x2 table and applies the standard diagnostic-test formulas. Every output is derived from the same four cells, so the results always agree with one another.

Sensitivity = TP / (TP + FN); Specificity = TN / (TN + FP); PPV = TP / (TP + FP); NPV = TN / (TN + FN); LR+ = Sensitivity / (1 - Specificity); LR- = (1 - Sensitivity) / Specificity
  • True Positives (TP): People with the condition who tested positive.
  • False Negatives (FN): People with the condition who tested negative.
  • True Negatives (TN): People without the condition who tested negative.
  • False Positives (FP): People without the condition who tested positive.

The likelihood ratios convert the two proportions into a single multiplier you can carry into Bayes' theorem. A positive likelihood ratio above 10 makes a positive result strongly persuasive, while a ratio near 1 barely shifts the odds either way.

This sensitivity and specificity calculator keeps every output traceable to the same four cells, so the predictive values and likelihood ratios cannot contradict the sensitivity and specificity you started with. That traceability matters when you report results, because a reviewer can reconstruct each number from the table.

Sensitivity and specificity do not depend on prevalence, which is why a test keeps the same operating characteristics whether it is used in a specialist clinic or a general screening program. The predictive values, by contrast, move with prevalence, so the same test can look much stronger or weaker depending on who is tested.

Example: a diabetes screening run on 1,000 people

TP = 95, FN = 5, TN = 880, FP = 20 (so 100 diseased and 900 healthy).

Sensitivity = 95 / 100 = 95%; Specificity = 880 / 900 = 97.78%; PPV = 95 / 115 = 82.61%; NPV = 880 / 885 = 99.44%.

Sensitivity 95.00%, Specificity 97.78%, PPV 82.61%, NPV 99.44%.

The test misses 5% of real cases and wrongly flags about 2% of healthy people; most positive results are true cases because prevalence is low.

According to Wikipedia.

According to BMJ.

The likelihood ratios computed here feed directly into post-test odds, which you can update step by step with a Bayes' theorem calculator using the same prior and posterior logic.

Key Concepts Explained

Four ideas explain most of the behavior of any diagnostic test. Keeping them separate prevents the common mistake of reading a test's accuracy as the chance a result is correct.

Sensitivity

The true positive rate: the share of diseased people the test catches. High sensitivity means few false negatives, which matters when missing a case is dangerous.

Specificity

The true negative rate: the share of healthy people the test clears. High specificity means few false positives, which matters when a false alarm leads to invasive follow-up.

False positive rate

One minus specificity. It is the probability a healthy person tests positive, and it feeds directly into the positive likelihood ratio.

Predictive values

PPV and NPV are the post-test probabilities: the chance a positive result is a real case and the chance a negative result is truly clear. Unlike sensitivity and specificity, they depend on prevalence.

Sensitivity and specificity describe the test; predictive values describe the patient once tested. The gap between the two is why a 'very accurate' test can still produce mostly false positives in a rare disease.

A common slip is to call PPV 'the sensitivity of a positive result'. It is not: PPV folds prevalence into the arithmetic, so it answers a different question. Holding the two ideas apart is the single most useful habit when reading a test's track record.

Reported sensitivity is only an estimate, so pairing it with a margin of error from a confidence interval calculator shows how precisely the test performs in your sample.

How to Use This Calculator

Work from a finished 2x2 table. If you only know rates, convert them back to counts first, because the formulas need raw numbers in each cell.

  1. 1 Enter true positives: Put the count of people with the condition who tested positive into the TP field.
  2. 2 Enter false negatives: Add the count of people with the condition who tested negative into the FN field.
  3. 3 Enter true negatives: Add the count of people without the condition who tested negative into the TN field.
  4. 4 Enter false positives: Add the count of people without the condition who tested positive into the FP field, then read the results.

Suppose a rapid test was given to 1,000 people: 95 TP, 5 FN, 880 TN, 20 FP. Enter those four numbers and the calculator reports sensitivity 95%, specificity 97.78%, prevalence 10%, accuracy 97.5%, PPV 82.61%, NPV 99.44%, a positive likelihood ratio of 42.75, and a negative likelihood ratio of 0.0511.

Once you have sensitivity, specificity, and prevalence, a post-test probability calculator turns those three numbers into the probability a patient actually has the disease after testing.

Benefits of Using This Calculator

A dedicated calculator removes the arithmetic so you can focus on interpretation and on how the numbers change with your setting.

  • Consistent definitions: The same formulas are applied every time, avoiding sign errors between sensitivity and specificity.
  • Full picture in one view: Sensitivity, specificity, prevalence, accuracy, predictive values, and likelihood ratios appear together instead of in separate tools.
  • Quick what-if checks: Changing the false positive count shows how PPV and the likelihood ratios move without reworking the algebra by hand.

When you report a confidence interval for sensitivity, you can show how the estimate's precision depends on the number of diseased people studied, which is where a sample size plan becomes useful.

Keeping all eight outputs on one screen also makes the trade-offs visible. A test that raises sensitivity by catching more cases usually does so by lowering specificity and creating more false alarms, so the right balance depends on whether a missed case or a false alarm is the costlier error.

When you compare an observed sensitivity against a benchmark such as 90 percent, a p-value calculator reports whether the difference is statistically meaningful rather than a quirk of arithmetic.

Factors That Affect Your Results

The four cell counts are not all equally influential. Two structural features shape every output: how common the disease is, and how many cases you actually observed.

Prevalence

Prevalence sets PPV and NPV. At low prevalence even a specific test yields many false positives, so PPV falls despite a high sensitivity.

Diseased sample size

The precision of sensitivity depends on TP + FN. Small diseased groups give wide confidence intervals, which a sample size calculation should anticipate.

Spectrum of disease

If the study population has milder or earlier cases than your clinic, real-world sensitivity may differ from the published value.

  • Sensitivity and specificity describe the test in the studied population; they do not ensure the same performance in a different group.
  • Predictive values shift with prevalence, so a PPV from one setting should not be quoted in another without adjustment.

A p-value or confidence interval tells you whether an observed sensitivity differs from a benchmark, but it does not by itself say the test is good enough for screening.

Prevalence is the quiet driver behind most surprising results. The same specificity that looks excellent in a common disease can generate a flood of false positives when the condition is rare, which is why screening programs report predictive values separately from sensitivity and specificity.

According to PMC (Grimes and Schulz).

Because sensitivity precision depends on the number of diseased people enrolled, a sample size calculator helps you plan a validation study that can detect the accuracy you need.

Sensitivity and specificity calculator interface showing a 2x2 confusion matrix with true positive, false negative, true negative, and false positive fields plus sensitivity, specificity, PPV, NPV, and likelihood ratio outputs.
Sensitivity and specificity calculator interface showing a 2x2 confusion matrix with true positive, false negative, true negative, and false positive fields plus sensitivity, specificity, PPV, NPV, and likelihood ratio outputs.

Frequently Asked Questions

Q: What is a sensitivity and specificity calculator?

A: It is a tool that takes the four outcomes of a diagnostic test, the true positives, false negatives, true negatives, and false positives, and returns sensitivity, specificity, prevalence, accuracy, the predictive values, and the likelihood ratios. The numbers describe how the test performs, independent of how common the disease is.

Q: How do you calculate sensitivity and specificity from a 2x2 table?

A: Sensitivity is the number of true positives divided by all diseased people, true positives plus false negatives. Specificity is the number of true negatives divided by all healthy people, true negatives plus false positives. For example, 95 true positives among 100 diseased people gives a sensitivity of 95%, and 880 true negatives among 900 healthy people gives a specificity of about 97.8%.

Q: What is the difference between sensitivity and specificity?

A: Sensitivity measures how completely the test finds people who have the disease, so it tracks false negatives. Specificity measures how completely the test clears people who are healthy, so it tracks false positives. A test can be strong on one and weak on the other; a HIV screen favors high sensitivity, while a confirmatory test favors high specificity.

Q: Why does the positive predictive value change with prevalence?

A: Positive predictive value is the chance a positive result is a true case, and it depends on how many real cases exist in the tested group. When prevalence is low, most people are healthy, so even a small false positive rate produces many false alarms and PPV drops. The same test can have a PPV above 80% in a high-risk clinic and below 15% in population screening.

Q: What are likelihood ratios and how are they used?

A: The positive likelihood ratio is sensitivity divided by one minus specificity, and the negative likelihood ratio is one minus sensitivity divided by specificity. They summarize a test independently of prevalence and plug into Bayes' theorem to update the odds that a patient has the disease after a positive or negative result.

Q: Can sensitivity and specificity both be 100%?

A: Only for a perfect test with no false negatives and no false positives. In practice every test makes some errors, so the two values trade off and rarely reach 100% together. A perfect test would also give infinite positive and zero negative likelihood ratios, which is why real-world ratios are finite.