The Bayes' theorem calculator above takes three numbers — a prior probability, a sensitivity, and a false positive rate — and returns the posterior probability that the hypothesis is true given that the evidence turned up. It is the single most misread calculation in applied statistics, because the answer is almost always far lower than intuition expects when the prior is small. The tool also shows the result as natural frequencies out of a reference population, which is the presentation format that reliably fixes that misreading.
Arb Digital built this page because the same reasoning error shows up constantly outside the classroom. An analyst sees a fraud filter with "95% accuracy" and assumes a flagged transaction is 95% likely to be fraud. A marketer sees a bot-detection score and treats a flag as proof. In both cases the correct answer depends on how rare the thing being detected actually is, and Bayes' theorem is the only way to get there. This calculator does the arithmetic and shows every intermediate quantity so you can see exactly where the intuition breaks down.
What This Bayes' Theorem Calculator Does
It performs prior-to-posterior updating for a single binary hypothesis and a single binary piece of evidence. You supply P(A), the probability the hypothesis is true before you look at anything; P(B|A), the probability the evidence appears if the hypothesis is true; and P(B|not A), the probability the evidence appears anyway when the hypothesis is false. The calculator returns P(A|B) — the updated belief after seeing the evidence — along with the total probability of the evidence, the posterior after a negative result, and the likelihood ratio that drives the whole update.
That is a different job from our probability calculator, which handles single, compound, and conditional event probabilities from scratch rather than revising an existing belief in light of new data. The boundary is simple: use the probability calculator to work out how likely an event is; use this page when you already have a probability and want to know what a test result should do to it.
How to Use It
- Enter the prior. This is the base rate — how common the condition, the fraud, the defect, or the outcome is in the population you are drawing from, before any evidence.
- Enter the sensitivity. The proportion of genuinely positive cases the test catches. A test that finds 90 of every 100 true cases has 90% sensitivity.
- Enter the false positive rate. If you know specificity instead, subtract it from 100. A 91% specific test has a 9% false positive rate.
- Set a reference population. Ten thousand is a good default because it turns awkward decimals into whole people, transactions, or units.
- Read the posterior, then read the frequency line. The percentage is the formal answer; the frequency sentence is the one that will actually change how you interpret it.
The Formula and How It's Calculated
Bayes' theorem states that P(A|B) = P(B|A) × P(A) ÷ P(B), where P(B) is the total probability of seeing the evidence from any source. That denominator is expanded using the law of total probability: P(B) = P(B|A)×P(A) + P(B|not A)×P(not A). Written out in full, the posterior is the true positive stream divided by the sum of the true positive and false positive streams.
Take the default values. A prior of 1% means 100 genuine cases in a population of 10,000. A sensitivity of 90% means the test flags 90 of those 100. The remaining 9,900 people do not have the condition, and a 9% false positive rate flags 891 of them. So 981 people test positive in total, and only 90 of them actually have the condition: 90 ÷ 981 = 9.17%. A test that sounds highly accurate produces a positive result that is wrong nine times out of ten, purely because the condition is rare. Nothing about the test changed — only the base rate.
The tool also reports the positive likelihood ratio, sensitivity divided by the false positive rate, which is 90 ÷ 9 = 10 here. Likelihood ratios are convenient because they act on odds rather than probabilities: prior odds of 1:99 multiplied by 10 give posterior odds of 10:99, which converts back to 9.17%. That odds form is how the calculation is usually done by hand, and it is why the last grid item shows how many times the evidence multiplied your odds. The NIST/SEMATECH e-Handbook of Statistical Methods covers the same machinery in its reliability chapters, where Bayesian updating is used to revise failure-rate estimates as test data arrives.
The Base Rate Fallacy, in Numbers
The base rate fallacy is the habit of judging a positive result by the accuracy of the test alone and ignoring how rare the thing is. It is not a failure of arithmetic — people who can do the arithmetic still make it, because the wrong answer feels obviously right. The clearest way to see the size of the error is to hold the test fixed and move only the prior.
With the default 90% sensitivity and 9% false positive rate, a prior of 0.1% gives a posterior near 1%. A prior of 1% gives 9%. A prior of 10% gives 53%. A prior of 50% gives 91%. The identical test result means "almost certainly a false alarm" in the first case and "almost certainly real" in the last. This is why screening a whole population and testing a group already selected for symptoms produce such different reliability from the same instrument, and why any claim of the form "this test is 95% accurate so a flag means 95%" is meaningless without the prevalence attached.
Sensitivity, Specificity and Why the Two Errors Are Not Symmetric
Sensitivity and specificity describe two separate failure modes and they trade against each other. Loosening a threshold catches more true cases and raises sensitivity, but it also flags more non-cases and lowers specificity. Tighten it and the reverse happens. Because the non-case group is usually far larger than the case group when the prior is low, a small drop in specificity does far more damage to the posterior than an equal-sized drop in sensitivity does.
Work it through with the defaults. Push sensitivity from 90% to 99% and the posterior only moves from 9.17% to 10.0%, because you were already catching nearly all of a very small group. Instead cut the false positive rate from 9% to 1% and the posterior jumps to 47.6%. When positives are rare, specificity is the lever that matters and sensitivity is close to spent. Anyone tuning a classifier threshold on imbalanced data is really tuning this ratio, and our confusion matrix calculator lays out the same four counts in the table form used in machine-learning evaluation.
Chaining Evidence: Two Tests in a Row
The posterior from one piece of evidence becomes the prior for the next. That is the property that makes Bayesian reasoning usable in sequence rather than as a one-off. Feed the 9.17% posterior from the default example back into the prior field and run the same test again: the answer climbs to just over 50%. A third independent positive would push it past 90%. Retesting works, and this is the arithmetic that explains why.
The critical word is independent. Chaining is only valid if the second piece of evidence fails in ways unrelated to the first. Running the same assay twice on the same sample, or two fraud rules that both key off the same IP field, will not deliver two genuine updates — the second test mostly repeats the first one's error. Treating correlated evidence as independent is the fastest way to end up with a confidently wrong posterior, and it is a far more common mistake in practice than getting the formula wrong. Penn State's STAT 500 course notes set out the conditional-probability rules that make this dependence explicit.
Reading the Negative Result
The grid also reports P(A|not B), the probability the hypothesis is still true after the evidence failed to appear. With rare conditions this number is reassuringly tiny — under the defaults it is about 0.11%, meaning a negative all but rules the condition out — and that asymmetry is worth noticing. When the prior is low, a negative result is highly informative and a positive result is barely informative at all. When the prior is high, the pattern reverses: a positive confirms what you already suspected and a negative is the surprising, informative outcome.
This is the practical reason screening programmes are designed around ruling things out rather than ruling them in, and why a positive screen is normally followed by a second, more specific confirmatory test rather than treated as a conclusion. The screen's job is to shrink the population cheaply; the confirmatory test's job is to survive a much higher prior.
Where Priors Come From When You Don't Have One
The hardest input on this page is usually the prior, because unlike sensitivity and specificity it rarely arrives on a spec sheet. Three sources are defensible. First, a measured base rate from your own historical data — the proportion of transactions last quarter that turned out to be fraudulent, for example. Second, a published population figure from an official statistics agency. Third, an explicit, stated assumption that you then stress-test by re-running the calculation across a range of plausible values.
That third approach is the honest one when data is thin. Run the tool at the low end and the high end of what you believe, and see whether the decision you were about to make changes. If the posterior stays under your action threshold across the whole plausible range, the uncertainty in the prior does not matter for this decision. If the answer flips somewhere in the middle, you have just learned that measuring the base rate properly is the most valuable next step you could take. Pairing that with our sample size calculator tells you how much data you would need to pin it down.
Arb Digital's analysts read conversion tests, attribution models, and audience signals the way this page reads a diagnostic test — base rate first, headline number second.
Browse All Free Tools Talk To Our TeamCommon Mistakes to Avoid
- Confusing P(B|A) with P(A|B) — the probability of a positive test given the condition is not the probability of the condition given a positive test, and the two can differ by an order of magnitude.
- Entering specificity in the false positive field — the false positive rate is 100 minus specificity, so a 95% specific test needs 5 typed here, not 95.
- Using a population prior for a selected group — people who present with symptoms, or transactions already flagged by an earlier rule, have a much higher prior than the general population.
- Treating correlated evidence as independent — chaining two tests that share a failure mode overstates the final posterior badly.
- Quoting a single "accuracy" percentage — overall accuracy hides the split between the two error types, and on imbalanced data a useless test can score 99% accuracy by always saying no.
Related Free Tools From Arb Digital
Measure the spread behind an observed rate with the variance calculator, check the significance of a result with the p-value calculator, find the cut-off statistic for a chosen alpha with the critical value calculator, summarise a dataset with the descriptive statistics calculator, or model repeated trials with the binomial distribution calculator. The full free online tools hub lists every statistics tool we publish.
Frequently Asked Questions
It is a rule for revising a probability when new evidence arrives. You start with how likely something was beforehand, weigh how much more often the evidence shows up when it is true than when it is false, and end with a revised probability.
Because when the condition is rare, the large group of people without it produces more false positives than the small group with it produces true positives. Accuracy describes the test; the posterior describes the test applied to a specific population.
The prior is your probability before seeing the evidence, usually the base rate in the relevant population. The posterior is the same probability after the evidence has been taken into account.
Subtract specificity from 100 percent. A test with 98 percent specificity has a 2 percent false positive rate, which is the number this calculator asks for.
Yes, by feeding the posterior back in as the new prior, but only if the second test is genuinely independent of the first. Two tests that share the same failure mode do not give you two real updates.
Sensitivity divided by the false positive rate. It tells you how many times more often the evidence appears when the hypothesis is true, and it multiplies your prior odds directly to give posterior odds.
No. It covers the standard binary case of one hypothesis and one yes-or-no piece of evidence. Multi-category updating needs a full probability table rather than three inputs.
This page explains a statistical calculation for educational purposes only. It is not medical, legal, or financial advice, and no result from it should be used to interpret a real diagnostic test without a qualified professional.