Statistics & Probability

Bayes' Theorem Calculator

Find the probability that a condition is true given a positive test, using Bayes’ theorem.

Your numbers

Your results

P(B), overall chance of a positive
P(B), overall chance of a positive
—
P(A | B), posterior
—
P(not A | not B)
—

Bayes' Theorem Calculator by TheCalcTools

How the Bayes' Theorem Calculator works

Enter how common the condition is, how often the test is positive when it is present, and how often it is positive when it is absent.

The calculator finds the overall chance of a positive result.

Bayes’ theorem then gives the probability the condition is present given a positive result.

The formula

P(A | B) = P(B | A) × P(A) ÷ P(B)P(B) = P(B | A)P(A) + P(B | not A)P(not A)

Worked example

Using the default values shown in the calculator:

Prior probability P(A) (%)1
P(B | A), true positive rate (%)90
P(B | not A), false positive rate (%)5
  1. P(B) = 0.9 × 1% + 5% × 99% = 5.85%.
  2. P(A | B) = 0.9% ÷ 5.85% = 15.38%.
  3. Even with a positive result, the chance is about one in seven.

Result:

P(B), overall chance of a positive5.85%
P(A | B), posterior15.38%
P(not A | not B)99.89%

Frequently asked questions

Why is the posterior so low for rare conditions?

When a condition is rare, most positive results come from the many healthy people who get a false positive, even if the test is accurate.

What is the prior?

The probability of the condition before you see the new evidence, often the base rate in the population.

Sources and further reading

More in Statistics & Probability · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.