Bayes Theorem Calculator
Bayes theorem is the mathematical formula for updating a probability estimate when you receive new evidence. It underpins much of modern statistics, machine learning, medical diagnosis, and reasoning under uncertainty. The theorem connects three probabilities you usually know or can estimate to produce one you want to find out. The prior probability P(A) is how likely the event or condition is before you see the evidence. The likelihood P(B|A) is how likely the evidence would be if the event is true. The false positive rate P(B|not A) is how likely the evidence would appear even if the event is not true. Combining these three using Bayes theorem gives you the posterior probability P(A|B): the updated probability that A is true now that you have observed B. One of the most important and counterintuitive lessons from Bayes theorem is how much the base rate matters. If a condition is very rare, even a highly accurate test will produce mostly false positives, because the large pool of unaffected people swamps the small pool of truly affected people. With a prior of 1%, a sensitivity (true positive rate) of 90%, and a false positive rate of 10%, the posterior probability is only about 8.33%. This calculator accepts all three inputs as percentages or decimals and returns the posterior P(A|B), the total probability of observing B, and the likelihood ratio. It is useful for students, medical students learning diagnostic reasoning, engineers working on signal detection, and anyone applying Bayesian thinking to real-world problems.
How it works
Bayes theorem states: P(A|B) = P(B|A) x P(A) / P(B). The total probability of B is P(B) = P(B|A) x P(A) + P(B|not A) x P(not A). The likelihood ratio is P(B|A) divided by P(B|not A). All inputs are converted from percentages to decimals for the calculation. The posterior P(not A|B) is 1 minus P(A|B). Division by zero (when P(B) is zero) returns N/A.
Worked example
A condition affects 1% of the population: P(A) = 0.01. A test detects it correctly 90% of the time: P(B|A) = 0.90. The test also triggers incorrectly on 10% of healthy people: P(B|not A) = 0.10. P(B) = 0.90 x 0.01 + 0.10 x 0.99 = 0.009 + 0.099 = 0.108, or 10.80%. Posterior = (0.90 x 0.01) / 0.108 = 0.009 / 0.108 = 8.33%. The likelihood ratio is 0.90 / 0.10 = 9.00. These match the default values pre-filled above.
Related calculators
- P-value Calculator: find the p-value for a hypothesis test from a z-score or t-score.
- Odds Probability Converter: convert between fractional odds and probability percentages.
- Expected Value Calculator: calculate the long-run average of a probability distribution.
- Margin of Error Calculator: calculate the confidence interval width for a survey proportion.
- Common Factor Calculator: Find All Common Factors and GCF.
- Comparing Fractions Calculator: Which Fraction is Bigger?