Statistics & Probability

Conditional Probability Calculator

Choose your question type and enter the probabilities as decimals, fractions or percents. The calculator substitutes into the formula and shows each step, including a medical-test (false positive) mode.

Decimals, fractions or percents: 0.2, 1/5 or 20%
Try an example:
Answer P(A | B) = 0.4
  • 40%
Step-by-step working 3 steps
  1. 1
    Conditional probability formula
    P(A | B) = P(A and B) ÷ P(B)

    Read “probability of A given B”: restrict attention to the cases where B happened.

  2. 2
    Substitute
    P(A | B) = 0.2 ÷ 0.5 = 0.4
  3. 3
    As a percent
    40%

How to use the conditional probability calculator

  1. Choose the question type.
  2. Enter each probability as a decimal, fraction or percent.
  3. Follow the substitution into the formula.
  4. Read the answer as a decimal and a percent.

Formulas

P(A | B) = P(A and B) ÷ P(B)
P(A | B) = P(B | A)·P(A) ÷ P(B)
P(B) = P(B | A)P(A) + P(B | not A)P(not A)

Conditional probability restricts attention to the cases where B happened.

Worked examples

Each example below is generated by the same calculator you used above, so the working always matches the answer.

P(A and B) 0.2, P(B) 0.5
Answer P(A | B) = 0.4
  • 40%
Step-by-step working 3 steps
  1. 1
    Conditional probability formula
    P(A | B) = P(A and B) ÷ P(B)

    Read “probability of A given B”: restrict attention to the cases where B happened.

  2. 2
    Substitute
    P(A | B) = 0.2 ÷ 0.5 = 0.4
  3. 3
    As a percent
    40%
Bayes’ theorem
Answer P(A | B) = 0.48
  • 48%
Step-by-step working 3 steps
  1. 1
    Bayes’ theorem
    P(A | B) = P(B | A) × P(A) ÷ P(B)
  2. 2
    Substitute
    P(A | B) = 0.8 × 0.3 ÷ 0.5 = 0.24 ÷ 0.5 = 0.48
  3. 3
    As a percent
    48%
Medical test: 1% prevalence
Answer P(A | positive) = 0.153846
  • 15.3846%
  • P(positive) = 0.0585
Step-by-step working 3 steps
  1. 1
    Set up
    P(A) = 0.01 (prior)
    P(positive | A) = 0.9 (true-positive rate)
    P(positive | not A) = 0.05 (false-positive rate)
  2. 2
    Total probability of a positive result
    P(positive) = P(pos | A)·P(A) + P(pos | not A)·P(not A)
    = 0.9 × 0.01 + 0.05 × 0.99 = 0.0585
  3. 3
    Bayes’ theorem
    P(A | positive) = 0.009 ÷ 0.0585 = 0.153846

    When A is rare, most positives can be false positives even if the test is accurate.

P(A and B) 1/6, P(B) 1/2
Answer P(A | B) = 0.333333
  • 33.3333%
Step-by-step working 3 steps
  1. 1
    Conditional probability formula
    P(A | B) = P(A and B) ÷ P(B)

    Read “probability of A given B”: restrict attention to the cases where B happened.

  2. 2
    Substitute
    P(A | B) = 0.166667 ÷ 0.5 = 0.333333
  3. 3
    As a percent
    33.3333%

Where you will use this

  • Medical-test and screening “how likely is it really?” questions
  • Two-way table problems in statistics
  • Checking Bayes’ theorem homework

Common mistakes to avoid

Confusing P(A | B) with P(B | A)

They are different. A test being 90% accurate does not mean a positive result is 90% likely to be right.

Ignoring the base rate

If a condition is rare, most positives can be false positives even for an accurate test.

Treating dependent events as independent

Multiplying probabilities only works when the events are independent.

Frequently asked questions

What is the formula for conditional probability?

P(A | B) = P(A and B) ÷ P(B), as long as P(B) is not 0.

If P(A and B) = 0.2 and P(B) = 0.5, what is P(A | B)?

0.2 ÷ 0.5 = 0.4, or 40%.

What is Bayes’ theorem used for?

To reverse a conditional probability: from P(B | A) to P(A | B), using the prior P(A) and the overall P(B).

Related calculators

Browse everything in Statistics & Probability or the full calculator list.