Conditional Probability Calculator
Calculate P(A|B) — the probability of A given B — from probabilities or frequency counts.
P| What is Conditional Probability?
Conditional probability P(A|B) is the probability that event A occurs given that event B has already occurred. The vertical bar “|” is read as “given.” It restricts the sample space to only those outcomes where B is true, then measures the fraction of those where A is also true. The formula is: P(A|B) = P(A∩B) ÷ P(B), where P(A∩B) is the joint probability (both A and B occur) and P(B) is the marginal probability (B occurs regardless of A).
A critical warning: P(A|B) ≠ P(B|A) in general. This confusion — called the base rate fallacy or transposing the conditional — is extremely common. “The probability of a fire alarm ringing given there is a fire” is not the same as “the probability of a fire given the alarm is ringing.” A very sensitive alarm might ring for any smoke, so P(alarm | fire) = 95% but P(fire | alarm) might be only 3% in a building with many false alarms. Bayes’ theorem provides the rigorous way to go from one to the other.
Conditional probability is the foundation of Bayesian reasoning — the framework for updating beliefs in light of new evidence. Starting from a prior probability P(A), observing evidence B, and computing a posterior P(A|B) is the essence of rational belief update. This process appears everywhere: medical diagnosis (what is P(disease | symptoms)?), spam filtering (P(spam | keywords)), weather forecasting (P(rain | pressure, humidity)), and machine learning classifiers.
The 2×2 contingency table is the most natural way to compute conditional probability from real data. Rows represent one event (A, ¬A), columns represent another (B, ¬B), and cells hold observed counts. From the table, P(A|B) = count(A∩B) ÷ count(B) — the proportion of “B column” observations that also have A. This calculator supports both the formula-based approach (when you know the probabilities directly) and the frequency-based approach (when you have raw data).