Skip to content
Statculator
Probability & Counting

Conditional Probability Calculator

Free conditional probability calculator: find P(A|B) from P(A ∩ B) and P(B), from counts or from a 2×2 table, with steps and an independence check.

Free, no sign-up Runs in your browserBy Hira Noor, BS MathematicsUpdated

Try
What do you know?

The chance that A and B both happen.

The condition. Must be greater than 0.

Optional. Adds P(B | A) and an independence check.

Results

P(A | B), A given B
0.4
P(B | A), B given A
0.48

A and B are dependent

P(A | B) = 0.4 but P(A) = 0.25: knowing that B happened raises the chance of A. Equivalently, P(A ∩ B) = 0.12 ≠ P(A) × P(B) = 0.075.

P(not A | B)
0.6
P(A ∩ B)
0.12
P(B)
0.3
P(A)
0.25
P(A | not B)
0.1857
P(A) × P(B)
0.075

Interpretation: Among outcomes where B happens, A also happens 40% of the time.

Step-by-step solution

  1. 1

    Write the definition of conditional probability

    Restrict attention to outcomes where B happened, then ask what share of them are also in A.

    P(A | B) = P(A ∩ B) / P(B)
  2. 2

    Substitute and divide

    P(A | B) = 0.12 / 0.3 = 0.4
    P(not A | B) = 1 − 0.4 = 0.6
  3. 3

    Reverse the condition

    Same numerator, different denominator.

    P(B | A) = P(A ∩ B) / P(A) = 0.12 / 0.25 = 0.48
  4. 4

    Find the chance of A when B does not happen

    P(A | not B) = [P(A) − P(A ∩ B)] / [1 − P(B)] = (0.25 − 0.12) / (1 − 0.3) = 0.1857
  5. 5

    Check independence

    A and B are dependent.

    P(A | B) = 0.4 vs P(A) = 0.25
    P(A) × P(B) = 0.25 × 0.3 = 0.075 vs P(A ∩ B) = 0.12

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

  1. Choose What do you know?: Probabilities, Counts or a 2×2 table.
  2. 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.
  3. 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.
  4. 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).

  1. 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.
  2. 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.
  3. Find the probability or count of the condition. Get P(B) or n(B). It must be greater than 0.
  4. 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

Definition
P(A | B) = P(A ∩ B) / P(B), P(B) > 0
From counts
P(A | B) = n(A ∩ B) / n(B)
Multiplication rule
P(A ∩ B) = P(A | B) · P(B) = P(B | A) · P(A)
Complement within B
P(not A | B) = 1 − P(A | B)
Independence
A and B independent ⇔ P(A | B) = P(A) ⇔ P(A ∩ B) = P(A) · P(B)
Three events (chain rule)
P(A ∩ B ∩ C) = P(A) · P(B | A) · P(C | A ∩ B)
Formula symbols
SymbolMeaning
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?

  1. 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.
  2. 02P(A | B) = n(A ∩ B) / n(B) = 42 / 70 = 0.6.
  3. 03P(A | not B) = 18 / 50 = 0.36.
  4. 04P(B | A) = 42 / 60 = 0.7: 70% of the students who passed had attended.
  5. 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)9110
Healthy (not A)99891990
Total1088921,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?

Divide the probability that both events happen by the probability of the event you are conditioning on: P(A | B) = P(A ∩ B) / P(B). With counts, divide the number of outcomes in both events by the number of outcomes in B. For example, 42 passes among 70 attendees gives P(pass | attended) = 0.6.

What does the vertical bar in P(A | B) mean?

The bar is read as “given”. P(A | B) is the probability of A given that B has occurred. Everything to the right of the bar is treated as known, which restricts the outcomes you consider to those where B is true.

How can I tell if two events are independent from a table?

Compare a conditional probability with the matching overall probability. If P(A | B) = P(A), the events are independent; equivalently, each cell probability equals the product of its row and column totals divided by N². In real data exact equality is rare, so use a chi-square test to judge whether the difference is larger than chance.

Is P(A | B) equal to P(B | A)?

Not in general. They are equal only when P(A) = P(B), or when A and B never happen together so both are 0. The two are linked by Bayes’ theorem: P(A | B) = P(B | A) · P(A) / P(B). Confusing them, sometimes called the prosecutor’s fallacy, leads to badly wrong conclusions when one event is rare.

What is the difference between conditional and joint probability?

The joint probability P(A ∩ B) is the chance that A and B both happen, measured against every possible outcome. The conditional probability P(A | B) is the chance of A measured only against the outcomes where B happened, so P(A | B) = P(A ∩ B) / P(B) is always at least as large as P(A ∩ B).

How do you find a conditional probability with 3 events?

Treat the combined condition as one event. P(A | B ∩ C) = P(A ∩ B ∩ C) / P(B ∩ C). To get the probability that all three happen, use the chain rule P(A ∩ B ∩ C) = P(A) · P(B | A) · P(C | A ∩ B).

Can a conditional probability be larger than 1?

No. Because A ∩ B is part of B, P(A ∩ B) can never exceed P(B), so their ratio is at most 1. If your numbers give a value above 1, the joint probability or count was entered for the wrong event; this calculator flags that case.

Cite this page

Statculator. (2026, November 14). Conditional Probability Calculator. Retrieved November 14, 2026, from https://statculator.com/probability/conditional-probability-calculator/