Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Conditional Probability P(A|B)
0.4
40% chance
P(A and B) 0.2
P(B) 0.5
P(A|B) = P(A and B) / P(B) 0.4

What Is Conditional Probability?

Conditional probability measures the likelihood of an event A happening given that another event B has already occurred. It is written \(P(A|B)\), read as "the probability of A given B." This concept is fundamental to statistics, machine learning, risk analysis, and everyday decision-making where new information updates our expectations.

Two overlapping circles A and B inside a rectangle, with the intersection region highlighted
Conditional probability focuses on the overlap of A and B relative to the whole of B.

How to Use This Calculator

Enter two values between 0 and 1: the joint probability P(A and B) — the chance that both events occur together — and P(B) — the chance that event B occurs. The calculator divides the joint probability by \(P(B)\) and returns \(P(A|B)\) both as a decimal and a percentage.

The Formula Explained

The defining equation is:

$$P(A \mid B) = \frac{\text{P(A and B)}}{\text{P(B)}}$$

The numerator, P(A and B), is the probability that both A and B happen. Dividing by \(P(B)\) rescales this to the "world" in which B is known to have happened. Note that \(P(B)\) must be greater than zero, since conditioning on an impossible event is undefined.

Advertisement
Diagram showing the intersection area divided by the area of circle B
P(A|B) equals the intersection of A and B divided by the size of B.

Worked Example

Suppose the probability that it rains and you carry an umbrella is \(P(A \text{ and } B) = 0.2\), and the probability that you carry an umbrella is \(P(B) = 0.5\). Then the probability that it rains given that you carry an umbrella is $$P(A|B) = \frac{0.2}{0.5} = 0.4,$$ or 40%.

FAQ

What if P(B) is zero? Conditional probability is undefined when \(P(B) = 0\), because you cannot condition on an event that never happens. This calculator returns 0 in that case as a safeguard.

Can the result exceed 1? No. As long as \(P(A \text{ and } B) \le P(B)\), the result stays between 0 and 1. A result above 1 means your inputs are inconsistent.

How is this different from P(A and B)? P(A and B) is the joint chance both occur; \(P(A|B)\) assumes B already happened and asks only about A, so it is generally larger.

Last updated: