Bayes' Theorem Calculator
Result
Posterior P(A|B) 16.1017%
False Discovery Rate 83.8983%
P(B) — Total Probability 0.059
P(A∩B) — True Positives 0.0095
P(¬A∩B) — False Positives 0.0495
Apply Bayes' theorem to update a probability in light of new evidence. Enter the prior probability of an event, the chance of the evidence when the event is true, and the chance of the evidence when it's false. The calculator returns the posterior probability — a classic example is the real chance of having a disease after a positive test.
Formula
P(A|B) = P(B|A)×P(A) / [P(B|A)×P(A) + P(B|¬A)×P(¬A)]
- P(A) is the prior — your belief before seeing the evidence (e.g. how common a disease is).
- P(B|A) is the likelihood the evidence appears when A is true (e.g. the test's true-positive rate).
- P(B|¬A) is the chance of the same evidence when A is false (the false-positive rate).
- The denominator P(B) is the total probability of the evidence across both cases; the posterior P(A|B) is the updated belief.
- With a rare condition, even a very accurate test can give a surprisingly low posterior — the base rate matters enormously.
1% prevalence, 95% true positive, 5% false positive
Inputs
- Prior P(A) — e.g. disease prevalence: 0.01
- P(B|A) — e.g. true positive rate: 0.95
- P(B|¬A) — e.g. false positive rate: 0.05
P(B) = 0.95×0.01 + 0.05×0.99 = 0.059. Posterior = (0.95×0.01) ÷ 0.059 ≈ 16.1%. So even after a positive test, there's only about a 16% chance of actually having the condition.
Frequently asked questions
What is Bayes' theorem used for?
It updates the probability of a hypothesis when new evidence arrives. It's widely used in medical testing, spam filtering, machine learning and risk analysis.
Why is the posterior so low after a positive test?
Because the condition is rare. When only 1% of people have it, the small false-positive rate applied to the other 99% produces many false alarms, diluting the true positives.
What is the difference between prior and posterior?
The prior is your probability before seeing the evidence; the posterior is the revised probability after taking the evidence into account.
What values should I enter?
All three inputs are probabilities between 0 and 1: the prior P(A), the true-positive rate P(B|A), and the false-positive rate P(B|¬A).