Skip to content
MoneyDeck

Conditional Probability Calculator

Find P(A|B), P(B|A), the union and an independence check in one go

Updated · Free, no signup

Probability that both A and B happen (the intersection).

P(A | B)

0.375

P(B | A)

0.3

P(A and B)

0.15

P(A or B)

0.75

P(neither A nor B)

0.25

P(A only)

0.35

P(B only)

0.25

Independent?

No — P(A) × P(B) = 0.2 ≠ 0.15
  • Knowing B happened changes the probability of A from 0.5 to 0.375 — B makes A less likely.

How the sample space splits

About the Conditional Probability Calculator

This conditional probability calculator answers the question “how likely is A, given that B has happened?” Enter the probability of A, the probability of B and the probability that both happen, or simply type counts from a table or survey, and it returns P(A|B), P(B|A), the joint probability P(A and B), the union P(A or B), the probability of neither event and the probability of exactly one event.

It suits students checking homework on two-way tables and Venn diagrams, teachers preparing worked examples, and analysts turning cross-tab counts into rates such as “what share of customers who opened the email went on to buy?”. The count mode is handy for card, dice and survey problems because you never have to convert to decimals first.

The calculator also tests whether A and B are independent by comparing P(A and B) with P(A) × P(B), and it warns you when the numbers you entered are impossible — for example a joint probability larger than either event on its own.

With the default inputs, the p(a | b) is 0.375. Change any value above to recalculate instantly.

How to use the conditional probability calculator

  1. 1Choose whether you have probabilities or raw counts.
  2. 2Enter P(A), P(B) and P(A and B) — or the total and the counts for A, B and both.
  3. 3Read P(A | B) and P(B | A) at the top of the results.
  4. 4Check the union, “neither” and independence results for the rest of the Venn diagram.

Formula and method

P(A|B) = P(A ∩ B) ÷ P(B) P(B|A) = P(A ∩ B) ÷ P(A) P(A ∪ B) = P(A) + P(B) − P(A ∩ B)

Conditional probability restricts the sample space to the outcomes where B happened and asks what fraction of those also include A. That is the overlap P(A ∩ B) divided by P(B). Swapping the roles gives P(B|A). With counts, the totals cancel, so P(A|B) is simply n(A and B) ÷ n(B).

The union uses the addition rule, subtracting the overlap so it is not counted twice, and P(neither) = 1 − P(A ∪ B). Two events are independent when P(A ∩ B) = P(A) × P(B), which is equivalent to P(A|B) = P(A). A valid set of inputs needs max(0, P(A) + P(B) − 1) ≤ P(A ∩ B) ≤ min(P(A), P(B)).

P(A ∩ B)
Joint probability that A and B both occur
P(A|B)
Probability of A given that B occurred
P(A ∪ B)
Probability that at least one of A or B occurs
n(·)
Count of outcomes in a table or survey

Worked examples

P(A) = 0.5, P(B) = 0.4, P(A and B) = 0.15

P(A|B) = 0.15 ÷ 0.4 = 0.375 and P(B|A) = 0.15 ÷ 0.5 = 0.3. The union is 0.5 + 0.4 − 0.15 = 0.75, leaving 0.25 for neither. Because 0.5 × 0.4 = 0.2 ≠ 0.15, the events are not independent.

Survey: 200 people, 80 own a dog, 60 a cat, 25 both

Among the 60 cat owners, 25 also own a dog, so P(dog | cat) = 25 ÷ 60 ≈ 0.4167. Among the 80 dog owners, P(cat | dog) = 25 ÷ 80 = 0.3125. 115 people own at least one, so P(neither) = 85 ÷ 200 = 0.425.

Cards: P(king | face card)

All 4 kings are among the 12 face cards, so P(king | face card) = 4 ÷ 12 = 1/3, while P(face card | king) = 4 ÷ 4 = 1. The union is just the 12 face cards, 12 ÷ 52 ≈ 0.2308.

Independent events

Since 0.5 × 0.6 = 0.3 equals the joint probability, learning that B happened leaves P(A) unchanged at 0.5 — the events are independent.

Frequently asked questions

How do you calculate conditional probability?+

Divide the probability that both events happen by the probability of the event you are conditioning on: P(A|B) = P(A and B) ÷ P(B). With counts, divide the number of outcomes with both A and B by the number with B.

Is P(A|B) the same as P(B|A)?+

No. They share the same numerator, P(A and B), but divide by different events. In the card example P(king | face card) is 1/3 while P(face card | king) is 1. Bayes’ theorem converts one into the other.

How can I tell if two events are independent?+

Events are independent when P(A and B) = P(A) × P(B), or equivalently when P(A|B) = P(A). Knowing that one happened then gives no information about the other.

What is the difference between independent and mutually exclusive?+

Mutually exclusive events cannot happen together, so P(A and B) = 0. If both have positive probability they are actually dependent, because knowing one happened tells you the other did not.

What if I only know P(A), P(B) and P(A or B)?+

Rearrange the addition rule: P(A and B) = P(A) + P(B) − P(A or B). Enter that value as the joint probability and the calculator will give the conditional probabilities.

Related tools