Conditional Probability Calculator
A conditional probability calculator finds P(A|B): the chance event A happens given that event B already happened. Enter your probabilities as decimals or percentages, choose what to compute, and get the answer as a decimal and a percentage with the full working shown.
Every probability must lie between 0 and 1. The joint probability P(A and B) can never exceed either individual probability.
What conditional probability means
Conditional probability answers "how likely is A, now that we know B happened?" The formula divides the probability of both events by the probability of the given event: P(A|B) = P(A and B) / P(B), provided P(B) is not zero. Knowing B happened shrinks the world of possibilities to just the outcomes where B occurred, and P(A|B) is the share of those outcomes where A also occurred.
How to use this calculator
Choose what to compute: P(A|B), P(B|A), the joint probability under independence, Bayes' theorem, the union, or the independence test. Enter values as decimals (0.3) or switch to percent mode (30); the tool converts automatically. Every result appears as both a decimal and a percentage, with the working shown step by step.
Worked example
A medical test is positive for 8% of patients (P(B) = 0.08), 1% of patients have the disease (P(A) = 0.01), and the test is positive for 0.9% of patients who have the disease and test positive jointly, P(A and B) = 0.009. Then P(A|B) = 0.009 / 0.08 = 0.1125, or 11.25%. Even with a positive test, the chance of actually having the disease is only about 1 in 9, because the disease is rare. This is the classic base-rate effect that Bayes' theorem captures.
Bayes' theorem mode
Sometimes you know the reverse conditional, P(B|A), but need P(A|B). Bayes' theorem flips them: P(A|B) = P(B|A) x P(A) / P(B). Select the Bayes mode, enter P(B|A), P(A) and P(B), and the tool computes the flipped probability, checking that your inputs are consistent (the result can never exceed 1).
What changed in this version
The previous tool covered P(A|B), P(B|A), a joint display and an independence test. This version keeps all four and adds a Bayes' theorem mode, a union (addition rule) mode, percent input with automatic conversion, and results shown as both decimals and percentages. Validation now explains the problem inline instead of using popup alerts.
New: three more ways in
Counts mode works from natural frequencies instead of probabilities: enter how many observations had both A and B, how many had B, and the grand total, and the calculator returns P(A|B) plus P(B) and P(A and B) for context. Counts are easier to sanity-check than decimals, which is why textbooks teach Bayes with frequencies first. Single event mode computes P(A) from favorable over total outcomes, and complement mode gives P(not A) = 1 - P(A) for the times "not happening" is the easier side to work with.
What competitors miss
OnlyCalculators has the strongest conditional tool on the SERP with Bayes and counts modes, but it has no single-event or complement mode, so simple questions need a different page. Pearson's calculator has quick-pick presets but no counts input. CalculatorPark covers four modes with a friendly decimal-or-percent input but stops at the same boundary. This calculator now covers nine modes in one place: both conditional directions, joint, union, Bayes, independence test, counts, single event, and complement.
Worked example: counts mode
A clinic sees 1,000 patients: 93 test positive, 45 of those truly have the condition:
- P(condition | positive) = 45 / 93 = 0.483871 (48.39%)
- P(positive) = 93 / 1000 = 0.093; P(condition and positive) = 45 / 1000 = 0.045
Even with a positive test, the chance is under half when the condition is rare: the base rate dominates.
Frequently asked questions
When should I use counts instead of probabilities?
Whenever your data comes as raw numbers: test results, survey responses, or contingency tables. Counts make the math transparent (45 out of 93) and the calculator converts to probabilities for you.
What is the difference between P(A|B) and P(B|A)?
P(A|B) restricts to the world where B happened and asks how often A holds there; P(B|A) does the reverse. They are rarely equal. Confusing them is the classic base-rate error, and the calculator computes both so you can compare.
Why does the independence test matter?
The joint mode multiplies P(A) x P(B), which is only valid for independent events. The independence test compares that product against your observed P(A and B) so you know whether the shortcut is legitimate.
What is the difference between P(A|B) and P(B|A)?
They condition on different events. P(A|B) is the chance of A given B happened; P(B|A) is the chance of B given A happened. They are usually different numbers, and confusing them is called the prosecutor's fallacy.
When is P(A|B) undefined?
When P(B) = 0. You cannot condition on an impossible event, because the formula divides by P(B). The calculator flags this instead of returning a number.
How do I know if events are independent?
Check whether P(A and B) equals P(A) x P(B). The independence test mode does exactly this comparison for you. Independent events are unaffected by each other: P(A|B) = P(A).
Can I enter percentages?
Yes. Switch the input mode to percent and type 30 for 30%. The tool converts to decimals internally and shows every answer as both a decimal and a percentage.
What is the union rule?
P(A or B) = P(A) + P(B) - P(A and B). You add the two probabilities and subtract the overlap so outcomes in both events are not counted twice. For mutually exclusive events the joint term is zero.
Why is P(A and B) capped at the smaller probability?
Both events happening can never be more likely than either event alone: the overlap of A and B is contained inside each of them. Inputs violating this are rejected as inconsistent.
