Bayes’ Theorem Calculator — Prior, Likelihood & Posterior Probability

Update a hypothesis probability after observing evidence. Enter a prior and likelihood, then use either the evidence likelihood under the alternative hypothesis or the overall evidence probability.

Enter prior and evidence probabilities

Bayes inputs

Chance of H before evidence E

Chance of E when H is true

Often a false-positive rate

P(H | E) = P(E | H)P(H) ÷ [P(E | H)P(H) + P(E | not H)P(not H)]

Enter every probability as a percentage from 0 to 100.

Calculation is local to this page. Inputs are not stored or added to analytics events.

Posterior result

Your updated probability will appear here.
Enter probabilities and select Calculate posterior.

Advertisement

Bayes’ theorem formulas

FormFormulaUse it when
Direct evidenceP(H | E) = P(E | H)P(H) / P(E)The overall probability of the evidence P(E) is known.
Two-hypothesis formP(H | E) = P(E | H)P(H) / [P(E | H)P(H) + P(E | not H)P(not H)]H and not H exhaust the possibilities and both evidence likelihoods are known.
Odds formPosterior odds = prior odds × likelihood ratioYou want to see how strongly the evidence changes the odds. LR = P(E | H) / P(E | not H).

Terms: the prior P(H) is the probability before evidence E. The likelihood P(E | H) describes evidence assuming H. The posterior P(H | E) is the updated probability after observing E. A likelihood is not itself a probability that H is true.

How to interpret a Bayesian update

Evidence that supports H

If E is more likely when H is true than when H is false, the likelihood ratio is greater than 1 and the posterior is above the prior. Larger ratios produce stronger upward updates.

Evidence against H

If E is less likely under H, the ratio is below 1 and the posterior falls. A ratio of exactly 1 leaves the prior unchanged because E is equally likely either way.

Assumptions and limits

  • The two-hypothesis form assumes H and not H are mutually exclusive and exhaustive.
  • Every input must refer to the same population, conditions, and definition of evidence.
  • Repeated updates require conditional likelihoods appropriate to all evidence already observed; multiplying as though dependent observations were independent can overstate certainty.
  • The numerical result inherits any bias or uncertainty in the prior and likelihood inputs.

Important: this is an educational probability calculator, not medical, legal, financial, or safety advice. For screening tests, P(E | not H) is the false-positive rate, not 1 minus sensitivity. Use prevalence and performance values that match the relevant population and setting.

Worked Bayes’ theorem example

Suppose a condition has a 1% prior probability, a test detects it 90% of the time when present, and the test is positive 5% of the time when it is absent.

  1. Joint probability of the condition and a positive result: 0.90 × 0.01 = 0.009.
  2. Total positive-result probability: 0.009 + (0.05 × 0.99) = 0.0585.
  3. Posterior probability: 0.009 / 0.0585 = 0.153846, or about 15.38%.

The positive result raises the probability substantially, but the posterior is not 90%. The low prior and false positives among the larger condition-absent group matter.

Frequently asked questions

What is Bayes’ theorem?

Bayes’ theorem reverses a conditional probability: P(H | E) = P(E | H)P(H) / P(E), as long as P(E) is greater than zero.

What is a prior probability?

The prior P(H) describes how probable H is before accounting for the current evidence. It may come from a base rate, earlier data, or an explicitly stated model.

What is a likelihood?

The likelihood P(E | H) is the chance of observing E if H is true. It points in the opposite conditional direction from the posterior P(H | E), so the two should not be confused.

How is the evidence probability P(E) calculated?

When H and not H cover all possibilities, P(E) = P(E | H)P(H) + P(E | not H)P(not H). This is the law of total probability.

Can the posterior be lower than the prior?

Yes. It is lower when the observed evidence is less likely under H than under not H. In odds terms, this means the likelihood ratio is below 1.

Why does the calculator reject some direct P(E) values?

The entered P(E) must be consistent with the prior and P(E | H). For a two-part partition, it must fall between P(E | H)P(H) and P(E | H)P(H) + P(not H); otherwise the implied P(E | not H) would be outside 0 to 1.

Does this calculator provide a diagnosis?

No. It only performs the probability update you specify. Real test interpretation also depends on how the population was selected, test thresholds, dependence, measurement error, and clinical context.

Are my inputs tracked?

No. The calculator runs in your browser and does not send, store, or attach entered probabilities to analytics events.

Formula references

Explore more tools