Bayes Theorem Calculator

Calculate posterior probability P(A|B) using Bayes theorem from prior P(A), likelihood P(B|A), and marginal probability P(B).

Bayes Theorem Formula

P(A|B) = P(B|A) × P(A) ÷ P(B)
P(A|B) — posterior
P(B|A) — likelihood
P(A) — prior
P(B) — marginal

Enter Probabilities (0 to 1)

Probability that A is true before observing evidence B.

How likely is the evidence if hypothesis A is true?

Overall probability of observing B regardless of A. Use P(B) = P(B|A)×P(A) + P(B|A')×P(A') if unknown.

Quick Examples

Enter probabilities and click Calculate to see results.

Summary

Calculate posterior probability P(A|B) using Bayes theorem from prior P(A), likelihood P(B|A), and marginal probability P(B).

How it works

  1. Enter P(A), the prior probability of your hypothesis before seeing evidence.
  2. Enter P(B|A), the likelihood — how probable the evidence is if the hypothesis is true.
  3. Enter P(B), the total marginal probability of observing the evidence.
  4. Click "Calculate" and the tool applies the formula P(A|B) = P(B|A) × P(A) / P(B).
  5. Review the posterior probability, complement, joint probability, and the plain-English interpretation.
  6. Adjust inputs to explore how the posterior changes as you update your beliefs.

Use cases

  • Medical diagnosis: find P(disease | positive test) from test sensitivity and disease prevalence.
  • Spam filtering: compute P(spam | keyword) from training data likelihoods.
  • Quality control: estimate P(defective | failed inspection) from historical defect rates.
  • Finance: update P(market crash | indicator) as new economic signals arrive.
  • Legal reasoning: evaluate how new evidence shifts the probability of guilt.
  • Machine learning: understand naive Bayes classifiers and probabilistic model updates.
  • Drug testing: assess the true positive rate given test accuracy and prevalence.
  • A/B testing: convert observed conversion rates into posterior belief about variant performance.

Frequently Asked Questions

Last updated: 2026-06-13 · Reviewed by Nham Vu