Skip to main content
True Calculator

Bayes Theorem Calculator

Apply Bayes' theorem to diagnostic tests: posterior probability, P(positive) and negative predictive value from prior and test accuracy.

%

E.g. disease prevalence in the population.

%

P(test positive | condition present).

%

P(test positive | condition absent).

P(condition | positive)

16.6667%

Prior odds 0.0101 → posterior odds 0.2

P(test positive)

5.94%

Law of total probability

Negative predictive value

99.9894%

Bayes' rule: posterior = prior × sensitivity ÷ P(positive). Even accurate tests give many false alarms when the condition is rare.

Bayes Theorem Calculator on True Calculator gives you an instant, accurate answer with no sign-up and no app install. Apply Bayes' theorem to diagnostic tests: posterior probability, P(positive) and negative predictive value from prior and test accuracy. Every result shows the formula and a worked example so you can verify the calculation yourself, and all values are computed in your own browser — your numbers never leave your device.

Popular uses: bayes theorem calculator · bayes rule calculator · conditional probability calculator

Reviewed by the True Calculator team · Last updated: August 2026

How We Calculate

This calculator uses standard statistical formulas as defined in textbooks and statistical software. All calculations are performed instantly in your browser using JavaScript — no data is sent to any server.

Formulas follow the conventions used in academic statistics, including population and sample variants where they differ.

When to Use This Calculator

Use the Bayes theorem calculator whenever you must interpret a positive or negative test result in light of how rare the condition really is — dengue and typhoid screening, tuberculosis tests, diabetes risk scores, credit-fraud flags or employee-screening tests. In India's high-volume diagnostic labs, the same kit behaves very differently in a 1% prevalence season than in a 20% prevalence outbreak, and this calculator makes that shift explicit. Data-science learners use it to grasp how classifiers update beliefs, and financial analysts apply the same arithmetic to fraud detection where legitimate transactions vastly outnumber frauds. Because it reports the posterior, the total probability of a positive result and the negative predictive value together, it covers the full Bayesian update in one screen — exactly the numbers clinicians and analysts reason with.

How to Use This Calculator

  1. Step 1: Enter the prior probability as a percentage — the condition's prevalence before the test.
  2. Step 2: Enter the sensitivity — the chance the test is positive when the condition is present.
  3. Step 3: Enter the false-positive rate — the chance the test is positive when the condition is absent.
  4. Step 4: Read the posterior probability, P(test positive) and the negative predictive value.

Worked Example

During monsoon season a Delhi clinic screens for dengue, which affects about 1% of patients. The rapid test kit has 99% sensitivity and a 5% false-positive rate. Entering prior 1%, sensitivity 99% and false positive 5% gives a posterior of 16.67% — a positive result means only about one chance in six of actual dengue infection. The calculator also shows P(test positive) = 5.94%, the total share of positive results, and a negative predictive value of 99.99%, meaning negative results are extremely reliable.

Tips and Common Mistakes

  • Tip 1: Raise the prior when symptoms or exposure history suggest higher risk — the posterior responds strongly to it.
  • Tip 2: Read the negative predictive value before trusting a negative result; it stays high only when the condition is rare.
  • Tip 3: Use the posterior odds card to explain results to patients — odds often communicate better than percentages.
  • Mistake 1: Confusing sensitivity with the posterior — a 99% sensitive test is not 99% accurate when prevalence is low.
  • Mistake 2: Entering the false-positive rate as a specificity value; specificity is 100% minus the false-positive rate.

Frequently Asked Questions

What is Bayes' theorem in simple terms?

Bayes' theorem updates a prior probability with new evidence to get a posterior probability. In a medical test it answers: given a positive result, what is the chance the person actually has the condition? It combines the condition's prevalence with the test's sensitivity and false-positive rate.

Why do rare diseases give so many false positives?

With 1% prevalence, a 99%-sensitive test and a 5% false-positive rate, a positive result still means only a 16.7% chance of having the condition. The reason is arithmetic: among 100,000 people, 990 true positives occur, but about 4,950 healthy people also test positive. The calculator shows this posterior directly.

What inputs do I need?

Three: the prior probability (prevalence — how common the condition is before the test), the sensitivity (probability the test is positive when the condition is present), and the false-positive rate (probability the test is positive when it is absent). All three are entered as percentages, and the calculator also reports the negative predictive value.

How is P(test positive) calculated?

By the law of total probability: P(positive) = prior × sensitivity + (1 − prior) × false-positive rate. For a 1% prevalence, 99% sensitivity and 5% false-positive rate this comes to 5.94%. The posterior is then prior × sensitivity ÷ P(positive) — the denominator is what you divide by.

Where is Bayes' theorem used in India?

It is central to medical screening — for example, interpreting dengue or typhoid test results where prevalence varies by season — and to spam filtering, credit-risk scoring and machine learning models. Banks use the same logic to judge how likely a flagged transaction is genuinely fraudulent, given how rare fraud is overall.

You might also need

Related calculators from other categories