Bayes Theorem Calculator
Compute the posterior probability P(A | B) from a prior, likelihood, and false-positive rate.
How it works
- 1Enter the prior probability P(A) — your initial belief that event A is true before observing any evidence.
- 2Set P(B | A), the probability of observing evidence B when A is true (the likelihood or true-positive rate).
- 3Set P(B | not A), the probability of observing B when A is false. The calculator applies Bayes’ theorem to return the updated posterior P(A | B) and the total evidence P(B).
Use cases
- Medical testing: estimate the probability a patient truly has a disease after a positive test, accounting for prevalence and accuracy.
- Spam filtering: update the probability an email is spam after observing specific words or features.
- Risk assessment: revise the likelihood of a fault after a sensor alarm fires, given known false-alarm and miss rates.
Frequently asked questions
What is Bayes’ theorem?
Bayes’ theorem states P(A | B) = P(B | A) × P(A) ÷ P(B), where P(B) = P(B | A) × P(A) + P(B | not A) × (1 − P(A)). It describes how to rationally update a prior belief in light of new evidence.
Why does a highly accurate test still give a modest posterior with a rare disease?
When prevalence (the prior) is very low — say 1% — even a test with 99% sensitivity and 95% specificity yields a posterior near 17%. Because true cases are rare, false positives among the healthy majority outweigh true positives. This is the base-rate fallacy.
What do evidence P(B) and posterior P(A | B) mean?
P(B) is the total probability of observing the evidence under all hypotheses — a normalising constant. P(A | B) is the updated probability that A is true now that you have seen B.
Related tools
See all →Calculate the area and perimeter of a rectangle from its width and height, with a labeled diagram.
Calculate the area and circumference of a circle from its radius, with a labeled diagram.
Calculate the area (Heron’s formula) and perimeter of a triangle from its three sides.
Calculate the area and perimeter of a trapezoid from its two parallel sides, height, and legs.