Bayes' Theorem Conditional Probability Calculator

Update your likelihood model in real time. Enter a prior, sensitivity, and false positive rate - and instantly see the posterior probability with a plain-English frequency translation.

Bayesian Probability Engine
Input Format

Prior Probability P(A)
1.00%
The baseline chance the event is true before any test or evidence.
Sensitivity / True Positive Rate P(B|A)
90.00%
The probability the test is positive when the condition IS present.
False Positive Rate P(B|~A)
9.00%
The probability the test is positive when the condition is ABSENT.
Posterior Probability P(A|B)
--
Chance the condition is present given a positive result
Evidence Probability P(B)
--
Overall positive test rate in the population
Specificity
--
True Negative Rate (1 - False Positive Rate)
Natural Frequency Translator - Out of 10,000 Cases

Enter values above to see a plain-English translation.

P(A|B) = P(B|A) x P(A) / P(B)
Specificity vs. False Positive Rate: Cheat Sheet

Medical students frequently confuse these two terms when setting up Bayesian equations. They are not independent - they are two sides of the same coin.

Key insight: Specificity is simply 100% minus the False Positive Rate. If a test has a 9% false positive rate, its specificity is 91%. You only ever need one of the two values - the other is always implied.
Metric What it measures Formula Bayes input?
Sensitivity How well the test catches real cases (true positive rate) TP / (TP + FN) P(B|A) - direct input
Specificity How well the test clears innocent cases (true negative rate) TN / (TN + FP) Indirect - convert to FPR first
False Positive Rate Fraction of healthy cases that test positive 1 - Specificity P(B|~A) - direct input
False Negative Rate Fraction of real cases missed by the test 1 - Sensitivity Not used directly
Positive Predictive Value Probability the condition is present given a positive test TP / (TP + FP) This IS the posterior P(A|B)
Key Terms Explained
Bayes' Theorem
A mathematical formula for updating the probability of a hypothesis when new evidence arrives. It connects prior belief, the likelihood of the evidence, and the resulting posterior belief.
Prior Probability P(A)
Your initial estimate of the probability of an event before any new evidence is considered. Also called the base rate. This is the starting point for Bayesian reasoning.
Posterior Probability P(A|B)
The updated probability of an event after accounting for new evidence. The output of Bayes' Theorem. Read as "the probability of A given that B occurred."
Sensitivity (True Positive Rate)
The probability that a test returns a positive result when the condition is genuinely present. A test with 90% sensitivity correctly identifies 90 out of every 100 true cases.
Specificity (True Negative Rate)
The probability that a test returns a negative result when the condition is genuinely absent. Equals 1 minus the false positive rate. High specificity means few false alarms.
False Positive Rate P(B|~A)
The probability that a test returns a positive result even when the condition is absent. Even a small false positive rate can dominate the results when the condition is rare.
False Negative
A test result that incorrectly indicates the condition is absent when it is actually present. Equals 1 minus sensitivity. High false negative rates are dangerous in diagnostic settings.
Base Rate Fallacy
The cognitive error of ignoring the prior probability of an event when evaluating evidence. People who forget the base rate wildly overestimate the meaning of a positive test for a rare condition.
Conditional Probability
The probability of an event given that another event has already occurred, written P(A|B). Bayes' Theorem is a formula for computing conditional probabilities from known quantities.
Likelihood Ratio
The ratio of the probability of the evidence given the hypothesis is true, to the probability of the evidence given the hypothesis is false. A high likelihood ratio means the evidence strongly supports the hypothesis.

The Complete Guide to Bayesian Probability

You just got a positive result on a medical test. The test is 99% accurate. Does that mean you almost certainly have the condition? Probably not - and Bayes' Theorem is the mathematical proof of why. This guide walks through the logic, the formula, and the real-world scenarios where Bayesian thinking changes everything.

How to Use This Calculator

Start by selecting a scenario preset or choosing "Custom Model" to enter your own values. Use the format toggle to switch between percentage, decimal, and per-1000-frequency inputs - the calculator converts all three to decimals before running the math, so you will never get a percentage-squared error.

Move the sliders or type directly into the number fields. Results update with every keystroke. The Posterior Probability box shows the key output: the probability the condition is present given a positive result. The Natural Frequency Translator below it converts the abstract math into a concrete count across 10,000 hypothetical cases.

Understanding the Three Core Inputs

The Prior Probability P(A) is the prevalence of the condition in the population you are sampling from. This is often the most important number, and the one people most frequently forget. A disease that affects 1 in 10,000 people has a prior of 0.01%.

Sensitivity P(B|A) is the test's ability to detect real cases. A 90% sensitivity means it catches 9 out of 10 true positives. The remaining 1 in 10 is a false negative.

The False Positive Rate P(B|~A) is the probability the test fires incorrectly on a healthy sample. Even a 1% false positive rate can overwhelm a true positive signal when the condition is rare, because the pool of healthy people is so much larger than the pool of sick people.

The Bayes' Theorem Formula Step by Step

Step 1 - Standardize all inputs to decimals between 0 and 1. If you input 1.5%, the engine works with 0.015. This prevents the classic percentage-squared error.

Step 2 - Compute the probability of a positive test in the whole population. This is called P(B): P(B) = (Sensitivity x Prior) + (FPR x (1 - Prior)).

Step 3 - Compute the posterior: P(A|B) = (Sensitivity x Prior) / P(B). This is the probability the condition is truly present given the positive test. In most real-world screening scenarios this number is far lower than people expect.

Why This Matters: The Rare Disease Paradox

Suppose a disease affects 0.1% of the population. Your test has 99% sensitivity and a 5% false positive rate. Bayes' Theorem gives a posterior of about 1.9%. That means roughly 98% of positive results are false alarms, even with a test that feels highly accurate. This is not a flaw in the test - it is a mathematical consequence of the low base rate.

Public health screening programs, airport security screening, and drug testing all face this exact problem. A test that feels effective in isolation can generate enormous false-positive burdens when applied to low-prevalence populations at scale.

Spam Filtering and Machine Learning Applications

A Naive Bayes spam classifier assigns a prior probability to every incoming email (roughly 40-70% of all email is spam globally). It then updates that prior using the likelihoods of individual word frequencies derived from training data. The posterior probability for each email either exceeds a threshold (mark as spam) or does not (allow through). This exact Bayesian update cycle - prior, evidence, posterior - runs millions of times per day across every major email service.

Frequently Asked Questions

The base rate fallacy occurs when people ignore the prior probability (base rate) of an event and focus only on new evidence. For example, a test that is 99% accurate for a disease affecting 1 in 10,000 people will still produce far more false positives than true positives, because the base rate is so low. Bayesian reasoning forces you to account for this prior probability before drawing conclusions from test results.
When a disease is very rare, even a highly accurate test produces more false positives than true positives. If only 1 in 1,000 people have a condition, and your test has a 1% false positive rate, then out of 1,000 people tested, roughly 10 will falsely test positive while only 1 truly has the condition. That means about 91% of positive results are false alarms, despite the test being 99% accurate in absolute terms.
Spam filters use a Naive Bayes classifier to compute the probability that an email is spam given the words it contains. The prior probability is the general rate of spam in your inbox. The likelihood is how often certain words appear in known spam versus legitimate email. The posterior probability tells the filter how likely the new email is spam given its specific word combination. Machine learning pipelines use this same pattern for classification, anomaly detection, and medical diagnosis.
Prior probability is your belief about an event before seeing any new evidence. For example, a 1% chance that a random person has a particular disease. Posterior probability is your updated belief after incorporating new evidence, such as a positive test result. Bayes' Theorem is the mathematical rule that converts a prior probability into a posterior probability by weighting the new evidence against how likely that evidence was in the first place.
Sensitivity measures how good a test is at catching real cases. Specificity measures how good it is at clearing innocent cases. The false positive rate equals 1 minus specificity. A test can have perfect sensitivity but low specificity, causing it to flag many healthy people as sick. Both values interact with the base rate: a test with 95% specificity in a population where only 1 in 1,000 people have the condition will still return roughly 50 false positives for every true positive.