Bayes Theorem Calculator
Enter a prior P(A) and the two likelihoods P(B|A) and P(B|¬A) to update your belief into the posterior probability P(A|B) — and see how the base rate shapes the answer.
Prior to posterior in one step
Enter the prior and the two likelihoods and this Bayes theorem calculator returns the posterior P(A|B), both as a decimal and as a percentage.
Use probabilities 0–1
Every input is a probability between 0 and 1 — write a 1% chance as 0.01, not as 1, so the formula stays valid.
What is Bayes' theorem?
Updating belief with evidence
This Bayes theorem calculator turns a prior probability into a posterior probability once you have evidence. Bayes' theorem is the rule of probability that tells you how to revise your belief in a hypothesis A after observing some evidence B. It combines three numbers — the prior P(A), how likely the evidence is when A is true P(B|A), and how likely it is when A is false P(B|¬A) — into a single updated probability P(A|B). It is the engine behind spam filters, diagnostic reasoning, and any situation where a test or signal updates an underlying chance.
Enter a prior P(A) and the two likelihoods P(B|A) and P(B|¬A) to get the posterior probability P(A|B) instantly.
The posterior is the likelihood-weighted prior divided by the total probability of the evidence across both hypotheses.
P(A|B) = [P(B|A) × P(A)] / [P(B|A) × P(A) + P(B|¬A) × (1 − P(A))]The denominator is the law of total probability: it adds the chance of seeing the evidence when A is true to the chance of seeing it when A is false. The complement of the prior, 1 − P(A), weights the false-positive term. Because all inputs are probabilities between 0 and 1, the posterior is always a probability between 0 and 1 too.
Suppose hypothesis A has a prior probability of 0.01, the evidence appears with probability 0.9 when A is true, and with probability 0.05 when A is false.
Weight the prior by the likelihood
0.9 × 0.01 = 0.009 — the joint probability of A and the evidence.
Add the false-positive term
0.05 × (1 − 0.01) = 0.0495 — the evidence when A is false, weighted by the complement 0.99. The total probability of the evidence is 0.009 + 0.0495 = 0.0585.
Divide to get the posterior
0.009 ÷ 0.0585 ≈ 0.153846 — the posterior P(A|B), about 15.4%.
The most surprising feature of Bayes' theorem is the base-rate effect. In the example the evidence is fairly strong — it appears 90% of the time when A is true and only 5% of the time when A is false — yet the posterior is just 15.4%, not anything close to 90%. The reason is the small prior: A starts out rare (1%), so the large group where A is false produces most of the positive evidence simply because it is so much bigger. Raising the prior makes the posterior climb steeply: with the same likelihoods, a prior of 0.1 gives a posterior near 0.31, and a prior of 0.5 gives 0.9. This is why a single strong signal rarely settles a question about a rare event, and why the underlying base rate matters as much as the strength of the evidence. Reading the posterior alongside its percentage form makes the update easy to communicate.
The formula is exact, but its answer is only as good as the three probabilities you feed it.
Inputs are probabilities and both likelihoods must be known
Every input must be a probability between 0 and 1, so enter a 1% chance as 0.01 rather than 1. The calculation assumes you know both likelihoods — P(B|A) and P(B|¬A) — and that A and its complement cover every case. If the evidence is impossible under both hypotheses the denominator is zero and the posterior is undefined. The result is an abstract probability update, not advice for any specific decision.