What is a Conditional Probability Calculator?
A conditional probability calculator finds P(A | B), the probability that event A happens given that event B has happened. It divides the joint probability P(A ∩ B) by P(B), or the count of outcomes in both events by the count in B, and shows the steps. From a 2×2 table it returns all eight conditional probabilities and checks whether A and B are independent.
What the Conditional Probability Calculator does
Conditional probability answers questions that start with “given that…”: the chance a customer buys given that they opened the email, the chance a patient has a disease given a positive test, the chance a part is defective given that it came from line 2. This P(A | B) calculator works from whatever you have: two probabilities, two counts, or a full two-way table of counts, and it shows each step of the calculation.
In table mode it computes the joint and marginal probabilities, all eight conditional probabilities (A given B, A given not B, B given A and so on) and an independence check that compares P(A | B) with P(A). If the table comes from a sample and you want to know whether the dependence is statistically significant, follow up with a Chi-Square Test of Independence Calculator.
For unconditional questions about two events, such as P(A and B), P(A or B) or the chance that neither happens, use the Probability Calculator. To turn P(B | A) into P(A | B) when you know the base rate instead of the joint probability, use the Bayes’ Theorem Calculator.
How to use the Conditional Probability Calculator
- Choose What do you know?: Probabilities, Counts or a 2×2 table.
- For probabilities, enter Joint probability, P(A ∩ B) and Probability of B, P(B). Add Probability of A, P(A) if you also want P(B | A) and the independence check.
- For counts, enter Count of A and B and Count of B; the optional Count of A and Total count, N unlock the extra results.
- For a table, type the four cell counts with A / not A as rows and B / not B as columns, then read every conditional probability in the results and tables.
How to calculate conditional probability by hand
The calculator follows the same four steps you would use on paper. With counts, the probabilities in step 2 are just each count divided by the total N, so you can skip straight to n(A ∩ B) / n(B).
- Name the events. Decide which event is known (the condition, B) and which one you want the probability of (A). The event after the word “given” goes on the right of the bar.
- Find the joint probability or count. Get P(A ∩ B), the chance that both happen, or n(A ∩ B), the number of outcomes in both.
- Find the probability or count of the condition. Get P(B) or n(B). It must be greater than 0.
- Divide. P(A | B) = P(A ∩ B) / P(B). For example, with P(A ∩ B) = 0.12 and P(B) = 0.3, P(A | B) = 0.12 / 0.3 = 0.4.
Conditional probability formula
| Symbol | Meaning |
|---|---|
| P(A | B) | probability of A given that B occurred |
| P(A ∩ B) | joint probability that A and B both occur |
| P(B) | probability of the conditioning event |
| n(A ∩ B), n(B) | number of outcomes in both events, and in B |
Conditioning on B shrinks the sample space to the outcomes where B occurred, then asks what fraction of those also belong to A.
Conditional probability example
Worked example: review sessions and exam results
Problem. Of 120 students, 70 attended a review session (B). Of those 70, 42 passed (A); of the 50 who did not attend, 18 passed. What is the probability of passing given attendance, and are passing and attending independent?
- 01Set up the table: n(A ∩ B) = 42, n(A ∩ not B) = 18, n(not A ∩ B) = 28, n(not A ∩ not B) = 32. Row totals: 60 passed, 60 failed. Column totals: 70 attended, 50 did not.
- 02P(A | B) = n(A ∩ B) / n(B) = 42 / 70 = 0.6.
- 03P(A | not B) = 18 / 50 = 0.36.
- 04P(B | A) = 42 / 60 = 0.7: 70% of the students who passed had attended.
- 05Overall pass rate P(A) = 60 / 120 = 0.5, which differs from P(A | B) = 0.6.
Answer. A student who attended has a 0.6 chance of passing, versus 0.36 for one who did not, so passing and attending are not independent in this group. Whether attendance causes the improvement is a separate question that a table alone cannot answer.
P(A | B) is not the same as P(B | A)
Swapping the condition is one of the most common probability mistakes. In the example above, P(passed | attended) = 0.6 while P(attended | passed) = 0.7. The two share the same numerator, n(A ∩ B) = 42, but divide by different totals: everyone who attended versus everyone who passed.
The gap can be enormous when one event is rare. Most people with a rare disease may test positive, yet most positive tests can still come from healthy people, as the medical test example below shows. Converting one conditional probability into the other requires the base rates, which is exactly what the Bayes’ Theorem Calculator does.
Medical test example: P(disease | positive) from a table
A disease affects 1% of a population. A test detects 90% of cases and wrongly flags 10% of healthy people. Picture 1,000 people: 10 have the disease and 9 of them test positive; 990 are healthy and 99 of them test positive anyway. Let A = has the disease and B = tests positive.
P(positive | disease) = 9 / 10 = 0.9, but P(disease | positive) = 9 / (9 + 99) = 9 / 108 = 0.0833. Only about 1 positive in 12 is a real case, because the healthy group is so much larger. On a probability tree the same numbers are the two “positive” branches: 0.01 × 0.9 = 0.009 and 0.99 × 0.1 = 0.099, so P(disease | positive) = 0.009 / 0.108. Load the Medical test, 1% prevalence example above to see every conditional probability for this table.
| Tests positive (B) | Tests negative (not B) | Total | |
|---|---|---|---|
| Has the disease (A) | 9 | 1 | 10 |
| Healthy (not A) | 99 | 891 | 990 |
| Total | 108 | 892 | 1,000 |
Conditional probability with three events
With three events, the condition can itself be a combination. P(A | B ∩ C) = P(A ∩ B ∩ C) / P(B ∩ C), so enter P(A ∩ B ∩ C) as the joint probability and P(B ∩ C) as P(B) in the calculator. The same division works with counts.
To find the chance that three events all happen in sequence, multiply the conditional probabilities along the path, as on a probability tree: P(A ∩ B ∩ C) = P(A) · P(B | A) · P(C | A ∩ B). For three aces in a row from a 52-card deck without replacement, that is 4/52 × 3/51 × 2/50 = 24 / 132,600 ≈ 0.000181.
Common use cases
- Marketing funnels: conversion rate among visitors who clicked an ad versus those who did not.
- Medicine: the chance of a condition given a symptom or a test result, read from a two-way table of patients.
- Quality control: the defect rate given the production line, shift or supplier.
- Survey analysis: the share of each group giving an answer, such as P(supports policy | age under 30).
- Card and dice problems: probabilities for the second draw given what the first draw was.
Assumptions and limitations
- P(A | B) is undefined when P(B) = 0 or n(B) = 0; you cannot condition on an event that never happens.
- A table built from a sample gives estimates. A difference between P(A | B) and P(A) in the sample can be due to chance; test it with the Chi-Square Test of Independence Calculator or Fisher’s exact test for small counts.
- Dependence is not causation. A strong association between A and B in observational data can come from a third variable that drives both.
- The 2×2 table covers two yes/no events. For events with more than two categories, compute each conditional probability as the cell count divided by its row or column total.
Frequently asked questions
How do you calculate conditional probability?
What does the vertical bar in P(A | B) mean?
How can I tell if two events are independent from a table?
Is P(A | B) equal to P(B | A)?
What is the difference between conditional and joint probability?
How do you find a conditional probability with 3 events?
Can a conditional probability be larger than 1?
Cite this page
Statculator. (2026, November 14). Conditional Probability Calculator. Retrieved November 14, 2026, from https://statculator.com/probability/conditional-probability-calculator/