Math
Bayes Theorem Calculator
Update a prior probability with new evidence using Bayes' theorem. Plug in P(A), the likelihood P(B|A), and the false-positive rate P(B|not A) to get the posterior P(A|B).
Bayes' theorem inputs
Base rate of the hypothesis before seeing evidence.
Probability of evidence B when A is true (true-positive rate).
Probability of evidence B when A is false.
Enter each value as a decimal between 0 and 1 (for example, 0.05 for 5 percent). P(B|A) and P(B|not A) cannot both be 0.
Posterior P(A|B)
0.166667
16.67%
Evidence raised the probability by 15.67 percentage points.
Prior P(A)
1%
P(not A)
99%
Total P(B)
5.94%
Step by step
- Prior P(A)0.01
- Complement P(not A) = 1 - P(A)0.99
- Likelihood P(B|A)0.99
- False-positive rate P(B|not A)0.05
- Total probability P(B) = P(B|A) P(A) + P(B|not A) P(not A)0.0594
- Posterior P(A|B) = P(B|A) P(A) / P(B)0.166667
- Posterior as percent16.67%
Frequently Asked Questions about the Bayes Theorem Calculator
What is Bayes' theorem?
Bayes' theorem is the rule for updating a probability after seeing evidence. It says P(A|B) = P(B|A) * P(A) / P(B), where P(A) is the prior probability of a hypothesis A, P(B|A) is the likelihood of observing evidence B if A is true, and P(B) is the total probability of B across both A and not A. The result, P(A|B), is called the posterior. It is the heart of Bayesian inference and quietly powers everything from spam filters to disease screening.
Why does a 99 percent accurate medical test only return a 17 percent posterior in the default example?
This is the classic base-rate paradox. With a disease prevalence of 1 percent, a true-positive rate of 99 percent, and a 5 percent false-positive rate, the calculator returns about 0.167 (16.7 percent). Out of 10,000 people, only 100 actually have the disease and 99 of them test positive, while 9,900 do not and 495 of them also test positive. That gives 99 true positives among 594 total positives, so a random positive result has only a 99 / 594 = 16.7 percent chance of being a real case. The test is accurate; the base rate is just very low, so most positives are false.
What is the difference between a prior and a posterior?
The prior P(A) is what you believed about hypothesis A before seeing the new evidence. The posterior P(A|B) is what you should believe after the evidence is in. Bayes' theorem is the bridge between them. Useful evidence pulls the posterior away from the prior; uninformative evidence (where P(B|A) equals P(B|not A)) leaves the posterior equal to the prior. Watch the posterior move as you adjust the inputs; the gap between prior and posterior is exactly the information the evidence carried.
When should I use Bayes' theorem?
Use it any time you need to invert a conditional probability. The most common settings are medical and security testing (turning P(positive | disease) into P(disease | positive)), spam filtering (turning P(words | spam) into P(spam | words)), legal reasoning, A/B testing, machine-learning classifiers like naive Bayes, and any decision under uncertainty where you have a base rate plus a test result. If you can write down the prior, the true-positive rate, and the false-positive rate, this calculator gives you the posterior in one step.
Why does the base rate matter so much?
Because the posterior depends on how many true positives there are relative to all positives, including the false ones. With a rare condition, even a small false-positive rate produces far more false alarms than real cases, so the posterior stays low. With a common condition, the same test returns a much higher posterior because true positives dominate. This is the formal reason behind "extraordinary claims require extraordinary evidence": a low prior demands a very strong likelihood ratio to push the posterior above 0.5.