Bayes' Theorem Calculator

Bayes' theorem updates a probability using new evidence. With 1% prevalence, 90% sensitivity and a 5% false positive rate, a positive result means only about a 15% chance of having the condition, because most positives come from the large group without it. That surprises many people, and it is why screening rare conditions produces many false alarms.

A negative result is far more reassuring, at about 0.1% chance.

Bayes' Theorem Calculator: inputs

Calculated result
Chance of the condition after a positive test15.4%
Chance of a positive test overall5.9%
Chance of the condition after a negative test0.106%

Bayes' Theorem Calculator: Prevalence (prior chance) sensitivity

Bayes' Theorem Calculator: Prevalence (prior chance) and Chance of the condition after a positive test5 calculations vary the “Prevalence (prior chance)” input while holding the other entered inputs constant.0.500%8.3%0.750%12.0%1.0%15.4%1.3%18.6%1.5%21.5%

Bayes' Theorem: formula

P(condition | positive) = sensitivity × prevalence ÷ [sensitivity × prevalence + false positive rate × (1 − prevalence)]

NIST/SEMATECH e-Handbook of Statistical Methods

The result depends on accurate inputs, and prevalence is often uncertain. Tests are not independent when repeated on the same person. Real decisions use clinical context, symptoms and follow-up tests, not one probability.

The same math applies to spam filters, security alerts and legal evidence, where the base rate is often ignored.

Bayes' Theorem: worked example

Prevalence (prior chance)1.0%
Sensitivity90.0%
False positive rate5.0%
Chance of the condition after a positive test15.4%
Chance of a positive test overall5.9%
Chance of the condition after a negative test0.106%

Prevalence is the proportion with the condition before testing. Sensitivity is the probability of a positive result with the condition; the false-positive rate is the probability of a positive result without it. Take these from the test's documentation or studies.

Specificity equals one minus the false positive rate. Use the prevalence in the group being tested, not the general population, since it changes the result greatly.

Bayes' Theorem: changing Prevalence (prior chance)

Prevalence (prior chance)Chance of the condition after a positive testChance of a positive test overallChance of the condition after a negative test
0.500%8.3%5.4%0.053%
0.750%12.0%5.6%0.079%
1.0% (example)15.4%5.9%0.106%
1.3%18.6%6.1%0.133%
1.5%21.5%6.3%0.160%

Bayes' Theorem: compare input ranges

InputTested fromToChance of the condition after a positive test: low inputChance of the condition after a positive test: high inputSwing
Prevalence (prior chance)0.750%1.3%12.0%18.6%6.6% (43%)
False positive rate4.0%6.0%18.5%13.2%5.4% (35%)
Sensitivity88.0%92.0%15.1%15.7%0.579% (3.8%)

Bayes' Theorem: individual input comparisons

InputValueChance of the condition after a positive testChance of a positive test overallChance of the condition after a negative test
Prevalence (prior chance)0.500%8.3%5.4%0.053%
0.750%12.0%5.6%0.079%
1.0%15.4%5.9%0.106%
1.3%18.6%6.1%0.133%
1.5%21.5%6.3%0.160%
Sensitivity86.0%14.8%5.8%0.149%
88.0%15.1%5.8%0.127%
90.0%15.4%5.9%0.106%
92.0%15.7%5.9%0.085%
94.0%16.0%5.9%0.064%
False positive rate3.0%23.3%3.9%0.104%
4.0%18.5%4.9%0.105%
5.0%15.4%5.9%0.106%
6.0%13.2%6.8%0.107%
7.0%11.5%7.8%0.108%

Bayes' Theorem: combined input changes

Prevalence (prior chance) / Sensitivity86.0%90.0%94.0%
0.500%8.0%8.3%8.6%
0.750%11.5%12.0%12.4%
1.0%14.8%15.4%16.0%
1.3%17.9%18.6%19.2%
1.5%20.8%21.5%22.3%

Bayes' Theorem: which assumptions move the result?

Bayes' Theorem: Chance of the condition after a positive test as Prevalence (prior chance) changesChance of the condition after a positive test starts at 8.3%. Moving Prevalence (prior chance) from 0.500% to 1.5% changes it to 21.5%, with Sensitivity 90.0%; False positive rate 5.0% kept fixed.0.500%8.3%0.750%12.0%1.0%15.4%1.3%18.6%1.5%21.5%
Chart quantityDisplayed settings
Prevalence (prior chance)0.500% → 1.5%
Chance of the condition after a positive test8.3% → 21.5%
Sensitivity90.0%
False positive rate5.0%
Bayes' Theorem: Chance of the condition after a positive test as False positive rate changesChance of the condition after a positive test starts at 23.3%. Moving False positive rate from 3.0% to 7.0% changes it to 11.5%, with Prevalence (prior chance) 1.0%; Sensitivity 90.0% kept fixed.3.0%23.3%4.0%18.5%5.0%15.4%6.0%13.2%7.0%11.5%
Chart quantityDisplayed settings
False positive rate3.0% → 7.0%
Chance of the condition after a positive test23.3% → 11.5%
Prevalence (prior chance)1.0%
Sensitivity90.0%

Bayes' Theorem: values and definitions

Quantity and definitionValue used
Prevalence (prior chance) — How common the condition is before any test.1.0%
Sensitivity — The chance the test is positive when the condition is present.90.0%
False positive rate — The chance the test is positive when the condition is absent.5.0%
Chance of the condition after a positive test15.4%
Chance of a positive test overall5.9%
Chance of the condition after a negative test0.106%

Bayes' Theorem: half and double Prevalence (prior chance)

Prevalence (prior chance)Chance of the condition after a positive test
0.500%8.3%
1.0%15.4%
2.0%26.9%

Common error: Reading sensitivity as the chance of having the condition after a positive test. Those are different numbers, and mixing them up is one of the most common errors in medical testing.

Statistics & Probability calculators: Mean & Median Calculator, Standard Deviation Calculator, Range & Midrange Calculator, Permutation & Combination Calculator, Simple Probability Calculator, Z-Score Calculator.

For a hypothetical group of 10,000 with 1% prevalence, 100 have the condition and 9,900 do not. At 90% sensitivity, 90 affected people test positive. A 5% false-positive rate adds 495 positive results from the unaffected group.

Only 90 of the 585 positive results are true positives: about 15.38%. The other 9,415 results are negative, including 10 affected people, so the chance after a negative result is about 0.106%. These counts follow from the entered assumptions; they are not observations from a clinical study.

Use the prevalence for the group being tested. A person with symptoms starts from a much higher prior than one tested at random, and the same test means more for them.

See the basic probability and binomial probability calculators, and the expected value page for decisions under uncertainty. The z-score, p-value and confidence interval calculators cover statistical testing. The permutation and combination page counts outcomes, which helps when you need to list every way an event can happen before applying the theorem.

Why is a positive test often a false alarm for rare conditions?

Because the healthy group is much larger, even a small false positive rate produces more false positives than there are true positives.

What is the base rate?

The prevalence of the condition in the population being tested, which strongly affects what a positive result means.

What are sensitivity and specificity?

Sensitivity is the share of people with the condition who test positive, and specificity is the share without it who test negative.