Probability

Conditional Probability Calculator

Use this conditional probability calculator to find P(A|B) or P(B|A) from probabilities, counts, or a 2×2 table. Enter your values and click Calculate to get the answer with a clear, step-by-step solution.

Input Type
Enter a decimal from 0 to 1.
Enter the probability of the conditioning event B.
Enter the number of observations that satisfy both A and B.
Enter the number of observations satisfying B, not the total sample size.

Enter the four frequencies in the table. Row totals, column totals, and the overall total are calculated automatically.

B Not B Total
A 40
Not A 40
Total 36 44 80
Example results are shown automatically. After changing the values, click Calculate to update the results.

How to Use the Conditional Probability Calculator

The calculator helps you find conditional probability from probabilities, counts, or a 2×2 table. To use the calculator, choose the input type that matches the information given in your question and follow these steps:

  1. Choose Probabilities when the question gives you the joint probability, P(A ∩ B), together with P(A) or P(B).
  2. Select whether you want to find P(A|B) or P(B|A).
  3. Enter the joint probability, P(A ∩ B).
  4. Enter the probability of the event A or B as a decimal, depending on the probability you want to find. If you want to find P(A|B), you need to enter P(A ∩ B) and P(B). However, if you want to find P(B/A), you should enter P(A ∩ B) and P(A)
  5. Click Calculate

If the question provides you with frequencies or number of observations instead of probabilities, follow these steps:

  1. Select Counts as the data input option
  2. Select P(A|B) or P(B|A), depending on what you want to find
  3. Enter the number of observations that belong to both A and B.
  4. Enter the number belonging to the conditioning event.
  5. Click Calculate.

Tip. You do not need the total sample size unless it is needed to determine one of these counts.

Sometimes, you may be required to compute conditional probabilities from a given 2 x 2 contingency table. Our calculator still supports this option. Therefore, to find conditional probabilities from a two-way contingency table with the calculator, follow these steps:

  1. Select the 2×2 Table input option
  2. Select the probability you want to find. This option allows you to find P(A|B), P(A|not B), P(B|A), or P(B|not A).
  3. Enter the four cell frequencies. The calculator will automatically find the row totals, column totals, and grand total.
  4. Click Calculate

In each case, the calculator instantly returns the correct conditional probability and provides a clear step-by-step solution, showing you how the probabilities were computed.

What Is Conditional Probability?

Conditional probability is the probability that one event occurs when another event is already known to have occurred.

It is written using a vertical bar. For example, P(A|B) is read as “the probability of A given B.”

The word given is important. Once B is known to have occurred, we no longer consider every possible outcome. We restrict our attention to outcomes where B occurred and then determine how many of those outcomes also belong to A.

Suppose 50 students attended a review session and 40 of those students passed an exam. If we want the probability that a student passed given that the student attended the review session, only those 50 students form the relevant group. Therefore, P(Passed | Review) = 40 / 50 = 0.8. In other words, 0.8 is the conditional probability that a student passed given that the student attended the review session.

Conditional Probability Formula

The conditional probability formula of A given B is: P(A|B) = P(A ∩ B) / P(B)

where:

  • P(A|B) is the conditional probability of A given B
  • P(A ∩ B) is the probability that A and B both occur
  • P(B) is the probability that B occurs

For the above formula to be defined, P(B) must be greater than 0.

However, if you want to reverse the condition and find the probability of B given A, the formula changes to: P(B|A) = P(A ∩ B) / P(A). For this formula to be defined, P(A) must be greater than 0.

Note. The joint probability remains the same in both formulas. Only the denominator changes.

How to Calculate Conditional Probability From Probabilities

When probabilities are given directly, identify the joint probability and the probability of the conditioning event. Then divide the joint probability by the conditioning probability.

The event that appears after the vertical bar tells you which probability belongs in the denominator.

Example 1: Find P(A|B)

A college survey found that the probability a randomly selected student uses the tutoring center and passes a statistics course is 0.28. The probability that a student uses the tutoring center is 0.40. Find the probability that a student passes given that the student uses the tutoring center.

Let:

  • A = student passes statistics
  • B = student uses the tutoring center

From the question, we know that:

  • P(A ∩ B) = 0.28
  • P(B) = 0.40

We want to find P(A|B).

Using the conditional probability formula: P(A|B) = P(A ∩ B) / P(B)

Substituting the values, we get:

P(A|B) = 0.28 / 0.40

= 0.7

Therefore, P(A|B) = 0.7. This implies that, given a student uses the tutoring center, the probability that the student passes statistics is 0.7.

Example 2: Find P(B|A)

At a university, the probability that a randomly selected student is enrolled in an online course and also works part-time is 0.24. The probability that the student is enrolled in an online course is 0.40. Find the probability that the student works part-time given that the student is enrolled in an online course.

Let:

  • A = student is enrolled in an online course
  • B = student works part-time

From the question:

  • P(A ∩ B) = 0.24
  • P(A) = 0.40

In this case, we need to find P(B|A).

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

Substituting the values, we get:

= 0.24 / 0.40

= 0.6

Therefore, P(B|A) = 0.6. This implies that given that a student is enrolled in an online course, the probability that the student works part-time is 0.6.

How to Find Conditional Probability From Counts

Sometimes a problem gives the number of observations instead of probabilities. In that case, use: P(A|B) = n(A ∩ B) / n(B)

where:

  • n(A ∩ B) is the number of observations belonging to both A and B
  • n(B) is the number of observations belonging to B

The same idea applies when finding P(B|A): P(B|A) = n(A ∩ B) / n(A)

The key is to divide by the number of observations in the event that comes after given.

Example 4: P(A|B) from Counts

A statistics instructor recorded that 72 students attended an exam review session. Of those students, 54 passed the exam. Find the probability that a student passed given that the student attended the review session.

Let:

  • A = student passed
  • B = student attended the review session

From the question:

  • n(A ∩ B) = 54
  • n(B) = 72

Since we are finding P(A|B), only the 72 students who attended the review session form the relevant group.

Recall. P(A|B) = n(A ∩ B) / n(B)

Substituting the values, we have:

P(A|B) = 54 / 72

= 0.75

Therefore, given that a student attended the review session, the probability that the student passed is 0.75.

Example 5: P(B|A) from Counts

A professor found that 120 students passed a final exam. Among those students, 84 had completed the optional practice problems. Find the probability that a student completed the practice problems given that the student passed.

Let:

  • A = student passed the exam
  • B = student completed the practice problems

From the question:

  • n(A ∩ B) = 84
  • n(A) = 120

We want to find P(B|A).

By definition, P(B|A) = n(A ∩ B) / n(A)

Substituting the values, we get:

P(B|A) = 84 / 120

= 0.7

Therefore, given that a student passed the exam, the probability that the student completed the practice problems is 0.7.

How to Find Conditional Probability From a 2×2 Table

A 2×2 table organizes observations according to two events. It may also be called a two-way table or contingency table.

A general 2×2 table looks like this:

BNot BTotal
AA and BA and not BTotal A
Not Anot A and Bnot A and not BTotal not A
TotalTotal BTotal not BTotal

To find conditional probability from the table:

  1. Look at the event after the vertical bar.
  2. Find the row or column total for that event.
  3. Use that total as the denominator.
  4. Find the cell where the two required events intersect.
  5. Divide the intersection count by the conditioning total.

This means the denominator is not automatically the grand total.

Example 7: Find P(A|B) From a Two-Way Table

A college surveyed students about whether they own a car and whether they live off campus.

Let:

  • A = student owns a car
  • B = student lives off campus

The results were:

Lives Off Campus, BNot BTotal
Owns a Car, A422870
Not A186280
Total6090150

Find P(A|B).

Solution

Because B is the conditioning event, we only consider the 60 students who live off campus.

Among those students, 42 own a car.

Therefore, P(A|B) = 42 / 60

= 0.7

As such, given that a student lives off campus, the probability that the student owns a car is 0.7.

Example 8: Find P(A|not B) From a Two-Way Table

A statistics class recorded whether students attended a review session and whether they passed an exam.

Let:

  • A = student passed
  • B = student attended the review session
Attended Review, BDid Not Attend, not BTotal
Passed, A483684
Did Not Pass, not A122436
Total6060120

Find P(A|not B).

Solution

The conditioning event is not B. Thus, we should focus only on students who did not attend the review session.

There are 60 students in that group, and 36 passed. Therefore, P(A|not B) = 36 / 60

= 0.6

As such, given that a student did not attend the review session, the probability that the student passed is 0.6.

Example 9: Find P(B|not A) From a Two-Way Table

A university surveyed students about whether they use the campus gym and whether they live on campus.

Let:

  • A = student uses the campus gym
  • B = student lives on campus

The results were:

Lives on Campus, BNot BTotal
Uses Gym, A503080
Does Not Use Gym, not A204060
Total7070140

Find P(B|not A).

Solution

The event after the vertical bar is not A. Therefore, only the 60 students who do not use the campus gym belong to the relevant group.

Of those students, 20 live on campus.

Therefore, P(B|not A) = 20 / 60

= 0.333333

This means that given that a student does not use the campus gym, the probability that the student lives on campus is approximately 0.333333.

Conditional Probability and Independent Events

Two events are independent when knowing that one occurred does not change the probability of the other.

For independent events, P(A|B) = P(A) and P(B|A) = P(B)

For example, suppose you flip a fair coin and roll a fair die. Knowing that the coin landed heads does not change the probability of rolling a particular number on the die. Therefore, conditional probability is especially useful when events are dependent because knowing one event occurred can change the probability of the other.

Conditional Probability vs. Bayes’ Theorem

Conditional probability and Bayes’ theorem are closely related, but they are not the same calculation. The standard conditional probability formula finds P(A|B) when you already know P(A ∩ B) and P(B): P(A|B) = P(A ∩ B) / P(B)

However, Bayes’ theorem is useful when you know probabilities such as P(B|A), P(A), and P(B) and want to reverse the condition to find P(A|B).

This calculator focuses on conditional probability from direct probabilities, counts, and 2×2 tables. A Bayes’ theorem calculator is better suited to problems that require reversing a conditional probability.

If a probability problem instead asks about arrangements or selections, our Combination Calculator and Permutation Calculator can help with the counting needed to determine the number of possible outcomes.

Frequently Asked Questions

What is a conditional probability calculator?

A conditional probability calculator finds the probability of one event occurring given that another event has already occurred. It can calculate values such as P(A|B) or P(B|A) from probabilities, counts, or a 2×2 table and show the calculation step by step.

What is conditional probability?

Conditional probability is the probability of one event occurring given that another event has already occurred. For example, P(A|B) represents the probability of A given B.

What is the formula for conditional probability?

The formula is P(A|B) = P(A ∩ B) / P(B), where P(A ∩ B) is the probability that A and B both occur and P(B) is the probability of the conditioning event.

Is P(A|B) the same as P(B|A)?

No. They use different conditioning events and therefore usually have different denominators and different answers.

Can conditional probability be greater than 1?

No. A valid conditional probability must fall between 0 and 1.

How do you calculate conditional probability from counts?

Divide the number of observations belonging to both events by the number belonging to the conditioning event. For P(A|B), use the formula: P(A|B) = n(A ∩ B) / n(B)

Cite

Choose APA, MLA, Chicago, or Harvard, then copy the citation.

Mburu, J.. (2026, September 8). Conditional Probability Calculator. StatCalc.net. Retrieved September 11, 2026, from https://statcalc.net/conditional-probability-calculator/

Joseph Mburu

About This Calculator

Prepared by Joseph Mburu · Updated on

Joseph is an applied statistician and data analyst with over 6 years of experience helping students, researchers, and professionals solve statistics and data analysis problems. He holds a degree in Applied Statistics and a Master’s degree in Data…

We aim to keep our calculators accurate, easy to use, and helpful for learning. Always check that your inputs match the assumptions of the method you are using.