Statistics & probability

Bayes theorem calculator

Update a prior probability using evidence likelihoods and inspect the expected groups.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your numbers and select Calculate.

Behind the numbers

How this calculation works

Split the evidence B into the contribution from A and the contribution from not-A. Their sum is P(B). The posterior is the share of that evidence that came from A. If evidence has zero probability, the conditional result is undefined.

THE FORMULAP(A | B) = P(B | A)P(A) ÷ [P(B | A)P(A) + P(B | not A)P(not A)]

A worked example

With a 1% prior, 90% evidence likelihood for A and 5% for not-A, P(A | B) is approximately 15.384615%.

Good to know

A mathematical probability model, not a fit test or an empirical guarantee. Inputs must match the model assumptions. Floating-point arithmetic is used; extremely small probabilities may underflow or round to zero.

A little curiosity

Rare groups can be outnumbered in the evidence

Consider a population where 1% of items have label A. An inspection flags 90% of A items and 5% of other items. A flag is much more likely for an A item individually, yet the many not-A items can still produce most flags.

Among 10,000 expected items, there are 100 A items and 9,900 not-A items. The model yields 90 flagged A items and 495 flagged not-A items. Therefore 90 of 585 flags belong to A, giving approximately 15.3846%.

The expected-count table makes that denominator visible. Its counts are implied by the entered probabilities; they are not observations collected by the website and do not need to be whole numbers.

Keep the direction of the conditional probability straight

P(B | A) asks how often evidence B appears among A items. P(A | B) asks how often A appears among items showing B. Reversing those conditions without using the prior and the other likelihood changes the question.

The two likelihoods must describe the same evidence definition and a population that is partitioned into A and not-A. Combining estimates from incompatible groups or selection rules can produce an arithmetic answer with a misleading interpretation.

If B has zero probability under all inputs, conditioning on B is undefined here. The calculator reports the issue rather than returning zero or 100%. A posterior describes the entered assumptions and does not validate how those assumptions were estimated.

A few questions, answered

Is this restricted to inspection examples?

No. A and B can be any events satisfying the stated probability relationships. The labels are deliberately generic.

What if the evidence is equally likely in both groups?

With positive evidence probability, the posterior equals the prior: the evidence does not distinguish A from not-A.

Can I use multiple pieces of evidence?

This page performs one update with one pair of likelihoods. Repeatedly multiplying likelihoods requires appropriate conditional-independence assumptions, which this page does not infer.

Find your calculator

Start typing to explore the library.