The Handy Calculators logoTheHandyCalculators.com

    Bayes' Theorem Calculator

    Update prior beliefs with new evidence using Bayes' rule — posterior probability with tree diagram.

    Autosave on

    All probabilities as decimals between 0 and 1 (e.g. 0.99 for 99%).

    Posterior P(H | +)
    16.67%
    Posterior P(¬H | +)
    83.33%
    P(positive test)
    5.94%
    Specificity (1 − FPR)
    95.00%

    Per 10,000 people

    Have the condition
    100
    True positives: 99
    False negatives: 1
    Don't have the condition
    9,900
    False positives: 495
    True negatives: 9,405

    Likelihood ratio LR+ = 19.8

    Bayes' theorem updates a prior belief in the light of new evidence. Plug in the base rate of a condition, the test sensitivity (true-positive rate), and the false-positive rate; this calculator returns the posterior probability that the condition is actually present given a positive test.

    The formula

    P(H | E) = P(E | H) · P(H) / P(E), where P(E) = P(E | H) · P(H) + P(E | ¬H) · P(¬H).

    P(H) — prior, your belief before seeing the evidence (the base rate).

    P(E | H) — likelihood, how often the evidence appears when the hypothesis is true (sensitivity for a medical test).

    P(E | ¬H) — false-positive rate, how often the evidence appears when the hypothesis is false.

    P(H | E) — posterior, the updated probability after the evidence.

    Worked example — the rare-disease puzzle

    A disease has a 1% prevalence (P(H) = 0.01). A test has 99% sensitivity (P(+ | H) = 0.99) and 5% false-positive rate (P(+ | ¬H) = 0.05).

    A random patient tests positive. What's the chance they actually have the disease?

    P(+) = 0.99·0.01 + 0.05·0.99 = 0.0099 + 0.0495 = 0.0594.

    P(H | +) = (0.99·0.01) / 0.0594 ≈ 0.1667 — only 17%. Even with a 99% accurate test, a positive on a rare condition is more likely a false alarm than the disease.

    This is why population screening is hard: when base rates are low, false positives dominate the positives.

    How to think about updates

    Bayes is a multiplier on the prior odds. Prior odds = P(H) / P(¬H); posterior odds = prior odds × likelihood ratio (LR+ = sensitivity / FPR).

    If LR+ = 20, a positive multiplies your prior odds by 20. A 1% prior (odds 1:99) becomes posterior odds 20:99 → P ≈ 0.168.

    This explains why repeating an independent positive test helps: each positive multiplies the odds again. Two independent positives at LR+ = 20 give posterior odds 1:99 · 20² = 400:99 → P ≈ 0.80.

    Beyond medical tests

    Spam filters — P(spam | features). Prior = base rate of spam in your inbox; likelihood = how often those words appear in spam vs ham.

    A/B significance — P(real lift | observed difference). Frequentist p-values implicitly assume a 50/50 prior, which is rarely reasonable for already-shipped features.

    Forensics, fault detection, search-and-rescue — anywhere prior knowledge plus an imperfect signal needs to combine into a posterior probability.

    Common pitfalls

    Base-rate neglect — focusing on the test's accuracy and ignoring the prevalence. The example above is the classic example.

    Inverting conditionals — P(E | H) is not P(H | E). A symptom may be 95% likely given the disease, but the disease may still be rare given the symptom.

    Assuming independence of tests when they share systematic errors. Two correlated tests don't multiply odds as cleanly as the formula suggests.

    Frequently asked questions

    What's a 'good' likelihood ratio?

    LR+ > 10 is considered strong evidence; 5–10 is moderate; below 2 barely moves the needle. LR− works analogously for negative tests.

    Can the prior be 0 or 1?

    No — Bayesian updating multiplies the prior, so a prior of exactly 0 or 1 can never change. Use a small ε if you mean 'almost impossible'.

    Does this work for continuous evidence?

    Same idea, with densities instead of probabilities. P(H | E) ∝ f(E | H) · P(H), normalised by integrating over all hypotheses.

    Frequentist vs Bayesian — which is right?

    Both are useful. Bayesian explicitly models prior beliefs and updates them; frequentist tools give error-rate guarantees over repeated experiments. They answer different questions about the same data.

    By Larius software engineer, NC real estate broker & CRE/business appraiserReviewed by the Handy Calculators editorial teamHow we build calculators

    More in Statistics & Probability

    From z-scores and confidence intervals to t-tests, chi-square, correlation, regression, and the binomial/Poisson distributions — textbook-grade tools with worked examples.

    See hub →
    Browse all Education →