Conditional probability calculator

P(A given B) and P(B given A) from P(A), P(B) and P(A and B), with an independence check.

%
%
%
Enter your values and press Calculate. Your inputs stay in the address, so you can switch language or share the link.

Formula

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

How it works

P(A|B) is the probability of A once we know B has happened: the chance of both happening, divided by the chance of B alone. Events are independent when knowing one happened does not change the probability of the other, which is when P(A ∩ B) equals P(A) × P(B).

Worked example

The same calculation with the default values:

  • P(A) 40 %
  • P(B) 50 %
  • P(A and B) 25 %
  1. P(A|B) = 0.25 ÷ 0.5 = 50%
  2. P(B|A) = 0.25 ÷ 0.4 = 62.5%

Result: P(A | B): 50% · P(B | A): 62.5% · Independence: A and B are dependent

P(A|B) answers "given that B has already happened, what's the probability of A" - this is generally not the same number as P(B|A) ("given A, what's the probability of B"), a mix-up common enough to have its own name (the base rate fallacy / confusion of the inverse).

Common mistakes

  • Confusing P(A|B) with P(B|A) - these answer different questions and are generally different numbers; mixing them up is one of the most common errors in probability (and in real-world reasoning about test results, for instance).
  • Using P(A) instead of P(A ∩ B) in the numerator - conditional probability specifically needs the probability of both events happening together, not just event A on its own.
  • Forgetting that P(B) in the denominator must be non-zero - conditioning on an event that cannot happen is undefined, not just a very small probability.

Related calculators