Skip to main content
statistics

Conditional Probability Calculator

Calculate the conditional probability P(A|B) using Bayes' theorem and the definition of conditional probability. Essential for medical testing, risk assessment, and Bayesian inference in statistics.

Reviewed by Christopher FloiedPublished Updated

This free online conditional probability calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Joint probability that both events A and B occur together.

Probability of event B occurring (the conditioning event). Must be greater than 0.

Probability of event A occurring (used for Bayes' theorem calculation).

Results

P(A|B)

0.3

P(B|A)

0.4

Bayes Verification

0.4

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Conditional Probability Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Conditional Probability Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

When to Use This Calculator

  • Use the Conditional Probability Calculator when you need accurate results quickly without the risk of manual computation errors or unit conversion mistakes.
  • Use it to verify calculations made by hand or in spreadsheets — an independent check can catch errors before they lead to costly decisions.
  • Use it to explore how changing input parameters affects the output — a quick way to develop intuition and identify the most influential variables.
  • Use it when collaborating with others to ensure everyone is working from the same numbers and applying the same assumptions.

About Conditional Probability Calculator

The conditional probability calculator computes the likelihood of an event A occurring given that another event B has already occurred. This concept is the cornerstone of Bayesian reasoning and is critical in fields ranging from medical diagnostics to spam filtering and courtroom evidence evaluation. When a doctor receives a positive test result, the relevant question is not how accurate the test is in general but how likely the patient actually has the disease given the positive result -- that is P(Disease|Positive). This calculator uses the fundamental definition P(A|B) = P(A and B) / P(B) and also provides the reverse conditional probability via Bayes' theorem, enabling you to update beliefs as new evidence arrives.

The Math Behind It

Conditional probability formalizes the intuition that learning new information changes the likelihood of events. The definition P(A|B) = P(A and B) / P(B) restricts the sample space to only those outcomes where B occurs, then measures the fraction of that restricted space where A also occurs. Bayes' theorem, derived directly from this definition, states P(A|B) = P(B|A) * P(A) / P(B). This seemingly simple equation has profound implications. In medical testing, P(A) is the prior probability (prevalence), P(B|A) is the sensitivity (true positive rate), and P(B) is the total probability of a positive test. When diseases are rare, even highly accurate tests can produce mostly false positives, a counterintuitive result known as the base-rate fallacy. The law of total probability, P(B) = P(B|A)*P(A) + P(B|not A)*P(not A), provides the denominator when it is not known directly. Conditional independence is another key concept: A and B are conditionally independent given C if P(A and B|C) = P(A|C)*P(B|C). This property underlies Naive Bayes classifiers in machine learning. Understanding conditional probability prevents common reasoning errors in legal proceedings (the prosecutor's fallacy), medical decisions, and risk management.

Formula Reference

Conditional Probability

P(A|B) = P(A and B) / P(B)

Variables: P(A|B) = probability of A given B; P(A and B) = joint probability; P(B) = probability of B

Bayes' Theorem

P(B|A) = P(A|B) * P(B) / P(A)

Variables: Reverses the conditioning direction using prior and marginal probabilities

Worked Examples

Example 1: Medical test accuracy

A disease has prevalence P(D) = 0.01. The test has sensitivity P(+|D) = 0.95 and false positive rate P(+|no D) = 0.05. What is P(D|+)?

Step 1:Calculate P(+) = P(+|D)*P(D) + P(+|no D)*P(no D) = 0.95*0.01 + 0.05*0.99 = 0.0095 + 0.0495 = 0.059.
Step 2:Apply Bayes: P(D|+) = P(+|D)*P(D) / P(+) = 0.0095 / 0.059 = 0.161.

Despite the 95% test sensitivity, there is only a 16.1% chance the patient actually has the disease after a positive result, because the disease is rare.

Example 2: Drawing cards sequentially

What is the probability of drawing two hearts in a row from a standard deck without replacement?

Step 1:P(first heart) = 13/52 = 0.25.
Step 2:P(second heart | first heart) = 12/51 = 0.2353.
Step 3:P(both hearts) = 0.25 * 0.2353 = 0.0588.

The conditional probability of the second heart is about 23.5%, and the joint probability is about 5.9%.

Common Mistakes & Tips

  • !Confusing P(A|B) with P(B|A) -- these are generally different values. This error is known as the confusion of the inverse.
  • !Ignoring the base rate (prior probability) when interpreting test results, leading to the base-rate fallacy.
  • !Forgetting that P(B) must be greater than 0 for conditional probability to be defined.
  • !Assuming conditional probability implies causation -- P(A|B) being high does not mean B causes A.

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

What is conditional probability used for?

Conditional probability is used whenever you need to update the likelihood of an event based on new information. Common applications include medical diagnosis (probability of disease given a test result), spam filtering, weather forecasting, insurance risk assessment, and quality control in manufacturing.

What is the difference between conditional probability and joint probability?

Joint probability P(A and B) measures the chance that both A and B occur together out of all possible outcomes. Conditional probability P(A|B) measures the chance of A occurring within the restricted universe where B has already occurred. The relationship is P(A|B) = P(A and B) / P(B).

Why do rare diseases produce so many false positives?

When a disease is rare (low base rate), the number of healthy people far exceeds the number of sick people. Even a small false positive rate applied to a large healthy population produces many false alarms, which can outnumber the true positives from the small sick population. This is why P(Disease|Positive) can be surprisingly low even with accurate tests.