Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Conditional Probability Calculator

How to use Conditional Probability Calculator
  1. Click a preset button, Medical Test, Email Spam, Weather Prediction or Marketing Response, to load its four counts and labels; Custom keeps the numbers and drops the preset's note. Learn more about the presets
  2. Type your own names in Condition Name and Outcome Name; every header, formula and box relabels at once. Learn more about the labels
  3. Edit the four counts in the Frequency Table; the totals, the joint probabilities under the counts and every percentage update as you type. Learn more about the frequency table
  4. Read the second table, Conditional Probabilities Given the condition: each row is one condition and sums to 100%. Learn more about the conditional table
  5. Read the four Conditional Probability Calculations boxes: the formula, the fraction and the percentage for both directions of conditioning. Learn more about the calculation boxes
  6. Compare a row-conditioned box with its column-conditioned partner to see that P(B|A) and P(A|B) differ. Learn more about row and column conditioning
  7. Read the panel on the right: the reading rules, then the note that interprets the active preset. Learn more about the panel
Frequency Table (Counts)
Test+No Test+Total
Disease
0.0095
0.0005
100
No Disease
0.0495
0.9405
9900
Total590941010000
Conditional Probabilities Given Disease
Given ConditionTest+No Test+Total
Disease
95.0%
P(Test+|Disease)
5.0%
P(No Test+|Disease)
100%
No Disease
5.0%
P(Test+|No Disease)
95.0%
P(No Test+|No Disease)
100%
Conditional Probability Calculations
P(Test+ | Disease)
= 95 / 100
95.0%
P(Test+ | No Disease)
= 495 / 9900
5.0%
P(Disease | Test+)
= 95 / 590
16.1%
P(No Disease | Test+)
= 495 / 590
83.9%

Understanding the Results

Key Insight: Conditional probability focuses on a subset of the data. When we calculate P(B|A), we only look at the rows/columns where A occurred.

How to read contingency tables for conditional probability: P(Outcome | Condition) Look at the condition row, divide the intersection by the row total. P(Condition | Outcome) Look at the outcome column, divide the intersection by the column total. The intersection cell represents both events happening together. Marginal totals show the unconditional probabilities. Learn more about conditional probability
Medical Test Interpretation: Even with a 95% accurate test, a positive result only gives 16.1% chance of actually having the disease. This is because the disease is rare (1% prevalence), so most positive tests are false positives.








Selecting Preset Scenarios

DemoTwo presets, then Custom
Step 0 of 3
The calculator provides four preset scenarios demonstrating common conditional probability applications. Medical Test shows disease diagnosis with test results: 9595 of 100100 patients with the disease test positive, but so do 495495 of the 9,9009{,}900 without it. Email Spam relates the word "ASAP" to spam among 1,0001{,}000 emails. Weather Prediction relates cloudy mornings to rain over 365365 days, and Marketing Response relates ad clicks to purchases among 10,00010{,}000 visitors. Click any scenario button to instantly load its frequency data, condition names, and outcome labels; the active button is highlighted, and a note at the bottom of the right-hand panel interprets the scenario.

The Custom button keeps the numbers on screen but drops the preset's interpretation note, so you can enter your own frequencies and labels without a note that no longer fits. After loading a preset, you can still modify individual cell values to explore variations. Preset scenarios serve as starting points for understanding how conditional probabilities work in real contexts.

For the Medical Test preset the calculation boxes read 95.0%95.0\%, 5.0%5.0\%, 16.1%16.1\% and 83.9%83.9\%; for Email Spam they read 83.3%83.3\%, 21.3%21.3\%, 20.0%20.0\% and 80.0%80.0\%, and for Weather Prediction 80.0%80.0\%, 37.2%37.2\%, 60.0%60.0\% and 40.0%40.0\%. What the boxes compute is explained in What is Conditional Probability?.

Understanding the Frequency Table

DemoEditing the top-left count of the Medical Test preset
Step 0 of 3
The frequency table displays a 2×2 contingency table showing counts for all four possible outcome combinations. Rows represent whether the condition occurred (Disease/No Disease, Red Card/Black Card, etc.). Columns represent whether the outcome occurred (Test+/Test-, Heart/Other, etc.).

Each cell contains an editable input field showing the frequency count for that combination. Below each count, a small probability displays the joint probability: the cell count divided by grand total. The highlighted intersection cell (top-left) represents both events occurring together—the numerator for most conditional probability calculations.

Row totals appear in the rightmost column, showing total occurrences for each condition. Column totals appear in the bottom row, showing total occurrences for each outcome. The bottom-right cell shows the grand total—the sum of all four cells and the denominator for unconditional probabilities.

A cell takes a non-negative whole number; a cleared cell counts as 00 and every total and percentage updates as you type. For the Medical Test preset the grand total is 10,00010{,}000, the row totals 100100 and 9,9009{,}900, the column totals 590590 and 9,4109{,}410, and the top-left joint probability 0.00950.0095; typing 5050 into the top-left cell changes the row total to 5555, the grand total to 9,9559{,}955 and the joint probability to 0.00500.0050. The layout of such a table is explained in Understanding Contingency Tables.

Reading Conditional Probability Tables

DemoRow percentages of three presets
Step 0 of 3
The second table converts frequency counts to conditional probabilities normalized by row. Each row sums to 100%, showing the distribution of outcomes given a specific condition. For medical tests, the top row shows P(Test+|Disease) and P(Test-|Disease)—the test's performance when disease is present.

The percentages answer "Given this row's condition, what's the probability of each outcome?" The formula appears below each percentage, like "P(Test+|Disease)" to clarify what's being calculated. This table demonstrates how conditioning restricts attention to a subset of cases.

Compare across rows to see how outcome probabilities change with different conditions. If P(Outcome|Condition) differs substantially from P(Outcome|No Condition), the condition and outcome are dependent. If probabilities stay similar, the events are approximately independent.

For the Medical Test preset the rows read 95.0%95.0\% and 5.0%5.0\%, then 5.0%5.0\% and 95.0%95.0\%; for Marketing Response they read 24.0%24.0\% and 76.0%76.0\%, then 0.8%0.8\% and 99.2%99.2\%; for Weather Prediction 80.0%80.0\% and 20.0%20.0\%, then 37.2%37.2\% and 62.8%62.8\%. Why each row sums to one is explained in What is Conditional Probability?.

Customizing Labels and Values

DemoNew labels, then a new count
Step 0 of 3
The label inputs above the tables let you customize condition and outcome names. Change "Disease" to "Diabetes" or "Test+" to "Positive Result" to match your specific scenario. Labels update throughout all tables and calculation boxes instantly.

Click any cell in the frequency table to edit its value. Enter non-negative integers representing counts from your data. As you type, all dependent calculations update automatically: row and column totals, joint probabilities, conditional probabilities, and the calculation boxes below.

Use the Custom scenario when your data doesn't match presets. Enter your four cell frequencies, name your condition and outcome, and the calculator computes all relevant probabilities. This flexibility supports analysis of any 2×2 categorical data: survey responses, experimental results, observational studies, or theoretical problems.

Typing "Diabetes" as the condition name and "Positive" as the outcome name relabels every header, formula and calculation box at once; typing 190190 into the top-left cell of the Medical Test preset then gives P(Positive∣Diabetes)=190/195=97.4%P(\text{Positive} \mid \text{Diabetes}) = 190 / 195 = 97.4\% and P(Diabetes∣Positive)=190/685=27.7%P(\text{Diabetes} \mid \text{Positive}) = 190 / 685 = 27.7\%. How the four cells define the table is explained in Understanding Contingency Tables.

Interpreting Calculation Boxes

DemoThe four boxes for two presets, then fewer false positives
Step 0 of 3
Four calculation boxes below the tables show the most common conditional probabilities with full formulas. Each box displays the conditional probability notation, the arithmetic (numerator/denominator), and the final percentage.

P(Outcome|Condition) divides the intersection cell (both events true) by the condition row total. This answers "Given the condition, what's the outcome probability?" For medical tests, this is sensitivity: P(Test+|Disease).

P(Outcome|No Condition) divides the opposite intersection by the no-condition row total. For medical tests, this is the false positive rate: P(Test+|No Disease).

P(Condition|Outcome) divides the intersection by the outcome column total. This reverses the conditioning direction. For medical tests, this is positive predictive value: P(Disease|Test+)—the crucial probability for interpreting positive results.

P(No Condition|Outcome) completes the set, showing how often the outcome occurs without the condition. These four probabilities provide comprehensive insight into the relationship between condition and outcome.

Each box shows the fraction it divides, so the numbers can be checked against the tables: for Email Spam, 50/60=83.3%50 / 60 = 83.3\%, 200/940=21.3%200 / 940 = 21.3\%, 50/250=20.0%50 / 250 = 20.0\% and 200/250=80.0%200 / 250 = 80.0\%; for Medical Test, 95/10095 / 100, 495/9,900495 / 9{,}900, 95/59095 / 590 and 495/590495 / 590. Lowering the false positives of the Medical Test preset from 495495 to 55 raises P(Disease∣Test+)P(\text{Disease} \mid \text{Test+}) to 95/100=95.0%95 / 100 = 95.0\%: a rare false positive makes a positive result convincing. The definition behind every box is in What is Conditional Probability?.

Using Row vs Column Conditions

DemoRow against column conditioning in three presets
Step 0 of 3
Conditional probability direction matters critically. P(B|A) asks "Given A occurred, what's the probability of B?" while P(A|B) asks "Given B occurred, what's the probability of A?" These probabilities are generally different and answer different questions.

Row conditioning uses row totals as denominators. Look at the condition row, divide the intersection by the row total. The conditional probability table computes this automatically for each row. Row percentages sum to 100% across each row.

Column conditioning uses column totals as denominators. Look at the outcome column, divide the intersection by the column total. The calculation boxes show examples: P(Condition|Outcome) uses column totals. Column percentages would sum to 100% down each column.

Understanding which direction to condition is essential. Medical diagnosis requires P(Disease|Test+), not P(Test+|Disease). The former uses column totals, the latter uses row totals. The calculator provides both to clarify the distinction.

In the Weather Prediction preset, row conditioning gives P(Rain∣Cloudy)=120/150=80.0%P(\text{Rain} \mid \text{Cloudy}) = 120 / 150 = 80.0\% while column conditioning gives P(Cloudy∣Rain)=120/200=60.0%P(\text{Cloudy} \mid \text{Rain}) = 120 / 200 = 60.0\%; in Marketing Response, P(Purchase∣Clicked)=24.0%P(\text{Purchase} \mid \text{Clicked}) = 24.0\% against P(Clicked∣Purchase)=60.0%P(\text{Clicked} \mid \text{Purchase}) = 60.0\%; in Medical Test, 95.0%95.0\% against 16.1%16.1\%. The two directions are defined in What is Conditional Probability?, and reversing them is the subject of Bayes' theorem.

The Understanding the Results Panel

DemoThe panel note for a preset, for Custom, and back
Step 0 of 3
The box on the right of the tables, Understanding the Results, has two parts. The upper part is fixed: a key insight on what conditioning means, and four reading rules, one for P(Outcome∣Condition)P(\text{Outcome} \mid \text{Condition}) (divide the intersection by its row total), one for P(Condition∣Outcome)P(\text{Condition} \mid \text{Outcome}) (divide it by its column total), one for the intersection cell and one for the marginal totals. It ends with a link to the section of this page that explains conditional probability.

The lower part is a note on the active preset, headed with its name, for example "Medical Test Interpretation", which puts the numbers of the boxes into words: a positive test raises the chance of the disease only to 16.1%16.1\% because the disease is rare. The note changes when you click another preset and disappears when you click Custom or edit the numbers of a preset after choosing Custom; the reading rules stay. Read the note together with the calculation boxes: it names the probabilities the boxes compute. The definition it relies on is in What is Conditional Probability?.

What is Conditional Probability?

Conditional probability measures the likelihood of an event given that another event has occurred. Notation P(B|A) reads "probability of B given A" and equals the fraction of A-outcomes where B also occurs. Mathematically: P(B∣A)=P(A∩B)P(A)P(B|A) = \frac{P(A \cap B)}{P(A)}.

The denominator restricts attention to the subset where A occurred. The numerator counts how often B occurs within that subset. This ratio ranges from 0 (B never occurs with A) to 1 (B always occurs with A). Values between indicate partial dependence.

Conditioning updates probabilities based on partial information. Without conditioning, P(B) uses the entire sample space. With conditioning on A, P(B|A) uses only the portion where A occurred. If A provides information about B, these probabilities differ. If A tells nothing about B (independence), they're equal.

For comprehensive theory on conditional probability including derivations, properties, and applications, see conditional probability theory.

The formula is derived in The formula and pictured in Visualising conditioning; worked cases are in Examples, and the case where conditioning changes nothing is Independence.

Understanding Contingency Tables

A contingency table cross-tabulates frequencies for two categorical variables, organizing data into rows and columns. Each cell shows how many observations satisfy both the row category and column category. Row and column totals (marginals) show unconditional frequencies for each category.

2×2 tables handle binary variables: Yes/No, Success/Failure, Present/Absent. Larger tables accommodate more categories, but the principle remains: cross-classify observations and count cell frequencies. Joint probabilities come from dividing each cell by the grand total.

Contingency tables reveal relationships between variables. If variables are independent, knowing one provides no information about the other—cell frequencies match what you'd expect from marginal totals alone. Dependence appears as departures from expected frequencies, indicating the variables relate.

The table structure makes conditional probability calculations transparent. Row percentages show outcome distributions given each condition. Column percentages show condition distributions given each outcome. This visual organization clarifies the conditioning subset and normalization.

Tables of this kind are introduced in Joint probability tables; the totals are the marginal probabilities, and the step from a cell to a conditional probability is in From joint to conditional.