Conditional Probability Calculator

Calculate P(A|B) from joint and marginal probabilities, or apply Bayes' theorem to find P(A|B) from P(B|A), P(A), and P(B). Includes a visual probability tree.

Formula

P(A|B) = P(A∩B) / P(B)

Probability Tree Diagram

Enter values and calculate to see the tree

Summary

Calculate P(A|B) from joint and marginal probabilities, or apply Bayes' theorem to find P(A|B) from P(B|A), P(A), and P(B). Includes a visual probability tree.

How it works

  1. Pick a mode: direct definition or Bayes' theorem.
  2. In direct mode, enter the joint probability P(A∩B) and the marginal probability P(B); the tool divides them to give P(A|B).
  3. In Bayes mode, enter the likelihood P(B|A), the prior P(A), and the marginal P(B); the tool returns P(A|B) = P(B|A)·P(A) / P(B).
  4. All inputs must be between 0 and 1; invalid or inconsistent values (e.g. P(A∩B) > P(B)) trigger inline error messages.
  5. The color-coded probability tree updates live so you can see how the joint, marginal, and conditional values relate.

Use cases

  • Medical testing: find the probability that a patient has a disease given a positive test result.
  • Spam filtering: compute the probability that an email is spam given certain keywords.
  • Quality control: determine the probability a product is defective given it failed an inspection.
  • Finance: estimate the probability of a market downturn given a specific economic indicator.
  • Legal reasoning: evaluate the probability of guilt given available evidence (Bayesian reasoning).

Frequently Asked Questions

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