Conditional Probability Calculator
Work out P(A|B), the probability of A given that B has already happened, either from P(A∩B) and P(B) directly, or from a two-way table of counts (the way most textbooks and exams actually present the problem).
Choose an input method
What P(A|B) is actually asking
P(A|B) reads as "the probability of A, given B." It's not asking about A and B in general. It's asking a narrower question: once you already know B happened, what's left of A's chances? This matters because conditioning on B shrinks the world you're looking at down to only the cases where B is true, and then asks what fraction of that smaller world also has A.
A concrete way to see it: if 40% of people own a dog, and 45% of dog owners also own a cat, then P(cat | dog) = 0.45. You're not asking what fraction of everyone owns both. You're asking, within the dog-owning group specifically, what fraction also has a cat.
The formula, and where it comes from
This formula is just a rearrangement of the general multiplication rule, P(A∩B) = P(B) × P(A|B). Divide both sides by P(B) and you get the conditional probability formula directly. They're the same relationship viewed from two different starting points, depending on which two of the three quantities you already know.
Reading a two-way table for conditional probability
Most textbook conditional probability problems don't hand you P(A∩B) and P(B) as decimals. They give you a table of counts, and expect you to pull the right numbers out yourself. Here's the table from the calculator's default example:
| Owns a cat (A) | No cat (not A) | Row total | |
|---|---|---|---|
| Owns a dog (B) | 18 | 12 | 30 |
| No dog (not B) | 22 | 48 | 70 |
| Column total | 40 | 60 | 100 |
To find P(A|B), the "given B" condition tells you to restrict your attention to the dog row only, 30 people total. Of those 30, 18 also own a cat. So P(A|B) = 18/30 = 0.6. Notice you never needed the other 70 people at all once you conditioned on B. That's the whole idea of conditioning: it narrows the denominator to just the group described by B.
Mistakes people make with conditional probability
Dividing by the wrong total. The single most common table-reading mistake is dividing the A-and-B cell by the grand total (100) instead of the row or column total that matches the condition. That gives you P(A∩B), not P(A|B), and the two numbers can look similar enough to pass an unchecked answer.
Mixing up P(A|B) and P(B|A). These use the same two numbers but different denominators. P(A|B) divides by the B total. P(B|A) divides by the A total. In the table above, P(B|A) would be 18/40 = 0.45, a different number from P(A|B) = 0.6, even though both involve the exact same 18 people.
Assuming conditioning always changes the answer. If A and B are independent, P(A|B) equals plain P(A), and conditioning changes nothing. Getting the same number before and after conditioning is a legitimate result, not a sign of a mistake, when the two events genuinely don't affect each other.
Where this shows up outside a stats classroom
Medical screening uses this constantly: P(disease | positive test) is a conditional probability, and it's the exact calculation behind the well-known result that a positive result on a rare-disease test is far less alarming than it first sounds (worked through in full on the Bayes' Theorem Calculator). Insurance underwriting uses it to price risk based on known factors. Recommendation engines use it to estimate the chance you'll like a product, given what else you've already bought.
Questions people actually ask about this
What happens if P(B) is 0?
P(A|B) is undefined. You can't condition on an event that never happens, since there's no group of "B happened" cases to look inside.
Can P(A|B) be larger than P(A)?
Yes, and this is completely normal. If knowing B happened makes A more likely, P(A|B) will be greater than P(A). If it makes A less likely, P(A|B) will be smaller. Only when A and B are independent does P(A|B) equal P(A) exactly.
Is P(A|B) the same as P(A∩B)?
No, and this is the most common point of confusion. P(A∩B) is the chance both happen out of everyone. P(A|B) is the chance A happens out of just the people where B already happened. P(A|B) is generally a bigger number than P(A∩B), since it's dividing by a smaller group.
How do I find P(A|B) if I only have a table of counts, not probabilities?
Divide the count of "A and B" by the count of "B" (the row or column total for B), rather than converting everything to probabilities first. The division gives you the same answer either way, but working directly from counts avoids extra rounding steps.
What's the relationship between P(A|B) and P(B|A)?
They're connected by Bayes' Theorem: P(A|B) = P(A) × P(B|A) / P(B). They're generally different numbers unless P(A) happens to equal P(B).