Math calculators

Conditional Probability Calculator

Updated Sep 24, 2026 By Infinity Calculator
Rate Formulas

Solve P(A | B) from probabilities

Loaded values: P(A ∩ B) = 0.20 and P(B) = 0.30. Press Example for a real-world scenario.
Decimal from 0 to 1, up to 7 characters.
Must be greater than 0 and at least P(A ∩ B).
P(A | B) — probability of A given B
P(Aᶜ | B) — complement

Visual breakdown

    Step-by-Step Solution

    Introduction

    This Conditional Probability Calculator finds the chance that one event happens when you already know another event happened. In math, we write that as P(A | B), and we say it out loud as "the probability of A given B."

    The main formula is simple: P(A | B) = P(A ∩ B) ÷ P(B). You divide the chance that both events happen by the chance that B happens. The calculator runs that division and shows each step.

    There are four ways to use it:

    • Probabilities: enter P(A ∩ B) and P(B) as decimals.
    • Counts: enter raw numbers, like 35 out of 50.
    • 2×2 Table: enter four cell counts and get six conditional probabilities at once.
    • Independence: check if two events affect each other or not.

    Each tab gives you a decimal answer, a percent, the complement, a chart, and a step-by-step solution. Press Example on any tab to load a real-world problem and see how it works.

    How to use our Conditional Probability Calculator

    Pick a tab, type in your numbers, and press Calculate. The tool gives you P(A | B), the complement, a Venn diagram or chart, and a step-by-step solution you can follow.

    Probabilities tab

    P(A ∩ B) — Joint Probability: Type the chance that A and B both happen in the same trial. Use a decimal from 0 to 1, like 0.21.

    P(B) — Marginal Probability: Type the chance that B happens on its own. It must be more than 0 and at least as big as P(A ∩ B).

    Counts tab

    count(A ∩ B): Type how many times A and B both happened. Use a whole number, 0 or more.

    count(B): Type how many times B happened in total. This is your group size, not the whole sample. It must be more than 0 and at least as big as count(A ∩ B).

    2×2 Table tab

    Cell a: Type how many times A and B both happened. Whole numbers only.

    Cell b: Type how many times B happened but A did not.

    Cell c: Type how many times A happened but B did not.

    Cell d: Type how many times neither A nor B happened. The row, column, and grand totals fill in as you type.

    Independence tab

    P(A): Type the chance that A happens on its own, as a decimal from 0 to 1.

    P(B): Type the chance that B happens on its own. It must be more than 0.

    P(A ∩ B): Type the chance that A and B happen together. It cannot be bigger than P(A) or P(B). The tool then tells you if the two events are independent or dependent.

    Press Example on any tab to load a real-world scenario, or Reset to clear the boxes and start over.

    What Is Conditional Probability?

    Conditional probability is the chance that one event happens when you already know another event happened. We write it as P(A | B), and we read it as "the probability of A given B." The straight line means "given."

    Knowing that B happened shrinks the world you look at. Instead of counting every possible outcome, you only count the outcomes where B happened.

    The Conditional Probability Formula

    P(A | B) = P(A ∩ B) ÷ P(B)

    • P(A ∩ B) is the joint probability, the chance A and B both happen.
    • P(B) is the chance B happens on its own. It must be more than 0, because you cannot divide by zero.

    If you have raw counts instead of decimals, use: P(A | B) = count(A and B) ÷ count(B).

    A Simple Example

    Say 50 students studied for a test, and 35 of them passed. Let A = "passed" and B = "studied." Then P(A | B) = 35 ÷ 50 = 0.70, or 70%. Among students who studied, 7 out of 10 passed.

    Reading a 2×2 Table

    A 2×2 contingency table sorts data into four boxes: both events, one event only, the other event only, and neither. Row totals and column totals let you find many probabilities at once. For P(A | B), divide the "both" cell by its row total. For P(B | A), divide the same cell by its column total. These two answers are often different, and mixing them up is a common mistake.

    Independent vs. Dependent Events

    Two events are independent when one does not change the other. That is true when P(A | B) = P(A), or when P(A) × P(B) = P(A ∩ B). Coin flips and dice rolls are independent. If the numbers do not match, the events are dependent, which means knowing B tells you something new about A. Rain and carrying an umbrella are dependent.

    Things to Watch For

    • P(A ∩ B) can never be bigger than P(A) or P(B).
    • P(A | B) and P(B | A) are not the same thing.
    • count(B) means the number of times B happened, not the whole sample size.
    • P(Ac | B) = 1 − P(A | B). This is the chance A does not happen, given B.

    Where People Use It

    Doctors use conditional probability to read medical test results. Weather forecasters use it to predict rain. Banks use it to judge loan risk, and spam filters use it to sort email. It is also the base for Bayes' theorem, which flips a conditional around: P(B | A) = P(A | B) × P(B) ÷ P(A).


    Formulas used

    Conditional probability of A given B
    P(A \mid B) = \frac{P(A \cap B)}{P(B)}
    Conditional probability from counts
    P(A \mid B) = \frac{\text{count}(A \cap B)}{\text{count}(B)}
    Complement of a conditional probability
    P(A^{c} \mid B) = 1 - P(A \mid B)
    Conditional probabilities from a 2x2 table (cells a, b, c, d)
    P(A \mid B) = \frac{a}{a+b}, \quad P(B \mid A) = \frac{a}{a+c}, \quad P(A \mid B^{c}) = \frac{c}{c+d}, \quad P(B^{c} \mid A^{c}) = \frac{d}{b+d}
    Marginal and joint probabilities from a 2x2 table
    P(A) = \frac{a+c}{N}, \quad P(B) = \frac{a+b}{N}, \quad P(A \cap B) = \frac{a}{N}, \quad N = a+b+c+d
    Independence test (multiplication rule)
    A \perp B \iff P(A \mid B) = P(A) \ \text{and}\ P(A) \times P(B) = P(A \cap B)
    Venn region probabilities
    P(A \setminus B) = P(A) - P(A \cap B), \quad P(B \setminus A) = P(B) - P(A \cap B), \quad P(A^{c} \cap B^{c}) = 1 - P(A) - P(B) + P(A \cap B)

    Frequently asked questions

    What is Bayes' theorem?

    Bayes' theorem flips a conditional probability around. If you know P(A | B) but want P(B | A), use:

    P(B | A) = P(A | B) × P(B) ÷ P(A)

    It is useful when one direction is easy to measure and the other is not. For example, a lab can test how often a sick person gets a positive result. Bayes' theorem turns that into the chance a person with a positive result is really sick.

    Can a conditional probability be greater than 1?

    No. Every probability sits between 0 and 1. If you get an answer above 1, you divided wrong or your numbers do not fit together.

    The most common cause is a joint value bigger than the condition. P(A ∩ B) can never be larger than P(B), and count(A and B) can never be larger than count(B). Check those two numbers first.

    What is the difference between joint probability and conditional probability?

    Joint probability, P(A ∩ B), is the chance both events happen out of everything. Conditional probability, P(A | B), is the chance A happens out of only the times B happened.

    Example: 100 people, 30 studied and passed, 50 studied in total.

    • Joint: 30 ÷ 100 = 0.30
    • Conditional: 30 ÷ 50 = 0.60

    Same top number, different bottom number.

    Are mutually exclusive events independent?

    No. They are the opposite of independent.

    Mutually exclusive means the two events cannot happen together, so P(A ∩ B) = 0. That makes P(A | B) = 0. If B happens, you now know A did not happen, so B gave you information about A.

    The only exception is the odd case where one event has probability 0.

    How do you find P(A and B) if you know the conditional probability?

    Rearrange the formula. This is called the multiplication rule:

    P(A ∩ B) = P(A | B) × P(B)

    You can also write it as P(A ∩ B) = P(B | A) × P(A). Both give the same answer.

    Example: 60% of days are cloudy, and it rains on 40% of cloudy days. P(cloudy and rain) = 0.40 × 0.60 = 0.24, or 24% of all days.

    Why is P(A|B) not the same as P(B|A)?

    They divide by different groups. P(A | B) divides by all the times B happened. P(B | A) divides by all the times A happened.

    Example: almost every person with the flu has a fever, so P(fever | flu) is near 1. But most people with a fever do not have the flu, so P(flu | fever) is much lower. Swapping the two is called the confusion of the inverse.

    What is the law of total probability?

    It builds an overall probability from its parts:

    P(A) = P(A | B) × P(B) + P(A | Bᶜ) × P(Bᶜ)

    Example: 70% of students study, and 90% of them pass. Only 20% of non-studiers pass.

    P(pass) = 0.90 × 0.70 + 0.20 × 0.30 = 0.63 + 0.06 = 0.69, or 69%.

    How do you find conditional probability when drawing cards without replacement?

    After the first card leaves the deck, both the top and bottom numbers change.

    Example: draw two aces in a row. The first ace is 4 ÷ 52. Now 51 cards remain and only 3 aces are left, so P(second ace | first ace) = 3 ÷ 51 ≈ 0.0588.

    The chance of both is 4/52 × 3/51 ≈ 0.0045, about 1 in 221. Drawing without replacement always makes events dependent.

    If a medical test is 99% accurate, does a positive result mean you are sick?

    Often not. It depends on how rare the disease is.

    Say 1 in 100 people has a disease and you test 10,000 people. About 100 are sick, and the test finds 99 of them. But 9,900 are healthy, and 1% of those, about 99 people, get a false positive.

    So 99 of 198 positives are truly sick, only about 50%. This is called the base rate fallacy.

    How do you know if two events are independent?

    Run either check. If one is true, the other is too.

    • P(A | B) = P(A)
    • P(A) × P(B) = P(A ∩ B)

    Example: P(A) = 0.4, P(B) = 0.5, P(A ∩ B) = 0.2. Since 0.4 × 0.5 = 0.2, they are independent.

    If P(A ∩ B) were 0.3 instead, they would be dependent, because knowing B changes the odds of A.

    How do you use a tree diagram for conditional probability?

    Draw one branch for each first event, then branch again for the second event. The second set of branches holds conditional probabilities.

    Multiply along a path to get the chance of that whole path. Add paths together when more than one path gives the result you want.

    Every set of branches from one point must add up to 1. That is a quick way to check your work.