Bayes Theorem Calculator
Combine a prior probability with a test sensitivity and false-positive rate to compute the posterior probability via Bayes theorem.
Updated probability of A given a positive result B
- 1
True positive weight
0.9 × 0.01 = 0.009P(B|A) × P(A) — probability of a positive result from a true case. - 2
False positive weight
0.05 × (1 − 0.01) = 0.0495 - 3
Marginal P(B)
0.009 + 0.0495 = 0.0585Total probability of a positive result from either source. - 4
Posterior P(A|B)
0.009 ÷ 0.0585 = 0.1538
How does this calculator work?
Bayes theorem converts a prior P(A) into a posterior P(A|B) using a test sensitivity P(B|A) and false-positive rate P(B|¬A). The posterior equals the true-positive weight divided by the marginal P(B). With rare events, false positives can dominate, keeping the posterior low despite an accurate test.
Formula
How this is calculated
Bayes theorem updates a prior belief P(A) into a posterior P(A|B) after observing evidence B. The prior P(A) is the base rate of the event before any test (for example, the prevalence of a disease). The sensitivity P(B|A) is the probability of a positive result B when A is true (the true-positive rate). The false-positive rate P(B|¬A) is the probability of a positive result when A is false. All three must lie in the interval [0, 1].
The numerator P(B|A)·P(A) is the joint probability of a true positive. The denominator adds the false-positive contribution P(B|¬A)·(1 − P(A)) to form the marginal probability P(B) — the total chance of observing a positive result from either source. Dividing the true-positive weight by this marginal gives the posterior P(A|B).
A key insight is that when the prior is very small, even a highly sensitive test can yield a surprisingly low posterior because false positives dominate the denominator. The calculator returns null when inputs fall outside [0, 1] or when the marginal P(B) is zero, since the posterior would then be undefined.
Frequently asked questions
When the prior (base rate) is tiny, the population of true cases is small, so false positives from the much larger negative population outnumber true positives, pulling the posterior down.
It is the total probability of a positive result, the denominator of Bayes rule: true positives plus false positives, P(B|A)·P(A) + P(B|¬A)·(1 − P(A)).
No. Each of the three inputs is an independent probability in [0, 1]; they are not required to sum to 1.
Also known as
TG we-Calculate Editorial Team. (2026). Bayes Theorem Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/bayes-theorem-calculator
TG we-Calculate Editorial Team. "Bayes Theorem Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/bayes-theorem-calculator.
TG we-Calculate Editorial Team, "Bayes Theorem Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/bayes-theorem-calculator
@misc{wecalculate_bayes_theorem_calculator, title = {Bayes Theorem Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/bayes-theorem-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
