DIY Cost Tools
Bayes Theorem Calculator
Update a prior probability after observing evidence using two specified likelihoods. A and not A form a mutually exclusive, exhaustive partition. The evidence probability is shown so you can inspect the denominator before interpreting the posterior.
How to use this calculator
- Identify the quantities required by the model and use the field units.
- Replace the example values, then select Calculate or press Enter.
- Read the labeled outputs and check the interpretation below.
Formula and interpretation
P(A|B) = P(A)P(B|A) / [P(A)P(B|A) + (1−P(A))P(B|not A)].
Calculations run in your browser. The previous results are hidden when an input changes or validation fails. This prevents an old answer from being mistaken for the new calculation. Results are displayed to approximately ten significant digits using floating-point arithmetic; that precision does not imply equal precision in measured inputs.
Worked example
Prior P(A) = 0.2; Likelihood P(B | A) = 0.8; Likelihood P(B | not A) = 0.1. Posterior P(A | B) = 0.6666666667; Evidence probability P(B) = 0.24.
Substitute the example inputs into the stated formula in the same order as the labeled fields. These are the default values shown above, so the explanation and the working interface describe the same case.
Limitations
Inputs are abstract probabilities, not medical or legal recommendations. The conclusion is only as reliable as the prior and likelihood assumptions. Evidence with probability zero makes conditional probability undefined.
This is an educational mathematical model. Check the assumptions and units for your situation. Geometry results do not establish material strength, and probability outputs do not predict an individual outcome.
Frequently asked questions
Is P(B|A) the same as P(A|B)?
Usually not. Bayes’ theorem accounts for the prior and the likelihood of evidence under the alternative.
Why does the calculator reject my entry?
Each field shows its supported range. Integer fields reject fractions; mathematical conditions such as a zero divisor or invalid shape produce a separate explanation. Correct the indicated field or condition and calculate again.
How many digits should I use?
Use enough digits to retain your input accuracy. Round the final answer to the precision justified by the data; tiny residuals around theoretical zero can result from floating-point arithmetic.
Review notes and reference
Reviewed October 3, 2026. The calculator script was tested against the default example and separate boundary cases. Checks covered blank, text, comma-formatted, non-finite and out-of-range entries, plus recovery after errors. Background reference for the mathematical method. Explanations and worked examples are original.
Related calculators
Math calculators · Binomial Probability Calculator · Poisson Probability Calculator · Geometric Probability Calculator · Search all calculators