Bayes Theorem Calculator
Turn P(A), P(B | A) and P(B | not A) into P(A | B), with the evidence term printed.
Bayes Theorem Calculator
Turn P(A), P(B | A) and P(B | not A) into P(A | B), with the evidence term printed.
What the page prints, and what it refuses
Every figure is printed with the rule or formula that produced it, and any numerical tolerance is stated on the result rather than implied. The page refuses an input the formula does not define and names the value it read; it prints no answer it cannot support.
The calculation runs entirely in this browser tab; nothing is uploaded.
The page applies Bayes' theorem to one event and one observation. A 1 % prior, a 99 % detection rate and a 5 % false-positive rate give a posterior of 16.67 %, not 99 %: the evidence term matters.
That evidence is printed on its own line, so the counter-intuitive answer can be checked: P(B) is 0.0594, and 0.0099 ÷ 0.0594 is the posterior.
Why a good test can still give a low posterior
P(A | B) = P(B | A)·P(A) ÷ P(B), where P(B) = P(B | A)·P(A) + P(B | not A)·P(not A). A rare condition means the second term can dominate even when the test is accurate.
The page prints both the numerator's ingredients and the denominator, so the arithmetic is visible. It also prints the complement posterior, which is 1 minus the answer for a two-event partition.
How to use Bayes Theorem Calculator
Enter the prior, the likelihood under A and the likelihood under not A, then press Run.
The result prints the posterior, its complement, the evidence P(B) and all three inputs.
What to Expect
Best for
- Updating a belief from one observation
- Explaining base-rate neglect
- Checking a diagnostic-test calculation
Not ideal for
- A network of many events
- Continuous distributions, which need a density
- A test whose sensitivity or specificity is unknown
What this tool keeps
- All three probabilities exactly as typed
What may need cleanup
- Nothing: the posterior is a final number
Common errors
- A probability outside 0 to 1 is refused
- A zero evidence term is refused as undefined
Example use cases
- Compute the rare-disease posterior
- See why a 99 % test is not a 99 % posterior
- Check a spam-filter step
Sample input
P(A) = 0.01, P(B|A) = 0.99, P(B|not A) = 0.05
Sample output
P(A|B) ≈ 16.6667 %, with P(B) = 0.0594
Who this is for
- Statistics students
- Anyone reading a diagnostic test result
Frequently asked questions
Why is the posterior only 16.67 %?
The condition is rare, so most positive results come from the much larger healthy group. The page prints the evidence term that makes that visible.
What is the evidence term?
P(B), the total probability of the observation across both cases. It is the denominator of Bayes' theorem and the reason a rare prior can dominate an accurate test.
Does this work for more than two cases?
No. This page is the two-case form, A and not A. A multi-case version needs a table of likelihoods and is a different calculation.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.