Bayes Theorem Calculator

Bayes' theorem is the rule for updating a probability after seeing new evidence. Enter the prior probability of your hypothesis, the likelihood that the evidence appears when the hypothesis is true (the true positive rate), and the false positive rate when the hypothesis is false. The calculator returns the posterior probability P(A|B): the updated chance that the hypothesis is true given that you observed the evidence. It also reports the total probability of the evidence so you can see exactly how the denominator is built. This is the engine behind medical test interpretation, spam filters, and rational belief updating.

0.00
0.00
0.00
0.00

Bayes' theorem formula

P(not A) = 1 - P(A)
P(B) = P(B|A) * P(A) + P(B|not A) * P(not A)
P(A|B) = P(B|A) * P(A) / P(B)
P(not A|B) = 1 - P(A|B)

The posterior P(A|B) is the share of all evidence-positive cases that come from the true-hypothesis group. When the prior is tiny, the false-positive contribution dominates the denominator and pulls the posterior far below the true positive rate.

How to read the result

  • The prior P(A) is the base rate before any evidence: the fraction of cases for which the hypothesis is true.
  • The true positive rate P(B|A), also called sensitivity, is how reliably the evidence shows up when the hypothesis is true.
  • The false positive rate P(B|not A) is how often the evidence shows up by mistake when the hypothesis is false.
  • All three inputs are probabilities and must lie between 0 and 1 inclusive.
  • The famous "1 percent base rate, 99 percent accurate test" example yields a posterior near 16.7 percent, not 99 percent.

Bayes theorem: frequently asked questions

What is Bayes' theorem?

Bayes' theorem relates a conditional probability to its inverse. It states that P(A|B) = P(B|A) times P(A) divided by P(B), where P(B) = P(B|A) times P(A) plus P(B|not A) times P(not A). It updates a prior belief P(A) into a posterior belief P(A|B) after observing evidence B.

What inputs does this calculator need?

It needs three probabilities, each between 0 and 1: the prior P(A) (the base rate of the hypothesis), the sensitivity or true positive rate P(B|A) (the chance the evidence appears when the hypothesis is true), and the false positive rate P(B|not A) (the chance the evidence appears when the hypothesis is false).

Why is the posterior often lower than people expect?

When the prior P(A) is very small (a rare condition), even a highly accurate test produces many false positives relative to true positives, because there are so many more cases in the not-A group. This is the base rate fallacy, and Bayes' theorem makes it explicit.

What is the total probability of the evidence P(B)?

P(B) is the overall chance of seeing the evidence regardless of the hypothesis. It is the weighted sum P(B|A) times P(A) plus P(B|not A) times (1 minus P(A)). This calculator reports it so you can see the denominator used in the posterior.

Are these results mathematically exact?

Yes. Bayes' theorem is an exact identity of probability theory derived from the definition of conditional probability. Given valid inputs in the range 0 to 1, the outputs are exact to within floating-point precision.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.