Pick a mode under Calculation Mode: General Bayes' Theorem, Medical Test or Multiple Hypotheses; the input card and the example box change with it. Learn more about the modes
In Multiple Hypotheses mode set the Number of Hypotheses (2-6) and type a prior and a conditional probability for each row; the priors must sum to 1. Learn more about the hypotheses
Click Calculate; the posterior appears in the result card with the smaller cards and the tree diagram, or a red box lists the problems. Reset clears every mode. Learn more about the results
Expand the headers of the Step-by-Step Solution to follow the arithmetic, and read the panel on the right for the formula of the current mode. Learn more about the steps
Calculate posterior probabilities using Bayes' Theorem with visual tree diagrams and step-by-step solutions.
Input Probabilities
Base probability that event A occurs
Probability of B given A is true
Probability of B given A is false
💡 Example: Rare Disease Test
• P(A) = 0.01 (disease affects 1% of population)
• P(B|A) = 0.95 (test is 95% accurate if you have disease)
• P(B|A') = 0.05 (5% false positive rate)
🎯
Ready to Calculate
Enter your probabilities and click Calculate to see Bayes' Theorem in action
📊
Visualization Ready
Tree diagram will appear here after calculation
General Bayes' Theorem
Turns P(BmidA) into P(AmidB): the prior P(A) is weighted by the likelihood P(BmidA) and divided by the total probability P(B)=P(BmidA)P(A)+P(BmidA′)P(A′). Learn more about Bayes' theorem
The calculator offers three specialized modes tailored to different Bayes' Theorem applications. General Bayes' Theorem mode works with abstract events A and B, requiring prior probability P(A), conditional probability P(B|A), and P(B|A'). This mode suits any scenario where you're updating beliefs based on new evidence.
Medical Test mode simplifies diagnostic probability calculations. Instead of abstract notation, you enter disease prevalence, test sensitivity (true positive rate), and specificity (true negative rate). The calculator automatically computes false positive rate and determines the probability of actually having the disease given a positive test result.
Multiple Hypotheses mode extends Bayes' Theorem to compare 2-6 competing theories simultaneously. Enter prior probabilities and conditional probabilities for each hypothesis. The calculator updates all hypotheses based on observed evidence and ranks them by posterior probability. This mode excels for comparing multiple explanations or scenarios. The three buttons sit under Calculation Mode at the top of the card, each with a one-line description; the input card's heading changes with the mode, "Input Probabilities", "Test Parameters" or "Hypotheses", and an example box under the buttons shows typical values. Switching mode keeps the numbers typed in the other modes. The three forms of the theorem are explained in What is Bayes' Theorem?, The Medical Test Form of Bayes' Theorem and Bayes' Theorem with Several Hypotheses.
Entering Probabilities in General Mode
DemoThe rare-disease example, a larger prior, Reset
Step 0 of 3
General mode requires three probability inputs, all between 0 and 1. P(A) represents the prior probability—your initial belief that event A is true before observing any evidence. For a rare disease affecting 1% of the population, enter 0.01.
P(B|A) specifies the conditional probability of observing evidence B when A is true. If a medical test correctly identifies disease 95% of the time, enter 0.95. This represents how strongly B indicates A.
P(B|A') gives the conditional probability of observing B when A is false. For the medical test, if false positive rate is 5%, enter 0.05. This quantifies how often B occurs even without A. The calculator uses these three values to compute posterior probability P(A|B)—the updated probability of A given that you've observed B. Each box takes a value from 0 to 1. A value outside that range, or a box left empty, is reported at Calculate time with "P(A) must be between 0 and 1" or the message of its sibling box. With P(A)=0.01, P(B∣A)=0.95 and P(B∣A′)=0.05 the posterior is P(A∣B)=16.10%, with P(B)=5.90%, prior odds 0.01 and a likelihood ratio of 19.00; raising the prior to P(A)=0.5 lifts the posterior to 95.00%. The formula behind the three numbers is in What is Bayes' Theorem?.
Using the Medical Test Calculator
DemoA rare disease, then a common one
Step 0 of 3
Medical test mode uses domain-specific terminology familiar to healthcare applications. Disease Prevalence equals P(Disease)—the base rate in the population being tested. For a cancer affecting 1 in 1,000 people, enter 0.001.
Sensitivity measures the true positive rate: P(Positive Test|Disease). A sensitivity of 0.90 means the test correctly identifies 90% of actual cases. Higher sensitivity reduces false negatives—sick patients who test negative.
Specificity measures the true negative rate: P(Negative Test|No Disease). A specificity of 0.95 means the test correctly identifies 95% of healthy individuals. The calculator automatically computes false positive rate as 1 minus specificity. Results show P(Disease|Positive Test)—the crucial probability that a positive test actually indicates disease, which is often surprisingly low when prevalence is rare. With prevalence 0.01, sensitivity 0.90 and specificity 0.95 the result reads P(Disease∣Positive Test)=15.38% and P(No Disease∣+)=84.62%; a prevalence of 0.1 raises the first to 66.67%. A value above 1 or an empty box is reported at Calculate time as "Prevalence must be between 0 and 1" or the message of its sibling box. Why a positive test on a rare disease stays unconvincing is explained in The Medical Test Form of Bayes' Theorem.
Setting Up Multiple Hypotheses
DemoThree hypotheses, a fourth row, priors that do not sum to 1
Step 0 of 3
Multiple hypotheses mode accommodates 2-6 competing theories. First, set the number of hypotheses in the Number of Hypotheses (2-6) box; rows are added or removed to match, and the values already typed stay in place. Each hypothesis gets a name (H₁, H₂, etc.) and requires two probabilities.
Prior Probability P(Hᵢ) represents your initial belief in each hypothesis before observing evidence. These priors must sum to exactly 1.0. For three equally likely theories, use 0.333, 0.333, 0.334. For theories with different plausibility, weight accordingly: perhaps 0.5, 0.3, 0.2.
Conditional Probability P(E|Hᵢ) specifies how likely the observed evidence is under each hypothesis. If evidence E strongly supports H₁, that conditional probability might be 0.8, while H₂ gets 0.4 and H₃ gets 0.2. The calculator updates all hypotheses simultaneously, showing which theory the evidence favors most. With priors 0.5, 0.3, 0.2 and likelihoods 0.8, 0.6, 0.4 the posteriors are 60.61%, 27.27% and 12.12% with P(E)=66.00%. Priors that do not add up are refused at Calculate time with "Prior probabilities must sum to 1 (currently sum to …)". The general form of the update is in Bayes' Theorem with Several Hypotheses.
Reading Results and Tree Diagrams
DemoThe result cards and the tree in two modes
Step 0 of 3
Results display prominently at the top with the posterior probability—the main answer showing updated belief after observing evidence. The percentage indicates how likely event A or disease actually is given the observed evidence B or positive test. Color coding highlights significance: red for low probabilities, blue for moderate, green for high.
The probability tree diagram visualizes the calculation structure. Branches show prior probabilities splitting into conditional paths. Green and orange paths highlight the routes leading to observed evidence. Joint probabilities appear at branch endpoints, showing P(A∩B) for each combination.
Additional metrics include Prior Odds (P(A)/P(A')), Likelihood Ratio (P(B|A)/P(B|A')), and Posterior Odds. These odds-based formulations provide alternative perspectives on how evidence updates beliefs. The likelihood ratio quantifies evidence strength—ratios above 1 support A, below 1 oppose it. Before the first Calculate the result area reads "Ready to Calculate" and the diagram area "Visualization Ready"; after it, the main card is headed Posterior Probability in general mode and Test Result in medical mode, with a short verdict such as "(Low probability)" under the percentage, and the four smaller cards give P(A′∣B), P(B), the prior odds and the likelihood ratio. In Multiple Hypotheses mode the result lists every hypothesis with a bar from prior to posterior and names the most likely one. What the odds and the ratio measure is explained in Likelihood Ratios and Odds.
Interpreting Step-by-Step Solutions
DemoOpening the steps
Step 0 of 3
The step-by-step section breaks the calculation into expandable stages. Click any step header to reveal detailed arithmetic. Given Information lists all inputs with proper notation. Step 1 calculates P(A'), the complement probability (1 - P(A)).
Step 2 applies the Law of Total Probability to find P(B): the total probability of observing evidence across all scenarios. This equals P(B|A) × P(A) + P(B|A') × P(A'), summing probability across both A true and A false branches.
Step 3 executes Bayes' Theorem itself: P(A|B) = [P(B|A) × P(A)] / P(B). The numerator weights the prior by how well A predicts B. The denominator normalizes by total evidence probability. Step 4 computes P(A'|B) as 1 - P(A|B), ensuring probabilities sum to 1. Additional Insights show the odds formulation, demonstrating that posterior odds equal prior odds multiplied by likelihood ratio. The headers read Given Information, Step 1: Calculate P(A'), Step 2: Calculate P(B) using Law of Total Probability, Step 3: Apply Bayes' Theorem to find P(A|B), Step 4: Calculate P(A'|B) and Additional Insights: Odds Form; in Multiple Hypotheses mode there are three steps, ending with a verification that the posteriors sum to one. The law used in step 2 is explained in What is Bayes' Theorem? and taught in The law of total probability.
What is Bayes' Theorem?
Bayes' Theorem is a fundamental formula for updating probabilities based on new evidence. Mathematically: P(A∣B)=P(B)P(B∣A)×P(A). It answers the question: given that I've observed B, what's the probability that A is true?
The theorem reverses conditional probabilities. If you know P(B|A) (probability of evidence given hypothesis), Bayes' Theorem calculates P(A|B) (probability of hypothesis given evidence). This reversal is crucial because we observe evidence and want to infer causes, but direct knowledge often flows the opposite direction.
The formula combines three components: the prior P(A) representing initial belief, the likelihood P(B|A) measuring how well A predicts the evidence, and the marginal probability P(B) normalizing the result. Stronger evidence (higher likelihood ratio) produces larger updates from prior to posterior.
For comprehensive theory on Bayes' Theorem including proofs, derivations, and applications, see Bayes' theorem.
The Medical Test mode is Bayes' theorem with the three inputs renamed: the prevalence is the prior P(D), the sensitivity is P(+∣D), and the specificity is P(−∣D′), so the false positive rate is 1−specificity. The posterior is P(D∣+)=P(+∣D)P(D)+P(+∣D′)P(D′)P(+∣D)P(D).
With prevalence 0.01, sensitivity 0.90 and specificity 0.95: the numerator is 0.009, the false positives contribute 0.05⋅0.99=0.0495, so P(+)=0.0585 and P(D∣+)=0.009/0.0585≈15.38%. Only one positive in six or seven is a true case, because the healthy majority produces more false positives than the sick minority produces true ones. Raising the prevalence to 0.1 lifts the posterior to 66.67%. The common mistake is to read the sensitivity, 90%, as the chance of having the disease after a positive test; that confuses P(+∣D) with P(D∣+).
When evidence E bears on several competing hypotheses H1,…,Hn whose priors add up to 1, Bayes' theorem updates all of them at once: P(Hi∣E)=P(E)P(E∣Hi)P(Hi) with P(E)=∑jP(E∣Hj)P(Hj) by the law of total probability. Every posterior is the hypothesis's share of the total evidence probability, so the posteriors add up to 1 again.
With priors 0.5, 0.3, 0.2 and likelihoods 0.8, 0.6, 0.4: the products are 0.40, 0.18 and 0.08, their sum is P(E)=0.66, and the posteriors are 60.61%, 27.27% and 12.12%. The ranking can change: a hypothesis with a small prior but a high likelihood can overtake one that started ahead. The common mistake is to enter priors that do not sum to 1, which the calculator refuses; the second is to forget that the likelihoods need not sum to anything, since each is a probability under a different hypothesis.
The prior probability P(A) represents belief before observing evidence—the base rate or initial plausibility. In medical testing, prior equals disease prevalence. In hypothesis testing, prior reflects background knowledge about each theory's likelihood. Priors incorporate existing information before the current observation.
The posterior probability P(A|B) represents updated belief after observing evidence B. It combines prior belief with new information. The posterior becomes the new prior for subsequent updates—Bayesian inference proceeds iteratively, refining probabilities as more evidence accumulates.
The shift from prior to posterior quantifies learning. If posterior equals prior, evidence was uninformative. If posterior greatly exceeds prior, evidence strongly supports A. If posterior falls below prior, evidence argues against A. The magnitude of change depends on both evidence strength (likelihood ratio) and how surprising the evidence is (marginal probability P(B)).
The likelihood ratio equals P(B|A) / P(B|A'), comparing how much more likely evidence is under A versus not-A. A likelihood ratio of 10 means evidence is 10 times more likely if A is true. Ratios above 1 support A, below 1 oppose A, exactly 1 is uninformative.
Odds express probability as ratios rather than fractions. Prior odds = P(A) / P(A'), posterior odds = P(A|B) / P(A'|B). Bayes' Theorem in odds form states: posterior odds = prior odds × likelihood ratio. This multiplicative relationship shows how evidence scales belief.
Converting between probability and odds: odds = p / (1-p), probability = odds / (1+odds). Odds of 3:1 correspond to probability 0.75. The odds formulation clarifies that weak evidence (likelihood ratio near 1) barely changes odds, while strong evidence (extreme likelihood ratios) dramatically shifts belief regardless of prior.