331+ free tools. No sign-up. No hidden fees. Explore the toolkit

Bayes' Theorem Calculator

Bayes' theorem updates a probability when new evidence arrives. Find P(A|B) from P(B|A), P(A) and P(B) — or run the medical-test version, where sensitivity, specificity and prevalence give the chance that a positive result is real.

Choose a calculation type, enter your probabilities, and get the posterior as a decimal, a percentage and a “1 in N” figure instantly.

P(B) must be greater than 0, and at least P(B|A) × P(A) — otherwise the inputs are inconsistent.

Result

Save to Pinterest
Note: The posterior probability is exact arithmetic from the numbers you enter — no approximations. The medical-test mode assumes the test’s sensitivity and specificity are the same for everyone tested, and that the prevalence you enter is the pre-test probability for the person being tested. This calculator is for education and quick checks — it is not a substitute for professional statistical advice, and a screening result is never a diagnosis: always follow up with a qualified clinician.

How It Works

Bayes' theorem tells you how to update a belief when new evidence arrives: P(A|B) = P(B|A) × P(A) ÷ P(B). P(A) is the prior — what you believed before the evidence. P(B|A) is the likelihood — how probable the evidence is if A is true. P(B) is the total probability of the evidence. Dividing by P(B) rescales the answer so it is a proper probability. The result, P(A|B), is the posterior — your updated belief after seeing the evidence.

The medical-test mode is the same theorem with the terms filled in from test characteristics. The chance of having the disease after a positive test is P(disease | positive) = sensitivity × prevalence ÷ (sensitivity × prevalence + false-positive rate × (1 − prevalence)), where the false-positive rate is 1 − specificity. The denominator is the total probability of a positive result: true positives plus false positives. When the disease is rare, the false positives can outnumber the true ones many times over — which is why the answer is often far lower than people expect. The calculator also shows the breakdown per 10,000 people, so you can see exactly where the numbers come from.

Worked Example

Direct: P(B|A) = 0.8, P(A) = 0.3, P(B) = 0.5. The posterior is 0.8 × 0.3 ÷ 0.5 = 0.4800 (48.00%), or 1 in 2.08 — the evidence raised the probability from 30% to 48%. Medical test: a disease with 1% prevalence, a test with 99% sensitivity and 95% specificity. A positive result gives P(disease | positive) = 0.1667 (16.67%), or 1 in 6. Out of 10,000 people: 99 true positives, 1 false negative, 495 false positives and 9,405 true negatives — the 495 false positives swamp the 99 true ones. A negative result is reassuring: P(disease | negative) = 0.0001 (0.01%).

Assumptions

Last reviewed: 15 November 2026.

Built and tested by SumKitTool — see how we check our numbers.

How to Use This Calculator

Pick a calculation type, enter your probabilities, and the result updates live as you type.

  1. Choose the calculation type — direct Bayes' theorem with three probabilities, or the medical-test version with sensitivity, specificity and prevalence.
  2. Enter your probabilities — each between 0 and 1. For the medical test, the false-positive rate is 1 minus the specificity you enter.
  3. Read the answer — the posterior as a decimal, a percentage and a “1 in N” figure, plus (for medical tests) the per-10,000 breakdown and the probability after a negative result.

The Reset button restores the worked example (P(B|A) = 0.8, P(A) = 0.3, P(B) = 0.5 — P(A|B) = 0.4800).

Tips and Practical Advice

Frequently Asked Questions

What is Bayes' theorem?

Bayes' theorem updates a probability when new evidence arrives: P(A|B) = P(B|A) × P(A) ÷ P(B). P(A) is what you believed before the evidence, P(B|A) is how likely the evidence is if A is true, and P(B) is how likely the evidence is overall. The result, P(A|B), is your updated belief. For example, with P(B|A) = 0.8, P(A) = 0.3 and P(B) = 0.5, the posterior is 0.8 × 0.3 ÷ 0.5 = 0.4800 — the evidence raised the probability from 30% to 48%.

Why is the medical-test answer so much lower than the test's accuracy?

Because of the base rate: when a disease is rare, most positive results are false positives. With a 1% prevalence, a 99% sensitive test and a 95% specific test, out of 10,000 people there are 99 true positives but 495 false positives — so a positive result means only a 16.67% chance of actually having the disease, or 1 in 6. The test is accurate, but the disease is rare, and the rare cases are swamped by the false alarms from the 9,900 healthy people. This is the base-rate fallacy, and it is why a positive screening result always needs a follow-up test.

What is the difference between sensitivity and specificity?

Sensitivity is the test's ability to find the disease: P(positive | disease). A 99% sensitive test catches 99 out of 100 diseased people and misses 1. Specificity is the test's ability to clear healthy people: P(negative | no disease). A 95% specific test correctly clears 95 out of 100 healthy people and falsely flags 5. A test can be highly sensitive but poorly specific, or the other way round — and the posterior probability depends on both, plus the prevalence.

What does '1 in N' mean?

It is the same probability written as odds-style phrasing: how many people, on average, you would need for one to have the outcome. A posterior of 16.67% is 1 in 6 — roughly one person in six with a positive test actually has the disease. A posterior of 48.00% is 1 in 2.08. The phrasing is often easier to picture than a decimal or a percentage, especially for small probabilities.

Last updated: