StatGardenREF. DESK
Calculators/Statistics/Bayes’ theorem
Statistics

Bayes’ theorem calculator

Updates the probability of an event given new evidence.

Published 6 August 2026 · Updated 25 September 2026

What this calculator does

Bayes theorem revises a probability in the light of evidence. With a 1% prior, a test that catches 99% of true cases and wrongly flags 5% of healthy ones gives a posterior of just 16.7%.

That result is the single most important thing this calculator has to show. A 99% accurate test producing a positive result that is right only one time in six seems wrong until you count the people: out of 10,000, about 99 true cases test positive and about 495 healthy people also test positive. The false positives outnumber the true ones by five to one because there are so many more healthy people to draw them from.

The formula

FormulaP(A|B) = P(B|A)P(A) / [P(B|A)P(A) + P(B|¬A)P(¬A)]

The posterior is the true positive rate times the prior, divided by the total probability of the evidence. That denominator is the sum of two routes to a positive result: the true positives, prior times sensitivity, and the false positives, one minus the prior times the false positive rate. Both routes are shown separately so the arithmetic is visible.

TermMeaning
PriorThe probability before seeing the evidence, often the base rate in the population.
PosteriorThe revised probability after the evidence.
SensitivityP(evidence | A): the chance of a positive result when the condition is present.
False positive rateP(evidence | not A): the chance of a positive result when it is absent. This equals 1 minus specificity.

The inputs explained

FieldWhat to enter
Prior probability P(A) (%)Prior probability, typically the base rate of the condition in the population being tested.
P(evidence | A): true positive rate (%)True positive rate, also called sensitivity.
P(evidence | ¬A): false positive rate (%)False positive rate, which is 1 minus specificity. A test with 95% specificity has a 5% false positive rate.

When to use it

Interpreting a medical test result

A positive result means very different things for a screening test on the general population and a diagnostic test on symptomatic patients, purely because the prior differs.

Assessing a fraud or spam flag

Automated detection on a rare event produces mostly false positives unless specificity is extremely high.

Updating a belief with evidence

Any situation where a starting estimate should be revised by new information follows this structure.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How much does the base rate change the answer?

The same test applied to populations with different underlying rates.

99% sensitivity, 5% false positive rate
Prior probabilityPosterior P(A | evidence)P(evidence)P(evidence | ¬A) contribution
0.1%1.94%5.09%5.00%
1%16.7%5.94%4.95%
5%51.0%9.70%4.75%
20%83.2%23.8%4.00%
50%95.2%52.0%2.50%
The identical test gives a posterior of 1.94% at a 0.1% base rate and 95.2% at a 50% base rate. Nothing about the test changed between those rows. This is why screening a general population and testing someone with symptoms are genuinely different situations, and why a positive screening result is a reason for further testing rather than a diagnosis.

Questions

Why is a 99% accurate test only 16.7% reliable?

Because the condition is rare. Testing 10,000 people with a 1% base rate finds about 99 of the 100 true cases, but also wrongly flags about 495 of the 9,900 healthy people. Of roughly 594 positives, only 99 are real. The false positives dominate because the healthy group is so much larger.

What is the base rate fallacy?

Judging a positive result by the test accuracy while ignoring how rare the condition is. It is a well-documented error made by professionals as well as the public, and it is the single most common mistake in interpreting diagnostic tests.

What prior should I use?

The rate in the population actually being tested, not the general population. For someone with relevant symptoms the prior is far higher than the population base rate, which is exactly why the same test result means much more in a diagnostic setting than in mass screening.

How do I get the false positive rate from specificity?

Subtract it from 100%. A test with 95% specificity has a 5% false positive rate. Specificity describes how often it correctly clears healthy cases; the false positive rate describes how often it fails to, and this calculator asks for the latter.

For the related test metrics, see the diagnostic test metrics calculator. For probability conditioned on an event, see the conditional probability calculator.