The Bayes' theorem calculator computes the posterior probability P(A|B) from your prior P(A), likelihood P(B|A), and marginal evidence P(B). It also provides a natural frequency interpretation — how many out of 1000 people would actually have the condition given a positive test.
Bayes' Theorem Calculator
Base rate of condition
True positive rate (sensitivity)
Total probability of evidence (P(B|A)P(A) + P(B|¬A)P(¬A))
1 − specificity
Natural Frequency (out of 1000)
Bayes' Theorem Steps
How to Use the Bayes' Theorem Calculator
Bayes' theorem answers the question: "Given that I observed evidence B, how likely is it that hypothesis A is true?" It's the mathematical foundation for updating beliefs in light of new evidence.
The Formula
P(A|B) = P(B|A) × P(A) / P(B). The three inputs are: Prior P(A) — your initial belief before seeing evidence; Likelihood P(B|A) — how probable the evidence is if A is true; Marginal P(B) — the total probability of observing B regardless of A.
Medical Testing Example
A disease has 1% prevalence (prior = 0.01). A test has 99% sensitivity P(+|sick) = 0.99 and 5% false positive rate P(+|healthy) = 0.05. The marginal P(+) = 0.99 × 0.01 + 0.05 × 0.99 = 0.059. Posterior P(sick|+) = (0.99 × 0.01) / 0.059 = 16.7%. Despite the "99% accurate" test, most positives are false positives when the disease is rare.
Using Complement Mode
Switch to "sensitivity and false positive rate" mode if you know the test characteristics directly. Enter sensitivity (true positive rate) and specificity complement (false positive rate = 1 − specificity). The calculator computes P(B) automatically from P(B|A)×P(A) + P(B|¬A)×P(¬A).
Frequently Asked Questions
What is Bayes' theorem?
Bayes' theorem gives the conditional probability of A given B: P(A|B) = P(B|A) × P(A) / P(B). It updates the prior probability P(A) with evidence B to give the posterior probability P(A|B). It's fundamental to medical testing, machine learning, and scientific inference.
What do prior, likelihood, and posterior mean?
Prior P(A) is your belief before seeing evidence. Likelihood P(B|A) is how probable the evidence is if A is true. Posterior P(A|B) is your updated belief after seeing the evidence. Marginal P(B) normalizes the result so all probabilities sum to 1.
How does this apply to medical tests?
If a disease has 1% prevalence (prior), a test has 99% sensitivity P(+|sick) and 95% specificity, then P(B) = 0.01×0.99 + 0.99×0.05 = 0.0594. A positive test gives P(sick|+) = (0.99×0.01)/0.0594 = 16.7%. Most positives are false positives because the disease is rare.
Is this calculator free?
Yes, completely free with no signup required. All calculations run in your browser.
What is the natural frequency interpretation?
Instead of probabilities, imagine 1000 people. If P(A)=0.01, 10 have the condition. Of those 10, P(B|A)=0.99 means 9.9 test positive. Of 990 without the condition, P(B|not-A)=0.05 means 49.5 test positive. So 9.9 out of 59.4 positives = 16.7% actually have the condition.