🎲
✓ Editorially reviewed by Derek Giordano, Founder & Editor · BA Business Marketing

Bayes' Theorem Calculator

Posterior Probability from Priors & Evidence

Updated October 2026

P(A|B) = P(B|A) × P(A) ÷ P(B). A test that is 99% sensitive and 95% specific, for a condition 1% of people have: of 10,000 people, 99 of 100 sick people test positive and 495 of 9,900 healthy people also do, so a positive result means only 99 ÷ 594 = 16.7% chance of having the condition. Low base rates make false positives dominate.
🧮
500+ calculators, no signup required
Finance · Health · Math · Science · Business
nnng.com

What Bayes' Theorem Does

Bayes' theorem tells you how to update a probability when new evidence arrives. You start with a prior — your belief before the evidence — and combine it with how informative the evidence is, to get a posterior: the updated probability. This calculator takes the prior probability of an event, the chance the evidence shows up when the event is true (the true positive rate), and the chance it shows up when the event is false (the false positive rate), and returns the revised probability. It's the mathematical core of rational belief-updating, used in medicine, spam filtering, and machine learning.

The everyday version of the question is: "Given a positive test, what's the chance I actually have the condition?" That's not the same as the test's accuracy, and the gap between the two is where intuition famously fails.

Why the Result Surprises People

The classic example: a disease affects 1% of people, a test catches 90% of real cases, and it has a 9% false positive rate. If you test positive, most people guess your chance of having the disease is around 90%. The actual answer is about 9%. The reason is the rare prior — because so few people have the disease, the false positives from the huge healthy majority swamp the true positives from the tiny sick minority. This calculator makes that effect concrete, breaking out the true and false positives so you can see where the number comes from.

The Role of the Base Rate

The prior probability — often called the base rate — does enormous work in the result, and ignoring it is such a common error it has a name: the base rate fallacy. A test result has to be weighed against how common the thing was to begin with. The rarer the condition, the more a single positive should be treated with caution, and the more it takes a very specific test to move the probability meaningfully. If you work with raw probabilities, our general probability calculator covers the basics.

Beyond Medical Tests

Although the disease-testing framing is the clearest illustration, the same math governs any evidence-and-hypothesis pair: an email and the chance it's spam, a security alert and the chance of a real breach, a search result and the chance it's relevant. In every case Bayes' theorem combines a base rate with the reliability of the signal. The structure is identical; only the labels change.

A Fully Worked Example

The most instructive way to see Bayes' theorem at work is a second example with different numbers, because the surprise it produces is so persistent. Suppose a particular cancer affects 0.5% of a screening population. A mammogram detects 90% of real cancers (its sensitivity, the true positive rate) but also returns a positive result for 8% of healthy women (its false positive rate). A woman receives a positive result. What is the actual probability she has cancer? Intuition usually lands somewhere near 90%, anchored on the test's detection rate. The real answer is far lower, and working it through shows why.

Bayes' theorem asks you to compare two groups of positive results: the true positives and the false positives. Out of every 10,000 women screened, the 0.5% prevalence means about 50 actually have cancer. The test catches 90% of them, producing roughly 45 true positives. The other 9,950 women are healthy, but the 8% false positive rate means about 796 of them also test positive. So among everyone who receives a positive result, the total is 45 + 796 = 841 positives, of whom only 45 genuinely have cancer. The probability of cancer given a positive test is therefore 45 ÷ 841 ≈ 0.0535, or about 5.4%.

That figure — a positive result on a 90%-sensitive test corresponding to only a 5.4% chance of disease — is not a trick or an error. It is the correct consequence of a rare condition. Because cancer is uncommon in the screened population, the enormous pool of healthy women generates far more false positives in raw numbers than the small pool of sick women generates true positives, even though the test is individually accurate. The calculator performs this same comparison instantly: enter 0.5 for the prior, 90 for the sensitivity, and 8 for the false positive rate, and it returns the posterior probability along with the underlying true-positive and false-positive breakdown.

The Base Rate and Why It Dominates

The lesson buried in that example is the single most important idea in interpreting evidence: the base rate, or prior probability, does enormous work in the final answer, and ignoring it is such a common error that it has a name — the base rate fallacy. A test result cannot be read in isolation; it must be weighed against how common the condition was to begin with. The rarer the condition, the more a single positive should be treated as a reason for further testing rather than a conclusion. This is precisely why medical guidelines often call for a confirmatory second test after an initial positive screen: the follow-up updates the probability again, and a second independent positive raises it substantially.

The same structure governs far more than medicine. A spam filter weighs the base rate of spam against how strongly a particular word or pattern indicates junk mail. A fraud detection system balances the rarity of genuine fraud against the suspiciousness of a transaction — and because fraud is rare, even a good detector generates many false alarms for every real catch, which is why flagged transactions are reviewed rather than automatically blocked. A security alert, a diagnostic warning light, a positive result on any rare-event test: all of them combine a base rate with the reliability of a signal, and all of them produce the same counterintuitive result when the base rate is low.

Two practical habits follow from this. First, when you encounter a test result, ask not only "how accurate is the test?" but "how common is the thing it is testing for?" — the two questions have different answers and the second is usually the more decisive. Second, recognize that the posterior probability the calculator gives you is itself a new prior. If a second piece of independent evidence arrives, you feed that updated probability back in and update again, which is exactly how rational belief accumulates as evidence mounts. For working with the underlying probabilities directly, the general probability calculator covers single and combined events, and the statistics calculator handles the descriptive figures behind a dataset.

What is Bayes' theorem in simple terms?
Bayes' theorem is a rule for updating a probability when new evidence arrives. You start with a prior — your belief before the evidence — and combine it with how reliable the evidence is to get a posterior, the revised probability. It’s the mathematical foundation of rational belief-updating.
Why is the answer so much lower than the test accuracy?
Because of the base rate. When a condition is rare, the false positives from the large healthy majority outnumber the true positives from the small affected minority. So even an accurate test produces a low probability of actually having the condition after a single positive result — the prior dominates.
What is the base rate fallacy?
It’s the common error of ignoring how common something is to begin with when interpreting evidence. A positive test must be weighed against the prior probability — the base rate. Forgetting this leads people to dramatically overestimate the chance of a rare condition after a positive result.
What is the difference between the prior and the posterior?
The prior is the probability before you see the evidence — the starting base rate. The posterior is the updated probability after combining the prior with the evidence. Bayes’ theorem is the formula that turns one into the other, and the calculator reports both.
What do sensitivity and false positive rate mean?
Sensitivity (the true positive rate) is the chance the evidence appears when the event is genuinely true — how well a test catches real cases. The false positive rate is the chance the evidence appears when the event is false — how often it raises a false alarm. Both are needed to update the probability correctly.
Where is Bayes' theorem used besides medicine?
The same math governs any evidence-and-hypothesis pair: whether an email is spam, whether a security alert signals a real breach, or whether a search result is relevant. It’s also central to machine learning. The disease-test example is just the clearest illustration of a very general rule.

How to Use This Calculator

  1. Enter the prior probability P(A) — Input how likely the event is before any evidence — the base rate — as a percentage.
  2. Enter the true positive rate P(B|A) — Input the sensitivity: the chance the evidence appears when the event is genuinely true, as a percentage.
  3. Enter the false positive rate P(B|¬A) — Input the chance the evidence appears when the event is false — the false alarm rate, as a percentage.
  4. Read the posterior probability — The calculator returns P(A|B), the updated probability, and breaks out the true and false positives behind it.

Tips and Best Practices

Pay close attention to the prior — the base rate does most of the work in the result, and ignoring it is the single most common Bayesian mistake.

The lower the prior, the more cautiously you should treat a single positive result, because false positives come to dominate.

The posterior is not the test’s accuracy. "How accurate is the test" and "given a positive, what’s my chance" are different questions with different answers.

This same structure applies far beyond medicine — spam filters, fraud alerts, and search relevance all use the identical prior-plus-evidence logic.

📚 Sources & References
  1. [1] Stanford Encyclopedia of Philosophy ""Bayes’ Theorem."" Stanford University. plato.stanford.edu
  2. [2] Khan Academy ""Conditional probability and Bayes’ theorem."" Khan Academy. khanacademy.org
  3. [3] Weisstein, Eric W. ""Bayes’ Theorem."" Wolfram MathWorld. mathworld.wolfram.com
  4. [4] National Library of Medicine ""Bayes’ Theorem and diagnostic testing."" NCBI. ncbi.nlm.nih.gov
✅ Editorial Standards — Every calculator is built from peer-reviewed formulas and official data sources, editorially reviewed for accuracy, and updated regularly. Read our full methodology · About the author