Bayes' Theorem Calculator
Enter how common something is, how often a test catches it and how often the test raises a false alarm, and the calculator gives the chance that a positive result is real. It shows the answer as percentages and as counts out of a population, the likelihood ratio, the chance after a negative result, and how the answer climbs when several independent tests all come back positive. A second tab handles the plain form with P(A), P(B given A) and P(B). Everything runs in your browser.
How common A is before the evidence
Chance of a positive when A is true
Chance of a positive when A is false
| Have A | 100 |
| Have A and test positive | 80 |
| Have A and test negative | 20 |
| Do not have A and test positive | 950.4 |
| Do not have A and test negative | 8,949.6 |
Of every 1,030.4 people who test positive, about 80 really have A.
| Before any test | 1% |
| 1 positive result | 7.764% |
| 2 positive results | 41.23% |
| 3 positive results | 85.39% |
| 4 positive results | 97.99% |
| 5 positive results | 99.75% |
Bayes' theorem says P(A given B) equals P(B given A) times P(A), divided by P(B). In a test, P(B) adds the true positives and the false positives, which is why a rare condition can produce mostly false alarms even with an accurate test. The prior is how common the condition is before the result. The classic example is a screening test with 1% prevalence, 80% sensitivity and a 9.6% false positive rate: a positive result means about a 7.8% chance of having the condition. Several positives in a row assume the tests are independent, which real tests often are not. Everything is worked out in your browser.
Related Tools
[5 suggestions]Binomial Probability Calculator
Find the chance of exactly, at most or at least k successes in n trials, with the mean, standard deviation and a chart of the whole distribution.
Math & MoneyPermutation and Combination Calculator
Count permutations (nPr) and combinations (nCr), with or without repeats, plus factorials, as exact whole numbers.
Math & MoneyChi-Square Calculator: Independence and Goodness of Fit
Run a chi-square test of independence on a table of counts or a goodness of fit test, and get the statistic, p-value, expected counts and Cramer's V.
Student ToolsDice Probability Calculator
Find the exact odds for any dice roll, including keep highest, keep lowest, advantage and 4d6 drop lowest, with a full table and a roll button.
Student ToolsZ-Score Calculator
Turn a value into a z-score, a z-score into probabilities and percentiles, or a percentile back into a z-score, using the standard normal distribution.
Math & MoneyAbout the Bayes' Theorem Calculator
Bayes' theorem says that P(A given B) equals P(B given A) times P(A), divided by P(B). In a test, A is the condition you care about and B is a positive result, so the numbers you need are the prior P(A), the sensitivity P(B given A) and the false positive rate P(B given not A). The denominator P(B) adds up the true positives and the false positives, P(A) times the sensitivity plus P(not A) times the false positive rate. That is why a rare condition can produce mostly false alarms even when the test is accurate. The classic example is a screening test for a condition with 1% prevalence, 80% sensitivity and a 9.6% false positive rate. A positive result means only a 7.8% chance of having the condition, because P(B) is 10.304% and most of it comes from the 99% of people who do not have the condition. The odds form says posterior odds equal prior odds times the likelihood ratio, the sensitivity divided by the false positive rate, which is also how a second positive result is handled when tests are independent. Thinking in natural frequencies, such as 80 true positives against 950 false positives out of 10,000 people, makes the logic easy to see. Real tests are often not independent, and the prior must be the right one for the person being tested.
What is Bayes' theorem in simple terms?▾
It tells you how to update a probability when you get new evidence. You start with how likely something was beforehand, weigh how well the evidence fits when it is true against when it is false, and end with a new probability.
Why is a positive test often a false alarm?▾
When the condition is rare, most people tested do not have it, so even a small false positive rate produces many false alarms compared with the few true cases. With 1% prevalence, 80% sensitivity and a 9.6% false positive rate, only 7.8% of positive results are real.
What is the prior probability?▾
It is the chance of the condition before you see the evidence, usually the base rate in the group you belong to. Choosing the right prior matters a lot, and it is the most common source of mistakes.
Can I use it with more than one test?▾
Yes, if the tests are independent given the condition. Each positive result multiplies the odds by the likelihood ratio, and the calculator shows the chance after up to five positives in a row. If the tests share a cause of error, repeating them helps less than shown.
Is my data uploaded?▾
No. The calculation runs in your browser and nothing you enter is sent anywhere.