Logo

MonoCalc

/

Bayes Theorem Calculator

Math

Calculation Mode

Input / Output Format

Probability of the hypothesis before evidence
Probability of the evidence given A is true
Probability of the evidence given A is false

About This Tool

Bayes Theorem Calculator – Updating Probability with Evidence

Bayes' Theorem is the mathematical rule for updating a belief once new evidence arrives. It converts a prior probability — what you believed before seeing the evidence — into a posterior probability, the updated belief after accounting for how likely that evidence is under each possible explanation. The formula is P(A|B) = [P(B|A) × P(A)] / P(B), and it underlies everything from medical diagnostics and spam filters to legal reasoning and machine learning classifiers.

Two-Event Bayes: A and Not A

The simplest case updates a single hypothesis A against its complement ¬A. Given the prior P(A), the likelihood P(B|A) (how probable the evidence is if A is true), and the false-positive rate P(B|¬A) (how probable the evidence is if A is false), the calculator first finds P(B) via the Law of Total Probability: P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A). That normalizing constant is then divided into the numerator to yield P(A|B), the posterior.

Multiple Hypotheses (Law of Total Probability)

Many real problems involve more than two possibilities — three factories producing a part, four candidate diagnoses, or several competing models. For n mutually exclusive, exhaustive hypotheses H₁…Hₙ, the calculator generalizes the formula to P(Hᵢ|E) = [P(E|Hᵢ) × P(Hᵢ)] / Σⱼ P(E|Hⱼ) × P(Hⱼ). Because the hypotheses must cover every possibility exactly once, their priors are required to sum to 1 — the calculator validates this before computing results and flags the actual sum if it drifts.

The Base-Rate Fallacy

Bayes' Theorem is famous for correcting a common intuition error: assuming P(A|B) ≈ P(B|A). Consider a disease with 1% prevalence and a test that is 95% accurate in both directions. Naively, a positive result feels like 95% certainty of disease. In reality, because healthy people vastly outnumber sick people, the false positives from that much larger healthy pool swamp the true positives — the actual posterior probability of disease given a positive test is only around 16%. This gap between test accuracy and real-world certainty is the base-rate fallacy, and it is exactly what Bayes' Theorem is built to correct.

Prior probability matters as much as test accuracy
A highly accurate test on a rare condition still produces mostly false positives in absolute terms, because the prior (base rate) heavily weights the outcome. Always factor in prevalence, not just sensitivity and specificity.

Natural Frequencies Make It Intuitive

Probabilities expressed as fractions between 0 and 1 are easy to miscalculate mentally. The calculator also expresses results as a natural frequency breakdown— for example, "out of 1,000 people, 10 have the condition; of those, about 9.5 test positive; of the 990 without it, about 49.5 also test positive." Framing the same math as whole-number counts out of a population is a well-documented way to make conditional probability intuitive without requiring formal notation.

Prior, Likelihood, and Posterior

Three terms recur throughout Bayesian reasoning. The prior is your belief before evidence; the likelihood is how probable the evidence is under a given hypothesis; and the posterior is your updated belief after combining the two. Note that P(B|A) and P(B|¬A) come from separate conditional distributions and are not required to sum to 1 — each must simply fall between 0 and 1 independently.

Common Use Cases

Clinicians interpret diagnostic test results against disease prevalence; spam filters weigh word frequencies against prior spam rates; quality-control engineers trace defective units back to the most likely production line; and students verify textbook Bayes' Theorem problems step by step. In every case, the same core idea applies: combine what you believed before with how surprising the new evidence is, to get a properly calibrated updated belief.

Frequently Asked Questions

Is the Bayes Theorem Calculator free?

Yes, Bayes Theorem Calculator is totally free :)

Can I use the Bayes Theorem Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Bayes Theorem Calculator?

Yes, any data related to Bayes Theorem Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is Bayes' Theorem?

Bayes' Theorem is a formula for updating the probability of a hypothesis given new evidence. It states P(A|B) = [P(B|A) × P(A)] / P(B), where P(A) is the prior probability, P(B|A) is the likelihood of the evidence given the hypothesis, and P(A|B) is the updated posterior probability.

How does this Bayes Theorem Calculator work?

Choose Two-Event mode to update a single hypothesis and its complement using P(A), P(B|A), and P(B|¬A), or Multiple Hypotheses mode to compute the posterior for two or more mutually exclusive hypotheses using the Law of Total Probability. The calculator computes P(B) automatically and shows every step of the substitution.

Why is the posterior probability often much lower than the test accuracy?

This is the base-rate fallacy. Even a highly accurate test (e.g., 95% sensitivity) can produce mostly false positives when the underlying condition is rare, because the small pool of true positives gets diluted by false positives drawn from the much larger healthy population. Bayes' Theorem accounts for this by weighting the likelihood against the prior.

What is the difference between prior, likelihood, and posterior?

The prior P(A) is your belief about the hypothesis before seeing evidence. The likelihood P(B|A) is how probable the evidence is if the hypothesis is true. The posterior P(A|B) is your updated belief about the hypothesis after accounting for the evidence — the output of Bayes' Theorem.

Why must the priors in Multiple Hypotheses mode sum to 1?

The multi-hypothesis form of Bayes' Theorem assumes the hypotheses are mutually exclusive and exhaustive — exactly one of them is true. If the priors don't sum to 1, the Law of Total Probability denominator no longer represents the full probability space, so the calculator validates the sum before computing results.

Can P(B|A) and P(B|¬A) sum to more than 1?

Yes — this is a common point of confusion. P(B|A) and P(B|¬A) are conditional probabilities from two separate conditions (A true vs. A false), not parts of the same distribution, so they are not required to sum to 1. Each only needs to independently fall between 0 and 1.