Conditional Probability Calculator

Calculate P(A|B) and P(B|A) from joint, marginal, or conditional inputs — with contingency tables, independence tests, and lift analysis.

About the Conditional Probability Calculator

The conditional probability calculator computes P(A|B), the probability that A occurs once B is already known to have occurred. It also reverses the relationship to show P(B|A), which is often the number people actually want once the conditioning is made explicit.

You can start from a joint probability, from one conditional probability plus the marginals, or from counts in a contingency table. The calculator then fills in the rest of the relationship, including union probability, independence checks, and a scaled count table for intuition.

That makes it useful whenever the question is not "how likely is A?" but "how likely is A after we already know something about B?".

Why Use This Conditional Probability Calculator?

Conditional probability is easy to misread because the wording changes the sample space. This calculator keeps the notation and the interpretation together, which is helpful when you are working from counts, a joint probability, or a known conditional value.

It is especially useful for screening tests, market segmentation, reliability analysis, and any other situation where one event is evaluated inside the subset defined by another event.

How to Use This Calculator

  1. Select an input mode based on what information you have available.
  2. Enter P(A) and P(B) — the marginal (unconditional) probabilities of each event.
  3. Enter the joint probability P(A∩B), or a conditional probability P(B|A) or P(A|B).
  4. Read P(A|B) and P(B|A) from the output — both conditional probabilities.
  5. Check whether events A and B are independent (P(A∩B) = P(A)×P(B)).
  6. Review the contingency table and all conditional probabilities for a complete picture.

Formula

P(A|B) = P(A ∩ B) / P(B). P(B|A) = P(A ∩ B) / P(A). Independence: P(A∩B) = P(A) × P(B). Lift = P(A|B) / P(A).

Example Calculation

Result: P(A|B) = 0.4167, P(B|A) = 0.8333

P(A|B) = 0.25/0.6 ≈ 0.417, meaning if B has occurred, A's probability rises from 30% to 41.7%. P(B|A) = 0.25/0.3 ≈ 0.833, meaning if A has occurred, B is very likely.

Tips & Best Practices

Conditioning Changes The Denominator

When you compute P(A|B), B becomes the reference set. The formula P(A|B) = P(A∩B) / P(B) is just a ratio of the overlapping part to the full B set.

Independence Is A Special Case

If A and B are independent, then P(A|B) = P(A). In that case, knowing B does not change the chance of A. The calculator highlights this because independence is often assumed when it should be tested.

Contingency Tables Make The Meaning Clear

Working in counts rather than decimals helps avoid confusion. A 1,000-person table makes it obvious how the same joint data can answer both "given B, how often A?" and "given A, how often B?"

Sources & Methodology

Last updated:

Frequently Asked Questions

What does "given" mean in probability?

P(A|B) means the probability of A within the subset where B is true. You're restricting your sample space to only outcomes where B has occurred, then asking how often A also occurs.

Why is P(A|B) different from P(B|A)?

They answer different questions. P(rain|cloudy) asks about rain when it's cloudy. P(cloudy|rain) asks about clouds when it's raining. These can be very different numbers.

How do I know if events are independent?

Check whether P(A∩B) = P(A) × P(B). Equivalently, check if P(A|B) = P(A). If either holds, the events are independent; knowing one gives no information about the other.

What is the prosecutor's fallacy?

Confusing P(evidence|innocent) with P(innocent|evidence). A DNA match probability of 1 in a million doesn't mean there's a 1 in a million chance the suspect is innocent.

Can conditional probability exceed 1?

No. P(A|B) is always between 0 and 1. If your calculation yields a value outside this range, check that P(A∩B) ≤ min(P(A), P(B)).

What is "lift" in this context?

Lift measures how much B changes A's probability: Lift = P(A|B)/P(A). A lift of 2 means A is twice as likely when B is present. It's widely used in marketing and recommendation systems.

Related Pages