Bayes' Theorem Calculator
Calculate conditional probability using Bayes' theorem. Determine the posterior probability of a hypothesis given prior knowledge and new evidence from tests or observations.
This free online bayes' theorem calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.
Range: 0 – 1
The initial probability of the hypothesis before observing evidence.
Probability of observing the evidence given the hypothesis is true.
Probability of observing the evidence given the hypothesis is false.
Results
P(A|B) — Posterior Probability
0.161017
P(B) — Total Probability of Evidence
0.059
How to Use This Calculator
Enter your input values
Fill in all required input fields for the Bayes' Theorem Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.
Review your inputs
Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.
Read the results
The Bayes' Theorem Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.
Explore parameter sensitivity
Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.
When to Use This Calculator
- •Use the Bayes' Theorem Calculator when you need accurate results quickly without the risk of manual computation errors or unit conversion mistakes.
- •Use it to verify calculations made by hand or in spreadsheets — an independent check can catch errors before they lead to costly decisions.
- •Use it to explore how changing input parameters affects the output — a quick way to develop intuition and identify the most influential variables.
- •Use it when collaborating with others to ensure everyone is working from the same numbers and applying the same assumptions.
Related Calculators
Conditional Probability Calculator
Calculate the conditional probability P(A|B) using Bayes' theorem and the definition of conditional probability. Essential for medical testing, risk assessment, and Bayesian inference in statistics.
Lottery Probability Calculator
Calculate the probability of winning a lottery by choosing the correct numbers from a pool. Uses combinatorial mathematics to determine exact odds for pick-N-from-M style lotteries like Powerball and Mega Millions.
Monty Hall Problem Calculator
Calculate the probabilities of winning by switching or staying in the classic Monty Hall game show problem. Demonstrates how revealed information changes conditional probabilities, a famous counterintuitive result in probability theory.
P-Value Calculator
Calculate the p-value from a test statistic (Z-score or t-statistic) for one-tailed and two-tailed hypothesis tests. Essential for determining statistical significance in research, A/B testing, and scientific analysis.
Power Analysis Calculator
Calculate the statistical power of a hypothesis test or determine the required sample size to achieve a desired power level. Essential for study design, grant proposals, and ensuring experiments can detect meaningful effects.
Birthday Paradox Calculator
Calculate the probability that at least two people in a group share the same birthday. Demonstrates the surprisingly high likelihood of shared birthdays in small groups, a classic result in probability theory.
About Bayes' Theorem Calculator
The Bayes' theorem calculator computes the posterior probability of a hypothesis after observing new evidence. Named after Reverend Thomas Bayes, this theorem is the cornerstone of Bayesian statistics and has wide-ranging applications in medical diagnostics, spam filtering, machine learning, forensic science, and decision analysis. The key insight is that the probability of a hypothesis is not fixed but should be updated as new data becomes available. For example, the probability that a patient has a disease changes after a positive test result, and Bayes' theorem quantifies exactly how much it changes by combining the prior probability with the test's sensitivity and false positive rate.
The Math Behind It
Formula Reference
Bayes' Theorem
P(A|B) = P(B|A) * P(A) / P(B)
Variables: P(A|B) = posterior probability; P(B|A) = likelihood; P(A) = prior; P(B) = total probability of evidence
Worked Examples
Example 1: Medical diagnostic test
A disease affects 1% of the population. A test has 95% sensitivity and 5% false positive rate. What is the probability of having the disease given a positive test?
Despite a positive test, the probability of actually having the disease is only about 16.1%, because the disease is rare.
Example 2: Email spam filter
5% of emails are spam. The word 'free' appears in 80% of spam and 10% of legitimate emails. What is the probability an email containing 'free' is spam?
An email containing 'free' has about a 29.6% chance of being spam.
Common Mistakes & Tips
- !Ignoring the base rate (prior probability), which leads to grossly overestimating the posterior after a positive test.
- !Confusing P(A|B) with P(B|A). The probability of a positive test given disease is not the same as the probability of disease given a positive test.
- !Forgetting that P(B|not A) contributes significantly to P(B) when P(not A) is large.
Related Concepts
Used in These Calculators
Calculators that build on or apply the concepts from this page:
Frequently Asked Questions
Why does a positive test not guarantee the disease?
Because when a disease is rare, the false positives from the large healthy population can outnumber the true positives from the small diseased population. Bayes' theorem accounts for this base-rate effect.
What is a conjugate prior?
A conjugate prior is a prior distribution that, when combined with a particular likelihood function via Bayes' theorem, produces a posterior distribution in the same family. This simplifies the math considerably.
Can Bayes' theorem handle multiple hypotheses?
Yes. The generalized form divides P(B|Hi)*P(Hi) by the sum of P(B|Hj)*P(Hj) over all hypotheses j. Each hypothesis receives its own posterior probability.
Embed this calculator on your site
Paste this snippet into your blog, course page, or documentation to drop a live, interactive Bayes' Theorem Calculator into your page.
Free to embed — includes a link back to MegaCalc.