Bayes Theorem Calculator
Apply Bayes' theorem to find the probability of a condition given a positive test, from the base rate, sensitivity and specificity.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Bayes Theorem Calculator does
Use this bayes theorem calculator to apply Bayes' theorem to find the probability of a condition given a positive test, from the base rate, sensitivity and specificity. Fill in all 3 fields and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for understanding what a positive screening result actually implies. Companion tools to this one live on FreeToolStation.org.
How to use it
- Enter the base rate — how common the condition is in the group being tested — as a decimal.
- Enter the test's sensitivity: the proportion of genuine cases it detects.
- Enter the specificity: the proportion of genuine non-cases it correctly clears.
- Read the posterior probability, and the per-1000 breakdown that shows where the number comes from.
How it works
Bayes' theorem turns one conditional probability into the other. A test's sensitivity tells you P(positive | condition); what a patient actually wants to know is P(condition | positive), and those two numbers can be wildly different. The bridge between them is the base rate — how common the condition is in the population being tested — and ignoring it is such a reliable error that it has a name: the base rate fallacy.
The default values here show why it matters. A condition affecting 1 person in 100, a test that catches 99% of cases and correctly clears 95% of healthy people: a positive result means roughly a 1 in 6 chance of actually having the condition. Out of 1000 people tested, about 10 have it and 9.9 of those test positive, while 990 do not have it and about 49.5 of those test positive anyway. The false positives outnumber the true ones five to one, not because the test is bad but because there are so many more healthy people to generate false alarms.
The practical consequence is that screening a rare condition in a general population needs very high specificity, and that a positive screening result is a reason for a confirmatory test rather than a diagnosis. It is also why the same test performs completely differently in a high-risk clinic — raise the base rate to 30% and that positive result becomes about 89% reliable, with nothing about the test having changed. This page is a tool for understanding conditional probability and is not a substitute for medical advice about a specific test result.
When to use it
- Understanding what a positive screening result actually implies.
- Updating a prior belief with new evidence.
- Comparing a test's performance in a screening population against a high-risk one.
- Working through a conditional probability problem in a statistics course.
Common mistakes to avoid
- Reading sensitivity as the chance you have the condition given a positive result. Those are different quantities and Bayes' theorem is the conversion between them.
- Entering percentages instead of decimals. 99% sensitivity is 0.99.
- Using a population base rate for someone with symptoms. The relevant prior is the rate in the group the person actually belongs to, which may be far higher.
Frequently asked questions
Why is a positive result on an accurate test often wrong?
Because when a condition is rare, the large healthy group generates more false positives than the small affected group generates true positives. With a 1% base rate and 95% specificity, roughly 49 of every 1000 people tested are false positives against about 10 true cases.
What is the difference between sensitivity and positive predictive value?
Sensitivity is a property of the test: how often it fires when the condition is present. Positive predictive value is what you get out of it in a particular population, and it depends on the base rate as well as the test. This page calculates the second from the first.
How do I use Bayes' theorem outside medicine?
Any time you have a prior belief and new evidence. Spam filtering, fault diagnosis, legal evidence and A/B test interpretation all use the same structure: prior, likelihood of the evidence under each hypothesis, and the normalising denominator.