Math calculator

Conditional Probability Calculator

Both directions at once, because the mistake is using one for the other.

Both directions, side by side

The prosecutor’s fallacy shape: 90% of the guilty leave the trace, but only 0.9% of those leaving it are guilty.

P(A) = 0.0100%, P(B) = 1.0000%, P(A and B) = 0.0090%

P(A|B) = 0.9000%

P(B|A) = 90.0000% — a different question with a different answer, 100.0000x apart.

P(A | B)

0.9000%

given B happened

P(B | A)

90.0000%

the reverse question

P(A | not B)

0.0010%

not 1 minus P(A|B)

P(not A | B)

99.1000%

this is the complement

P(A)·P(B)

0.0001%

the joint if independent

Relationship

Positive

conditioning changes the answer

Ratio of directions

0.0100×

P(A|B) ÷ P(B|A)

Lift

90.0000×

joint vs independence

P(A|B) = 0.9000% and P(B|A) = 90.0000%. They differ because the marginals differ: P(A|B) = P(B|A)·P(A)/P(B), so the ratio between the two directions is exactly P(A)/P(B) — 0.000100 over 0.010000. The rarer A is relative to B, the further apart they are.

Where the conditioning is unavoidable: drawing without replacement

All favourable, exact

0.4525%

each draw conditions the next

Multiplying marginals

0.5917%

the common shortcut

Overstatement

30.769%

cost of ignoring the link

Multiplying the unconditional probability by itself assumes the first draw told you nothing about the second. It did: taking a favourable item out makes the next one rarer, so the shortcut always overstates the chance of an all-favourable run.

The complement trap. P(A | not B) is not 1 − P(A|B). The complement of P(A|B) is P(not A | B) — same condition, opposite event. P(A | not B) changes the condition instead, and on the first preset the two differ by five orders of magnitude. Both are printed above so the difference is visible rather than assumed away.

What this tool shows

P(A|B) and P(B|A) are different numbers, and on the first example here one is 100 times the other. The tool prints both, plus P(A | not B) — which is not 1 − P(A|B), whatever the complement rule looks like it says. Enter probabilities or a 2×2 count table.

  • P(A|B) and P(B|A) side by side, with the ratio between them
  • P(A | not B), the quantity the complement rule does not give you
  • Whether the events are independent, dependent or mutually exclusive
  • A feasibility check — most triples of probabilities describe no world at all
  • Input as probabilities, or as counts in a 2×2 table
  • Drawing without replacement, where each draw conditions the next
Both directions Feasibility checked 2×2 table mode Bayes identity

P(A|B) is not P(B|A). Both are shown.

Updated 12 September 2026 · Works in any browser, no installation

P(A|B) = P(A and B) / P(B): restrict attention to the outcomes where B happened, and ask what fraction of those also had A. Reversing it gives P(B|A), a different fraction of a different denominator — and the two are linked by Bayes’ theorem, which says the ratio between them is exactly P(A)/P(B).

At a glance

Formula shown
P(A|B) = P(A and B) / P(B), defined whenever P(B) > 0. The reverse is P(B|A) = P(A and B) / P(A), and dividing one by the other gives P(A)/P(B) — so the two directions agree only when the marginals do. P(A | not B) = (P(A) − P(A and B)) / (1 − P(B)), which is a different quantity from 1 − P(A|B) = P(not A | B). Events are independent when P(A and B) = P(A)·P(B) and mutually exclusive when P(A and B) = 0; with non-zero probabilities they cannot be both.
Scenario support
Reading a diagnostic test result, interpreting forensic evidence, click-through and conversion rates conditioned on a segment, quality control where a defect rate is quoted for a subgroup, card and dice problems, and any sentence of the form “X% of Ys are Z” that is about to be reversed.
Educational estimate
Planning support from the values you enter — not professional advice.

The two directions are different questions

“Ninety per cent of people with the condition test positive” and “ninety per cent of people who test positive have the condition” are different sentences with different answers, and they get used as if they were one sentence.

On the first example here, P(B|A) is 90% and P(A|B) is 0.9%. A factor of a hundred, from three numbers that look unremarkable: the trait occurs in 1 in 10,000 people, the trace occurs in 1 in 100, and nearly everyone with the trait leaves the trace.

The ratio between the directions is exactly P(A)/P(B). That is Bayes’ theorem rearranged, and it means the gap is entirely a matter of how rare one event is relative to the other. When both are equally common the two directions coincide, which is why the confusion is invisible in textbook coin-and-dice examples and catastrophic everywhere else.

In law this has a name. The prosecutor’s fallacy is the substitution of P(evidence | innocent) for P(innocent | evidence). In medicine and psychology the same substitution is called the base-rate fallacy. Two fields named it independently, which is a fair measure of how often it happens.

So the tool refuses to print one without the other. Whichever you came for, the other is beside it with the ratio between them, because the number you want is not always the number you asked for.

The complement rule gives you the wrong quantity

You know P(A|B). You want P(A | not B). Subtracting from one feels right and is wrong.

1 − P(A|B) is P(not A | B). The complement flips the EVENT, not the CONDITION. It answers “given B, how often does A fail to happen”, which is a question about the same restricted population.

P(A | not B) changes the population instead. It is (P(A) − P(A and B)) / (1 − P(B)) — a different denominator, a different numerator, a different answer. On the first example 1 − P(A|B) is 99.1% and P(A | not B) is 0.00101%. Five orders of magnitude between two quantities that get written down interchangeably.

Both are printed above, labelled. The conditional probabilities that share a condition sum to one; the ones that share an event do not, and no amount of arithmetic makes them.

The one thing they do satisfy is the law of total probability: P(A) = P(A|B)·P(B) + P(A | not B)·(1 − P(B)). The suite checks that reconstruction holds on thousands of random feasible inputs, which is a stronger statement than checking the worked example.

Most triples of probabilities describe no world at all

You can type P(A) = 0.3, P(B) = 0.4 and P(A and B) = 0.35 into most calculators and get an answer. There is no such situation.

The joint probability can never exceed either marginal. Every outcome where both happened is an outcome where A happened, so P(A and B) ≤ P(A), and the same for B. A joint of 0.35 with a marginal of 0.3 is not a rounding problem, it is a contradiction.

And it cannot fall below P(A) + P(B) − 1. If A happens 80% of the time and B happens 90%, they are forced to overlap at least 70% of the time — there is not enough room in the probability space for them to avoid each other. These two bounds are the Fréchet inequalities, and between them lies every joint distribution consistent with your marginals.

The tool checks both and refuses rather than computing. A conditional probability derived from an impossible joint is a number with no referent, and printing it is worse than printing nothing.

Counting avoids the problem entirely. A 2×2 table of observed frequencies cannot be infeasible, because it came from a world that happened. That is the second input mode, and it is the one to use whenever you have the raw numbers.

Independent and mutually exclusive are opposites

They are used as synonyms in conversation and they are close to contradictory in fact.

Independent means conditioning changes nothing: P(A|B) = P(A), equivalently P(A and B) = P(A)·P(B). Learning B happened leaves your belief about A exactly where it was.

Mutually exclusive means conditioning changes everything: P(A and B) = 0, so P(A|B) = 0. Learning B happened tells you A certainly did not. That is the strongest possible dependence, not the absence of one.

Two events with non-zero probability cannot be both. Independence needs P(A)·P(B) > 0 to equal the joint; exclusivity needs the joint to be 0. Try the “Mutually exclusive” preset and the “Independent events” preset and watch P(A|B) go from 0 to exactly P(A).

The tool labels the relationship rather than leaving it to be inferred — independent, positively dependent, negatively dependent or exclusive — and reports the lift, the factor by which the joint exceeds what independence would give.

Where you cannot avoid conditioning: drawing without replacement

Two aces from a shuffled deck. The chance the first card is an ace is 4/52. The chance the second is an ace GIVEN the first was is 3/51, because the deck changed.

The exact answer is 0.452%; multiplying 4/52 by itself gives 0.592%. A 30.8% overstatement, from one step of arithmetic that quietly assumed the first draw told you nothing.

The shortcut always overstates an all-favourable run. Every success removes a favourable item from a shrinking population, so each conditional probability is smaller than the one before it. Verified across two thousand random population sizes, favourable counts and draw counts: not one configuration where the naive product came in below the exact answer.

The gap closes as the population grows. At a population of ten it is total; at a million it is under a thousandth of a per cent. That is the entire justification for treating large populations as if sampling were independent, and the panel above lets you find where your own case sits on that curve rather than taking the rule of thumb on trust.

This is the chain rule, written out. P(all favourable) = P(first) · P(second | first) · P(third | first two)… Each term is a conditional probability, and the reason the calculation feels different from the 2×2 table above is only that the conditioning is sequential rather than simultaneous.

Reporting a conditional probability so it cannot be reversed

Most of the damage is done in the sentence, not the arithmetic.

Name the denominator. “A 0.9% chance” is not a report. “Among the 1% of people who leave this trace, 0.9% have the trait” is, because the population being divided into is stated.

Give the base rate. A conditional probability without P(A) cannot be checked, and it is the base rate that does most of the work in surprising results. If P(A) is missing, the reader cannot tell whether conditioning helped at all.

Quote the counts where you have them. “18 of 140” is harder to reverse than “12.9%”, and it carries the sample size with it. The confidence interval around a conditional probability from a small subgroup is usually much wider than the figure suggests.

Watch for conditioning on a selected sample. Conditional probabilities computed inside a group that was chosen for a reason inherit that reason, and Simpson’s paradox is what happens when the selection was on a variable nobody wrote down.

And say which direction you computed. Both are above; only one answers the question that was asked, and the label is the cheapest safeguard there is.

Sources and methodology

References for conditional probability and the errors around it.

Method. Conditional probabilities are computed directly from the joint and the marginals rather than through Bayes’ theorem, so the identity P(A|B) = P(B|A)·P(A)/P(B) is an independent check rather than a restatement — the suite confirms it, and the law of total probability, across thousands of randomly generated feasible triples. Feasibility is tested against the Fréchet bounds before anything is divided, and the boundary cases are checked as valid rather than rejected. Sampling without replacement uses the exact falling product rather than a hypergeometric approximation, and the suite verifies against two thousand random configurations that it never exceeds the naive independent product. That engine is verified on every change against 169 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Bayes' TheoremPosterior probability from a prior, sensitivity and specificity — plus the true and false positives per 100,000, because a 99% accurate test for a 1-in-10,000 condition is right 0.98% of the time and the percentage alone does not make that believable.
ProbabilityTwo events, repeated trials and Bayes, with the three usual errors handled — the dropped overlap in P(A or B), n×p instead of the complement, and the base rate that makes a 99% test 17% right.
Expected ValueReports the spread, the chance of any gain and the single most likely outcome beside the average — because on a roulette number bet the expected value is −2.70% and the modal result is losing, 36 times in 37.
Birthday ParadoxAnswers both questions the paradox conflates — 50.73% that some pair shares a birthday in a room of 23, and 5.86% that anyone shares yours — with the pair count that explains the gap.
Simpson's ParadoxDetects when a pooled comparison contradicts every subgroup, then repairs it by standardising — which takes the real Berkeley admissions gap from +14.16 points to −4.26 and changes its sign.
Monty HallGeneralises the puzzle so the famous 100-door explanation stops hiding its own assumption — open one door instead of 98 and switching is worth 1.0102% against 1%, still right and barely.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. A conditional probability is only as good as the joint probability fed to it, and joint probabilities estimated by intuition are wrong far more often than marginals are — where you have observed counts, use the table mode instead of estimating.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (5 updates)

Published 12 September 2026

  1. Published a conditional probability tool that prints BOTH directions. P(A|B) and P(B|A) are different numbers linked by P(A)/P(B), and on the shipped example one is exactly 100 times the other — 90% of the guilty leave the trace, 0.9% of those leaving it are guilty. Every calculator that prints one direction without the other is how that confusion survives.
  2. Added P(A | not B) beside P(not A | B), because 1 - P(A|B) gives the second and people reach for it wanting the first. On the same example they differ by five orders of magnitude: 99.1% against 0.00101%.
  3. Feasibility is checked against the Frechet bounds before anything is divided. P(A) = 0.3, P(B) = 0.4, P(A and B) = 0.35 describes no world, and the tool refuses rather than returning a number with no referent. The boundary cases are accepted as valid.
  4. Sampling without replacement uses the exact falling product. Two aces from a deck is 0.452%; multiplying the marginals gives 0.592%, a 30.8% overstatement. Verified across 2,000 random configurations that the naive product never comes in below the exact answer.
  5. The suite confirms Bayes' theorem and the law of total probability across thousands of randomly generated feasible triples rather than on the worked example alone.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.