Bayes' Theorem Calculator

This calculator applies Bayes' theorem to find an updated, or posterior, probability after taking new evidence into account, the cornerstone of reasoning under uncertainty. Bayes' theorem tells you how to revise a probability when you learn something new, combining what you believed beforehand, the prior, with how strongly the new evidence points one way or the other. Its most famous and counter-intuitive application is medical testing: even an accurate test for a rare condition can produce a surprisingly low chance of actually having the condition after a positive result, because most positives come from the large healthy population. The same logic underlies spam filters, fault diagnosis, machine learning and everyday judgement. This tool makes the classic test scenario concrete. You enter the prior probability of having the condition, often the prevalence in the population, the test's sensitivity, the chance it correctly flags a true case, and the false positive rate, the chance it wrongly flags a healthy person. The calculator returns the posterior probability of genuinely having the condition given a positive test, along with the overall probability of a positive result and the inputs for reference. The results update as you type. Use it to understand test results properly, for statistics and probability study, or to see why screening rare conditions produces many false alarms. The key lesson the calculator drives home is that a positive result from a good test is far from a certainty when the condition is rare: with a one percent prevalence and a five percent false positive rate, even a 99 percent accurate test leaves only about a one in six chance of truly having the condition. Bayes' theorem turns this intuition into a precise number.

16.67%
posterior P(A|B) after a positive
P(positive result)5.94%
Prior1%
Sensitivity99%

Bayes: P(A|B) = P(B|A)P(A) / [P(B|A)P(A) + P(B|not A)P(not A)]. With a rare condition, even an accurate test gives many false positives.

How it works

Bayes' theorem multiplies the sensitivity by the prior to get the chance of a true positive, then divides by the total chance of any positive result, which adds the true positives and the false positives from the healthy population. The result is the posterior probability of genuinely having the condition given a positive test.

Worked example

With a 1 percent prior, 99 percent sensitivity and a 5 percent false positive rate, true positives are 0.99 times 0.01, which is 0.0099. False positives are 0.05 times 0.99, which is 0.0495. The total positive rate is 0.0594, so the posterior is 0.0099 divided by 0.0594, about 16.67 percent, despite the test being highly accurate.

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.

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.

© 2019 to 2026 Calculate.co.nz. All rights reserved.