Conditional Probability Calculator

Quick answer

The conditional probability calculator builds a full probability tree from P(A), P(B | A) and P(B | not A) – or from P(A), P(B) and P(A and B) – and returns P(A | B), P(A | not B), every joint probability and the total probability of B.

%
%
%
P(A | B)
48.9247 %
Probability tree
P(A | not B)
0.4961 %
P(not A | B)
51.0753 %
P(not A | not B)
99.5039 %
P(B)
9.3 %
P(not B)
90.7 %
P(A and B)
4.55 %
P(A and not B)
0.45 %
P(not A and B)
4.75 %
P(not A and not B)
90.25 %
P(not A)
95 %
P(B | A)
91 %
P(not B | A)
9 %
P(B | not A)
5 %
P(not B | not A)
95 %
Are A and B independent?
No – P(B | A) = 0.91 but P(B | not A) = 0.05

A conditional probability is the chance of one event once you know another has happened. P(A | B) restricts attention to the outcomes where B occurred and asks what share of them also have A. The defining formula is P(A | B) = P(A and B) ÷ P(B).

In practice you rarely know P(A and B) and P(B) directly. You usually know how likely A is, and how likely B is in each branch: a test result given disease and given no disease, a defect rate for each of two machines, or rain chances for each type of morning. The calculator draws this as a two-level tree, multiplies along each branch to get the four joint probabilities and adds the branches that end in B to get P(B). Reversing the conditioning then gives P(A | B), P(A | not B) and their complements.

If you already have P(A), P(B) and the overlap P(A and B), choose the second mode: the calculator fills in the same tree from those numbers and also tells you whether the events are independent.

How to use the Conditional Probability Calculator

  1. What do you know?
  2. P(A)
  3. P(B | A)
  4. P(B | not A)
  5. P(A)
  6. P(B)
  7. P(A and B)

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Each leaf of the tree is the product of the probabilities on its path. P(B) is the sum of the leaves that end in B. Dividing a leaf by P(B) or P(not B) turns it into a reverse conditional probability (Bayes’ rule).

Worked example

5% of a population is infected. A test is positive for 91% of infected people and for 5% of healthy people (95% specificity). Joint probabilities: infected and positive = 0.05 × 0.91 = 0.0455; healthy and positive = 0.95 × 0.05 = 0.0475. P(positive) = 0.0930. P(infected | positive) = 0.0455 ÷ 0.0930 = 48.92%. A negative result leaves P(infected | negative) = 0.0045 ÷ 0.907 = 0.50%.

Reading the tree

The first fork splits on A, the second on B. The four numbers on the right are the joint probabilities and always add to 100%. To reverse the conditioning, pick the leaves that end in the event you observed and see what share of them came through the A branch.

Formula

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

Worked example

Inputs — What do you know?: P(A), P(B | A) and P(B | not A); P(A): 5 %; P(B | A): 91 %; P(B | not A): 5 %.
Results — P(A | B) = 48.9247 %; P(A | not B) = 0.4961 %; P(not A | B) = 51.0753 %; P(not A | not B) = 99.5039 %; P(B) = 9.3 %; P(not B) = 90.7 %.

Key terms

Conditional probability
The probability of an event given that another event has occurred, P(A | B).
Joint probability
The probability that two events both occur, P(A and B).
Marginal probability
The probability of one event on its own, such as P(B), found by adding branches.
Independence
Knowing one event does not change the probability of the other.

Frequently asked questions

How do you calculate conditional probability?

Divide the probability of both events by the probability of the condition: P(A | B) = P(A and B) ÷ P(B). With P(A and B) = 18% and P(B) = 30%, P(A | B) = 60%.

Is P(A

B) the same as P(B | A)? | No. In the medical example P(positive | infected) = 91% but P(infected | positive) is only 48.92%.

How do I know if two events are independent?

They are independent when P(B | A) = P(B | not A) = P(B), or equivalently P(A and B) = P(A) × P(B).

What is a probability tree?

A diagram whose first branches split on A and whose second branches split on B. Multiplying along a path gives a joint probability, and all leaves add to 1.

What is the law of total probability?

P(B) = P(A)P(B | A) + P(not A)P(B | not A) – the chance of B averaged over both branches.

Can a conditional probability be larger than P(A)?

Yes. If B is evidence for A, P(A | B) exceeds P(A); in the example a positive test raises 5% to 48.92%.

Sources

  1. OpenStax – Introductory Statistics 2e, Chapter 3: Probability topics
  2. Penn State STAT 414 – Introduction to Probability Theory
  3. Khan Academy – Statistics and probability

Cite this calculator

Speedy Calculator. (2026). Conditional Probability Calculator. Speedy Calculator. https://speedycalculator.com/calculators/statistics/conditional-probability/