Sensitivity, Specificity, PPV & NPV Calculator

Calculate sensitivity, specificity, positive and negative predictive values and likelihood ratios from a 2×2 table or from test accuracy and prevalence.

Updated · Free · Runs in your browser

Enter
%
%
%
Positive predictive value (PPV) —
Negative predictive value (NPV) —
Sensitivity —
Specificity —
Positive likelihood ratio (LR+) —
Negative likelihood ratio (LR−) —
Accuracy —
Prevalence —
F1 score —
In plain numbers —
    Was this calculator helpful?

    The formula

    From a 2×2 table (TP, FP, FN, TN):
    Sensitivity = TP ÷ (TP + FN)
    Specificity = TN ÷ (TN + FP)
    PPV = TP ÷ (TP + FP)
    NPV = TN ÷ (TN + FN)
    LR+ = sensitivity ÷ (1 − specificity)
    LR− = (1 − sensitivity) ÷ specificity
    Accuracy = (TP + TN) ÷ total
    
    From rates, PPV = sens × prev ÷ (sens × prev + (1 − spec) × (1 − prev))

    Worked example

    1. A test has 95% sensitivity and 90% specificity, and 5% of the people tested have the condition.
    2. Out of 10,000 people, 500 have the condition and 9,500 don't.
    3. True positives = 95% × 500 = 475; false negatives = 25.
    4. False positives = 10% × 9,500 = 950; true negatives = 8,550.
    5. PPV = 475 ÷ (475 + 950) = 33.3%: only one in three positive results is a true case.
    6. NPV = 8,550 ÷ (8,550 + 25) = 99.7%.
    7. LR+ = 0.95 ÷ 0.10 = 9.5, and LR− = 0.05 ÷ 0.90 = 0.06.

    Four numbers that describe a test

    Any test that gives a positive or negative result can be summarised with a 2×2 table: true positives (people with the condition who test positive), false positives, false negatives and true negatives. Sensitivity is the share of people with the condition who test positive: how good the test is at catching cases. Specificity is the share of people without the condition who test negative: how good it is at ruling them out. These two are properties of the test itself and don't change with how common the condition is.

    Predictive values depend on prevalence

    Patients and doctors usually want to know something different: if my test is positive, how likely is it that I have the condition? That's the positive predictive value (PPV), and the negative predictive value (NPV) is the equivalent for a negative result. Both depend heavily on prevalence, the proportion of people tested who actually have the condition. In the example, a test that's 95% sensitive and 90% specific has a PPV of only 33% when prevalence is 5%, because the many people without the condition generate more false positives than there are true cases. At a prevalence of 30% the same test has a PPV of about 80%. This is why screening for rare diseases in the general population produces many false alarms, and why positive screening results are confirmed with a second, more specific test.

    Likelihood ratios

    Likelihood ratios combine sensitivity and specificity into a single number that tells you how much a result changes the probability of disease. An LR+ above 10 or an LR− below 0.1 produces a large, often conclusive change. Values of 5–10 and 0.1–0.2 are moderately useful, while values close to 1 barely change anything. Because they don't depend on prevalence, likelihood ratios can be applied to any patient: multiply the pre-test odds by the LR to get the post-test odds. A Fagan nomogram does the same thing graphically.

    Choosing between sensitivity and specificity

    There's usually a trade-off: moving a test's cut-off to catch more cases raises sensitivity but lowers specificity. A highly sensitive test is best for ruling a condition out when it's negative, remembered by the mnemonic SnNout. A highly specific test is best for ruling a condition in when it's positive: SpPin. Screening tests are usually chosen for high sensitivity so few cases are missed, and confirmatory tests for high specificity.

    A worked screening example

    Imagine screening 1,000 people for a condition that affects 1%, using a test that's 90% sensitive and 91% specific. Of the 10 people with the condition, 9 test positive. Of the 990 without it, about 89 also test positive. So 98 people get a positive result, but only 9 of them, about 9%, actually have the condition. The NPV, though, is excellent: of the 902 negative results, only 1 is a missed case. This is why national screening programmes carefully weigh the harms of false positives, such as anxiety and unnecessary follow-up tests, against the benefits of early detection.

    Other measures

    Accuracy, the proportion of all results that are correct, can be misleading when prevalence is very low or high, because a test that always says negative can look accurate for a rare disease. The F1 score, the harmonic mean of PPV and sensitivity, is popular in machine learning for the same reason. To compare outcomes between two groups rather than evaluate a test, use our odds ratio and relative risk calculator.

    Frequently asked questions

    What is the difference between sensitivity and PPV?
    Sensitivity is the chance that a person with the condition tests positive. PPV is the chance that a person who tests positive has the condition. Sensitivity is fixed for a test; PPV changes with prevalence.
    Why is PPV low for rare diseases?
    When few people have the condition, even a small false-positive rate among the much larger healthy group produces more false positives than true positives, so most positive results are false alarms.
    What is a good likelihood ratio?
    An LR+ above 10 or an LR− below 0.1 is strong evidence. Values between 2 and 5 (or 0.2 and 0.5) make only small changes to the probability of disease.
    Can I calculate PPV from sensitivity and specificity alone?
    No. You also need the prevalence, or pre-test probability. Enter all three in rate mode to see how PPV and NPV change.
    What does SnNout and SpPin mean?
    SnNout: a highly Sensitive test, when Negative, rules the condition out. SpPin: a highly Specific test, when Positive, rules it in.

    ↑↓ to navigate · Enter to open