Bayes' theorem calculator

Enter the prior P(A) and the likelihood P(B|A), then either P(B) directly or P(B|not A). Probabilities can be written as 0.25 or 25%.

How likely A is before you see B. Write 0.01 or 1%.
How likely B is when A is true, such as a test's sensitivity.
Used with the first choice. How likely B is when A is false.
Used with the second choice. The overall chance of B.
Posterior P(A|B)15.3846%
As a decimal
0.15384615
P(B) used
0.0585 (5.85%)
P(not A|B)
84.6154%
Change from the prior
15.3846×

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter P(A), the probability of the hypothesis before the new evidence.
  2. Enter P(B|A), how likely the evidence is when A is true.
  3. Pick what else you know: P(B|not A) or P(B), and fill that box.
  4. Read P(A|B), the updated probability.

How it works

Bayes’ theorem is P(A|B) = P(B|A) × P(A) / P(B). When you give P(B|not A) instead of P(B), the calculator first finds P(B) = P(B|A) × P(A) + P(B|not A) × (1 − P(A)). The “change from the prior” row is P(A|B) divided by P(A).

Worked example

A condition affects 1% of people. A test is positive for 90% of those who have it and for 5% of those who do not.

  • P(B) = 0.9 × 0.01 + 0.05 × 0.99 = 0.0585
  • P(A|B) = 0.009 / 0.0585 ≈ 0.1538, or 15.38%

So only about 15% of positive results are true positives.

Tips

  • Keep “A” and “B” straight: P(A|B) and P(B|A) are different numbers.
  • If P(A) is 0 or 1, the evidence cannot change it.

Frequently asked questions

What is Bayes' theorem?

It updates a probability when you learn new evidence. P(A|B) = P(B|A) × P(A) / P(B), the chance of A once B is known.

How do I get P(B) if I only know the false-positive rate?

Use the law of total probability, P(B) = P(B|A) × P(A) + P(B|not A) × (1 − P(A)). Choose the first option and the calculator does this for you.

Why is a positive test often less certain than people expect?

When A is rare, most positive results come from the large group without A, even if the false-positive rate is small. The default example shows this, with a 1% prior and a 90% sensitive test.

Can I type percentages?

Yes. Write 5% or 0.05; both mean the same. Values must stay between 0 and 1 (0% to 100%).

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.