StatGardenREF. DESK
Calculators/Statistics/Conditional probability
Statistics

Conditional probability calculator

P(A given B), worked from either the joint probability of both events or a joint frequency table.

Published 21 August 2026

What this calculator does

Conditional probability is the probability of event A happening, given that event B is already known to have happened. It answers a narrower question than a plain joint probability: not "what is the chance of both A and B", but "once we already know B occurred, what is the chance A also did". The formula is P(A given B) = P(A and B) ÷ P(B), which restricts the sample space down to only the outcomes where B is true before asking about A.

This is a genuinely different calculation from combining two probabilities with a simple AND, which assumes the events are independent of each other. Conditional probability makes no such assumption: it works directly from how often A and B occur together relative to how often B occurs at all, which is exactly what makes it useful when two events are related rather than independent.

The formula

FormulaP(A|B) = P(A∩B) / P(B)

Divide the probability (or count) of A and B occurring together by the probability (or count) of B occurring at all. This calculator accepts either two percentages, P(A and B) and P(B), or two raw counts from a table of outcomes, whichever numbers you actually have to hand.

TermMeaning
P(A|B)The probability of A given B: P(A and B) ÷ P(B).
P(A and B)The joint probability, or joint count, of both A and B occurring together.
P(B)The probability, or total count, of B occurring at all, regardless of whether A also occurred.

The inputs explained

FieldWhat to enter
Enter values asChoose whether you are entering percentages directly, or raw counts from a table of outcomes.
P(A and B) (%)The probability that both A and B occur together, as a percentage.
P(B) (%)The probability that B occurs at all, as a percentage.
Count of A and B togetherThe number of outcomes where both A and B occurred together, from a table or dataset.
Total count of BThe total number of outcomes where B occurred, regardless of A.

When to use it

Reading a two-way table of survey or trial results

When results are recorded as counts in a table, such as how many people both smoke and have a particular condition against the total who have that condition, the counts mode gives the conditional probability directly without converting to percentages first.

Checking whether two events look independent

If P(A given B) works out close to the plain P(A), the two events behave as though roughly independent for this data; a P(A given B) noticeably different from P(A) is a sign that B genuinely changes the chance of A.

Working through a probability or statistics problem

Given a joint probability and a marginal probability from a textbook-style question, this calculator does the division and shows the formula used, which is useful for checking a hand calculation.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How P(A given B) changes as the joint probability rises, at a fixed P(B)

A fixed P(B) of 40%, across a range of joint probabilities P(A and B).

P(B) = 40%
P(A and B)P(A given B)
4%10.0%
8%20.0%
12%30.0%
16%40.0%
20%50.0%
40%100.0%
With P(B) held at 40%, P(A given B) scales directly with the joint probability, reaching 100% when P(A and B) equals P(B) itself, since that means A always occurs whenever B does.

How P(A given B) changes as P(B) narrows, at a fixed joint probability

A fixed joint probability of 15%, across a range of values for P(B).

P(A and B) = 15%
P(B)P(A given B)
15%100.0%
20%75.0%
25%60.0%
30%50.0%
50%30.0%
75%20.0%
The same 15% joint probability produces a higher conditional probability as P(B) shrinks towards it, because a smaller, more tightly defined B makes up a larger share of the outcomes where A also occurred.

Questions

How is conditional probability different from P(A and B)?

P(A and B) is the chance both events happen out of all possible outcomes. P(A given B) narrows the question to only the outcomes where B already happened, then asks what share of those also have A. The two are only equal when P(B) is 100%.

Why can P(A and B) not be greater than P(B)?

The outcomes where both A and B occur are always a subset of the outcomes where B occurs at all, so the joint probability can never exceed the probability of B alone. If your numbers show otherwise, one of the two figures has been entered wrong.

What does it mean if P(A given B) equals P(A)?

It means B has no effect on the probability of A, which is the definition of the two events being independent. If P(A given B) differs from plain P(A), the two events are dependent, and knowing B changes what you should expect for A.

Can I use this with raw counts instead of percentages?

Yes. Switch the input mode to counts and enter the number of outcomes where both A and B occurred, and the total number of outcomes where B occurred, straight from a table of results; the calculator divides one by the other the same way.

For simpler AND/OR combinations of two probabilities without conditioning, see the probability calculator. For converting between odds and probability more generally, see the odds calculator.