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).

Inputs

Probability of A before seeing evidence (0 to 1).

Overall probability of observing B (0 to 1).

Probability of B given A is true (0 to 1).

Result

Posterior P(A|B)
0.180000
18.00%
  • 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
Note — Probabilities must be between 0 and 1, and P(B) must be at least P(B|A)·P(A) to be consistent. The posterior is only as good as the inputs — especially the base rate P(A), which is easy to neglect.

Step-by-step

  1. Bayes: P(A|B) = P(B|A)·P(A) ÷ P(B).
  2. Numerator P(B|A)·P(A) = 0.9 × 0.01 = 0.009000.
  3. 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

Example 1
Disease test: P(A)=0.01, P(B|A)=0.9, P(B)=0.05
Inputs:
pa=0.01, pba=0.9, pb=0.05
Output:
P(A|B) = 0.18 (18%)
Example 2
P(A)=0.5, P(B|A)=0.8, P(B)=0.6
Inputs:
pa=0.5, pba=0.8, pb=0.6
Output:
P(A|B) = 0.667
Example 3
P(A)=0.3, P(B|A)=0.5, P(B)=0.4
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.

Frequently asked

It is the rule for updating a probability with new evidence: P(A|B) = P(B|A)·P(A) ÷ P(B). It converts a prior belief into a posterior belief by weighting it with how well the evidence fits.

Related calculators

More tools you might like