No ads, no sign-upChecked 2026-09-30

Bayes' Theorem Calculator

Your numbers

Change any value to update the result.

Posterior probability P(A|B)

0.153846

Posterior probability P(A|B): 0.153846
Examples
How the result moves

Your current valid inputs, with one value varied across the range.

Likelihood P(B|¬A) → Posterior probability P(A|B)
Likelihood P(B|¬A): 0.05; Posterior probability P(A|B): 0.153846

How the result moves

Held fixed: Prior P(A) 0.0100, Likelihood P(B|A) 0.9000.

Likelihood P(B|¬A)Posterior probability P(A|B)
0.04000.185185
0.0500Your value0.153846
0.06000.131579

Bayes' theorem turns a belief held before the evidence into one held after it. The surprise is how much the prior weighs: with a 1 % prior, a test that catches 90 % of cases and cries wolf on 5 % leaves the posterior at 15 %, not at 90 %.

Worked examples

How it's calculated

P(A|B) = P(B|A)·P(A) ÷ [P(B|A)·P(A) + P(B|¬A)·(1 − P(A))]

  1. StepEnter the prior P(A) — how likely A is before any evidence.Prior P(A)=0.01
  2. StepEnter P(B|A), the chance of seeing the evidence when A is true.
  3. StepEnter P(B|¬A), the chance of the same evidence when A is false.
  4. ResultRead the posterior P(A|B), the belief after the evidence.0.153846

What this number means

Bayes' theorem answers the question a test result raises but does not answer by itself: given a positive result, how likely is the condition? The calculator gets there by weighing two groups against each other. Take the values set here.

A prior of 0.01 means one person in a hundred is affected; a likelihood of 0.9 means nine of every ten of those test positive. Out of ten thousand people that is 100 affected, 90 of whom test positive. The other 9,900 are unaffected, and a false-positive rate of 0.05 puts 495 of them in the positive column as well.

The denominator of the formula is nothing more than the sum of those two streams — 90 + 495 = 585 positive results in all — and the posterior is the genuine share of them: 90 ÷ 585 = 0.153846. What the calculator never checks is where the prior came from. The theorem is an updating rule, not a source of belief: feed it a prior plucked from the air and it hands back a posterior of the same quality, neatly carried to six decimals.

And it weighs exactly two hypotheses against exactly one piece of evidence. A third possibility, or a second test whose result is tied to the first, needs more than this page.

P(A|B) is not P(B|A)

A test that catches 90 % of cases gives you P(B|A). What a positive result is worth is P(A|B), and with a prior of 0.01 and a 5 % false-positive rate that is 0.153846.

The base rate carries most of the weight

When the prior is small, most positive evidence comes from the far larger group in which A is false. A prior of 0.001 with a 0.99 likelihood and a 0.01 false-positive rate still lands at 0.090164.

The prior decides what the evidence buys

With a prior of 0.01, a likelihood of 0.9 and 0.05 false positives give 0.153846. With a prior of 0.3, a likelihood of 0.95 and the same 0.05 give 0.890625.

The evidence must have positive probability

A prior of 0 or 1 stays unchanged when the evidence has positive probability. If the denominator is zero, the posterior is undefined and no numeric result is shown.

Commonly misread

MisconceptionThe test catches 90 % of cases, so a positive result makes me 90 % likely to have it.

CorrectionThose are two different probabilities: 90 % is P(B|A), while the question asks for P(A|B). With a prior of 0.01 and 5 % false positives the answer is 0.153846.

MisconceptionWith a good enough test the prior hardly matters.

CorrectionIt is usually the strongest lever. A prior of 0.001 with a 0.99 likelihood and 0.01 false positives gives 0.090164 — under ten percent, from an excellent test.

MisconceptionA posterior of 0.154 shows the test is unreliable.

CorrectionThe test is doing its job; the base rate is doing the rest. Most positive results come from the 99 % of cases in which A is false.

Reference table

Prior, P(B|A), P(B|¬A)SituationPosterior
0.01, 0.9, 0.05Rare condition, decent test0.153846
0.001, 0.99, 0.01Very rare, excellent test0.090164
0.1, 0.8, 0.2Uncommon, mediocre test0.307692
0.3, 0.95, 0.05Common, excellent test0.890625
0.5, 0.9, 0.1Coin-flip prior0.900000

Questions

How do I use Bayes' theorem?

Multiply the likelihood of the evidence given A by the prior of A, then divide by the total probability of that evidence. Enter the three probabilities as decimals between 0 and 1 and the calculator returns the posterior P(A|B).

What is the posterior probability?

The posterior P(A|B) is the probability of A after the evidence B has been observed. It updates the prior P(A) using how likely the evidence is when A is true versus when A is false.

Why is the posterior so low even with strong evidence?

That is the base-rate effect. When the prior is small, most of the positive evidence comes from the much larger group in which A is false, so even a high P(B|A) leaves the posterior modest. A prior of 0.01 with a likelihood of 0.9 and a false-positive rate of 0.05 gives about 0.154.

What inputs does the calculator need?

Three probabilities, each a decimal between 0 and 1: the prior P(A), the likelihood P(B|A) — the true-positive rate — and the likelihood P(B|¬A), the false-positive rate. The complement P(¬A) = 1 − P(A) is worked out for you.

When is there no answer at all?

When the evidence has zero total probability, the denominator is zero and the posterior is undefined. No numeric result is shown for those inputs. A positive denominator, however small, remains valid.

Sources and last check

  1. math.cmu.edu

Information, not professional advice.