Statistics

Bayes’ Theorem Calculator

Update a probability using new evidence with Bayes' theorem.


Bayes’ Theorem Calculator

Updates the probability of an event given new evidence, using Bayes’ theorem — a foundational result in probability theory.

How it works

The reversed conditional probability (P(B|A)) is combined with the prior probability of A and the overall probability of B to give the updated (posterior) probability.

What this does not include

This does not include directly computing a conditional probability from P(A∩B) — for that simpler case, use this site’s conditional probability calculator instead.

How to use this calculator

  1. Enter P(B|A), P(A), and P(B).

A worked example

A test is 90% accurate for a condition with a 1% prior probability, and the test comes back positive in 5% of the general population: posterior probability = (0.9 × 0.01) ÷ 0.05 = 0.18, or 18% — far lower than the test’s 90% accuracy might suggest.

P(B|A)=0.8, P(A)=0.3, P(B)=0.5 → posterior = 0.48.

What the variables mean

Variable Meaning
P(B|A) Probability of the evidence, given the hypothesis is true
P(A) The prior — probability of the hypothesis before seeing evidence
P(B) Overall probability of the evidence occurring at all

Edge cases worth knowing

A rare condition can make even an accurate test mostly wrong on positives. The first worked example is the classic case: a highly accurate 90% test still produces an 18% posterior probability, because the low 1% prior swamps the test’s individual accuracy.

A P(B) of zero has no defined posterior — if the evidence itself has zero probability of occurring, dividing by it is undefined.

Frequently asked questions

Why is Bayes’ theorem important in medical testing?

It explains why a highly accurate test can still produce mostly false positives when testing for a rare condition — the low prior probability of having the condition swamps even a very accurate test’s reliability.

What’s a “prior” and a “posterior” probability?

The prior (P(A)) is your belief before seeing the evidence; the posterior (P(A|B)) is your updated belief after accounting for the evidence B.

Where does Bayes’ theorem come from?

It follows directly from the definition of conditional probability, rearranged algebraically to let you flip the direction of conditioning.

Be the first to rate this

Written and checked by the Calculator Folks editorial team. How we write and review

Related calculators