Bayes’ Theorem Calculator
Compute the posterior probability P(A|B) from the prior P(A), the evidence P(B), and the likelihood P(B|A).
Result
- Prior P(A)0.01
- Likelihood P(B|A)0.9
- Evidence P(B)0.05
- Joint P(A∩B) = P(B|A)·P(A)0.009000
- Posterior P(A|B)0.180000
Step-by-step
- Bayes: P(A|B) = P(B|A)·P(A) ÷ P(B).
- Numerator P(B|A)·P(A) = 0.9 × 0.01 = 0.009000.
- P(A|B) = 0.009000 ÷ 0.05 = 0.180000 (18.00%).
How to use this calculator
- Enter the prior probability P(A) — the base rate before evidence.
- Enter the likelihood P(B|A) — how likely the evidence is when A holds.
- Enter the overall evidence probability P(B).
- Read the posterior P(A|B), your updated probability after the evidence.
About this calculator
Bayes’ theorem updates a probability in light of new evidence. It combines three ingredients: the prior P(A), your belief that A is true before seeing the evidence; the likelihood P(B|A), how probable the evidence B is when A is true; and the overall probability of the evidence P(B). The posterior P(A|B) — your updated belief after seeing B — equals P(B|A) times P(A), divided by P(B). The classic illustration is medical testing: even a 90%-accurate test for a disease that affects only 1% of people yields a surprisingly low probability of actually having the disease given a positive result, because the rare base rate dominates. This calculator makes that base-rate effect explicit by showing the joint probability and the final posterior.
How it works — the formula
P(A|B) = P(B|A) · P(A) ÷ P(B)
(law of total probability: P(B) = P(B|A)P(A) + P(B|¬A)P(¬A))The posterior is the joint probability of A and B divided by the total probability of B, rescaling the prior by how consistent the evidence is with A.
Worked examples
- Inputs:
- pa=0.01, pba=0.9, pb=0.05
- Output:
- P(A|B) = 0.18 (18%)
- Inputs:
- pa=0.5, pba=0.8, pb=0.6
- Output:
- P(A|B) = 0.667
- Inputs:
- pa=0.3, pba=0.5, pb=0.4
- Output:
- P(A|B) = 0.375
Limitations
- Requires P(B) directly; compute it via total probability if you only have the false-positive rate.
- Garbage-in: an inaccurate prior or likelihood gives a misleading posterior.
- Assumes the three inputs are mutually consistent probabilities.
A mathematical update rule; the quality of the answer depends on the quality of the inputs.