Statistics
Bayes' Theorem Calculator
Enter how likely A is before seeing evidence (the prior), how often the evidence B appears when A is true, and how often it appears when A is false. mathcheck applies Bayes' theorem and shows the joint-probability tree, the total probability of B, the posterior P(A|B), the posterior when B is absent, and the odds-and-Bayes-factor version students meet later.
How common A is before any evidence — the base rate.
How often the evidence appears when A is true (a test's sensitivity, for example).
How often the evidence appears when A is false (a false-positive rate).
Try an example
Result
Posterior P(A | B)
—
- P(not A | B)
- —
- P(B) — total probability of the evidence
- —
- P(A | not B)
- —
- Bayes factor (likelihood ratio)
- —
- Posterior odds A : not A
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the bayes' theorem calculator solves
Enter how likely A is before seeing evidence (the prior), how often the evidence B appears when A is true, and how often it appears when A is false. mathcheck applies Bayes' theorem and shows the joint-probability tree, the total probability of B, the posterior P(A|B), the posterior when B is absent, and the odds-and-Bayes-factor version students meet later.
Formula
How to use it
- Enter the prior P(A): the base rate of A before evidence.
- Enter P(B|A), how often the evidence shows up when A is true, and P(B|not A), how often it shows up when A is false.
- Read P(A|B), the updated probability of A after seeing B, plus P(A|not B) for the opposite outcome.
- Open 'Show the work' for the tree branches, the natural-frequency version per 10,000 cases, and the odds form.
How to read the answer
The posterior P(A|B) is the fraction of all B outcomes that come from A. When A is rare, even accurate evidence produces many false alarms from the large 'not A' group, so P(A|B) can be far below P(B|A); that gap is the base-rate fallacy. The Bayes factor P(B|A)/P(B|not A) says how much the evidence shifts the odds regardless of the prior.
Common mistakes and edge cases
- Confusing P(B|A) with P(A|B); the first is the evidence rate given A, the second is what you want.
- Ignoring the base rate and reading the sensitivity as the posterior.
- Entering decimals in the percent fields (0.01 instead of 1).
- Using P(not B | not A) (specificity) where P(B | not A) (false-positive rate) belongs; they add to 100%.
Worked examples
Rare condition, accurate screen
1% base rate, 90% detection, 5% false positive
Posterior P(A | B)
0.1538 (15.38%)
Common condition
30% base rate with the same screen
Posterior P(A | B)
0.8852 (88.52%)
Uninformative evidence
B is equally likely either way, so the posterior equals the prior
Posterior P(A | B)
0.2 (20.00%)
Perfect evidence
B never occurs without A
Posterior P(A | B)
1 (100.00%)
Zero prior
If A is impossible, no evidence can revive it
Posterior P(A | B)
0 (0.00%)
Undefined: evidence never occurs
Posterior P(A | B)
Error
Frequently asked questions
What is Bayes' theorem in plain words?+
It updates a probability with evidence: the chance of A given B equals the chance of both A and B happening, divided by the chance of B happening at all. P(A|B) = P(B|A)P(A)/P(B).
Why is P(A|B) so low when the test is 90% accurate?+
Because A is rare. With a 1% base rate, out of 10,000 cases only 100 have A and 90 of them show B, while 495 of the 9,900 without A also show B. So B comes from A only 90/585 ≈ 15% of the time.
What is the difference between P(B|A) and P(A|B)?+
P(B|A) is the likelihood: how often evidence B appears when A is true. P(A|B) is the posterior: how likely A is once you have seen B. Bayes' theorem converts one into the other using the base rate.
What is a Bayes factor?+
The ratio P(B|A)/P(B|not A). Multiply the prior odds by it to get the posterior odds. A Bayes factor of 18 means the evidence is 18 times more likely under A than under not A.
How do I find P(B), the total probability of the evidence?+
Add the two branches of the tree: P(B) = P(B|A)P(A) + P(B|not A)P(not A). This is the law of total probability and is the denominator of Bayes' theorem.
Can I use this for a two-stage screening problem?+
Yes. Use the posterior from the first test as the prior for the second, with the second test's rates as the likelihoods. This is an educational calculator; it does not interpret real test results for any individual.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Probability Calculator
Calculate event probability, complement probability, odds, and repeated independent event probabilities.
Odds Probability Calculator
Convert between odds in favor, odds against, probability, complement, and percentage chance.
Expected Value Calculator
Calculate expected value from outcome and probability lists.
Combination and Permutation Calculator
Calculate combinations and permutations for counting problems where order may or may not matter.
Binomial Probability Calculator
Calculate exact binomial probability for k successes in n independent trials.
Average Calculator
Calculate arithmetic, weighted, geometric, or harmonic averages from a list of numbers with steps and summary statistics.
Last updated: September 4, 2026