Bayes Theorem Calculator

%
%
%
Share:

What Bayes' theorem computes

Bayes' theorem flips conditional probabilities around: given P(B|A) plus the base rates, it derives P(A|B), the reverse direction that real decisions actually need. Medical screening, spam filters, fault diagnosis, and legal reasoning all lean on it, because evidence should update belief, not replace it. In short, it converts how likely the evidence is into how likely the cause is.

This calculator does the bookkeeping for you. Supply the prior P(A) together with the two likelihoods, and it returns the posterior P(A|B) you actually care about, no algebra required.

The formula, with a classic example

The rule reads P(A|B) = P(B|A)P(A) / P(B), and the denominator expands as P(B) = P(B|A)P(A) + P(B|not A)P(not A). Screening example: a disease affects 1 percent of people, a positive result appears in P(B|A) = 0.99 of true cases, and P(B|not A) = 0.05 for healthy people.

So P(B) = 0.0099 + 0.0495 = 0.0594, and P(A|B) = 0.0099 / 0.0594 = 0.167. Even with 99 percent sensitivity, only about 17 percent of positives are genuine cases. The 99 percent figure described the test, while the 1 percent base rate decided the answer.

Using the calculator

First choose the Input as format, Percentages e.g. 5% or Proportions e.g. 0.05. Then fill in P(A), the Probability of the event based on everything known before evidence, alongside P(B|A) and P(B|not A). Keeping every number on one scale prevents the most common input mistake.

Press Calculate probabilities and read the posterior P(A|B) together with P(B). If the answer feels shockingly low, inspect the prior first, since most surprising Bayes results trace back to a neglected base rate.

Frequently Asked Questions

What is the base rate fallacy?

It is ignoring how rare the condition is. With disease prevalence at 1 percent, a 99 percent sensitive test still leaves P(A|B) at only about 17 percent, because false positives from the healthy majority dominate.

What do P(B|A) and P(B|not A) mean?

P(B|A) is the probability of seeing evidence B when A is true, and P(B|not A) is the false-positive rate, seeing B when A is false. Together they build the denominator P(B).

Does the posterior P(A|B) equal P(B|A)?

Almost never, and confusing the two is the classic prosecutor's fallacy. A 0.99 chance of evidence given guilt is not a 0.99 chance of guilt given evidence, since base rates intervene.

Percentages or proportions: which should I use?

Either, as long as entries stay consistent. Pairs such as P(A) = 5% and P(B|A) = 99%, or equivalently 0.05 and 0.99, both work; just match the input format selector.

How do I update belief twice in a row?

Chain the rule: use the posterior from the first round as the new prior, combine it with the next evidence's likelihoods, and recompute. Sequential screening of a patient works exactly this way.

Scroll to Top