Bayes Theorem Calculator

Bayes theorem is the mathematical formula for updating a probability estimate when you receive new evidence. It underpins much of modern statistics, machine learning, medical diagnosis, and reasoning under uncertainty. The theorem connects three probabilities you usually know or can estimate to produce one you want to find out. The prior probability P(A) is how likely the event or condition is before you see the evidence. The likelihood P(B|A) is how likely the evidence would be if the event is true. The false positive rate P(B|not A) is how likely the evidence would appear even if the event is not true. Combining these three using Bayes theorem gives you the posterior probability P(A|B): the updated probability that A is true now that you have observed B. One of the most important and counterintuitive lessons from Bayes theorem is how much the base rate matters. If a condition is very rare, even a highly accurate test will produce mostly false positives, because the large pool of unaffected people swamps the small pool of truly affected people. With a prior of 1%, a sensitivity (true positive rate) of 90%, and a false positive rate of 10%, the posterior probability is only about 8.33%. This calculator accepts all three inputs as percentages or decimals and returns the posterior P(A|B), the total probability of observing B, and the likelihood ratio. It is useful for students, medical students learning diagnostic reasoning, engineers working on signal detection, and anyone applying Bayesian thinking to real-world problems.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
%
%
%
8.33%
posterior probability P(A|B)
P(B) total10.80%
Likelihood ratio9.00
P(not A|B)91.67%

How it works

Bayes theorem states: P(A|B) = P(B|A) x P(A) / P(B). The total probability of B is P(B) = P(B|A) x P(A) + P(B|not A) x P(not A). The likelihood ratio is P(B|A) divided by P(B|not A). All inputs are converted from percentages to decimals for the calculation. The posterior P(not A|B) is 1 minus P(A|B). Division by zero (when P(B) is zero) returns N/A.

Worked example

A condition affects 1% of the population: P(A) = 0.01. A test detects it correctly 90% of the time: P(B|A) = 0.90. The test also triggers incorrectly on 10% of healthy people: P(B|not A) = 0.10. P(B) = 0.90 x 0.01 + 0.10 x 0.99 = 0.009 + 0.099 = 0.108, or 10.80%. Posterior = (0.90 x 0.01) / 0.108 = 0.009 / 0.108 = 8.33%. The likelihood ratio is 0.90 / 0.10 = 9.00. These match the default values pre-filled above.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-07-02 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.