Home › Calculators › Bayes Theorem Calculator

Bayes Theorem Calculator

Update a probability with new evidence. Enter how likely A is to begin with, how likely the evidence B is when A is true and when it is false, and see the posterior probability P(A|B), worked step by step with a probability tree and a table of natural frequencies.

Last updated:

%

How common A is before seeing the evidence (base rate)

%

e.g. test sensitivity / true positive rate

%

e.g. false positive rate (100% − specificity)

Enter your values to see the result.
Advertisement
Advertisement

How to use the Bayes Theorem Calculator

  1. Name the events (optional): A is the hypothesis, B the evidence you observed.
  2. Enter P(A), the base rate before the evidence, as a percentage.
  3. Enter P(B | A) and P(B | not A), how often the evidence appears when A is true and when it is false.
  4. Read P(A | B), the updated probability, and follow the tree and the frequency table.
  5. Try a preset to see how a low base rate changes the answer.

Bayes' theorem formula

P(A|B) = P(B|A) × P(A) ÷ P(B), where P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A).

In odds form: posterior odds = prior odds × likelihood ratio, with odds = p ÷ (1 − p) and likelihood ratio = P(B|A) ÷ P(B|¬A). This form is handy for updating several times with independent pieces of evidence.

How the base rate changes the answer

Same test (90% sensitivity, 9% false positive rate, likelihood ratio 10), different base rates:

Prior P(A)P(B)Posterior P(A|B)
0.1%9.08%0.99%
1%9.81%9.17%
5%13.05%34.48%
10%17.10%52.63%
30%33.30%81.08%
50%49.50%90.91%

The rarer A is, the more of the positive results come from the large group where A is false. Thinking in natural frequencies (“out of 10,000 people…”) makes this easy to see.

Frequently asked questions

What is Bayes' theorem?

Bayes' theorem gives the probability of A after observing B: P(A|B) = P(B|A) × P(A) ÷ P(B). The denominator comes from the law of total probability: P(B) = P(B|A)P(A) + P(B|not A)P(not A).

Why is P(A|B) so low for a positive result on an accurate test?

Because the condition is rare. With a 1% base rate, 90% sensitivity and a 9% false positive rate, 10,000 people produce 90 true positives but 891 false positives, so only 90 ÷ 981 ≈ 9.2% of positives actually have the condition. Ignoring the base rate is called the base rate fallacy.

What is the difference between P(A|B) and P(B|A)?

They answer different questions. P(B|A) is how often the evidence appears when A is true (for a test, its sensitivity). P(A|B) is how likely A is once you have seen the evidence. Confusing the two is a common error.

What is the likelihood ratio?

LR = P(B|A) ÷ P(B|not A). Bayes' theorem in odds form says posterior odds = prior odds × LR. An LR of 10 multiplies the odds of A by 10; an LR of 1 means the evidence tells you nothing.

How do sensitivity and specificity fit in?

For a diagnostic or screening test, P(B|A) is the sensitivity and P(B|not A) is 1 − specificity (the false positive rate). P(A|B) is then the positive predictive value and 1 − P(A|not B) the negative predictive value.

Can I enter probabilities as decimals?

Enter them as percentages: 0.5 means 0.5%, so type 50 for a probability of 0.5. The steps show the same numbers as decimals.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Probability CalculatorFind and, or, not, conditional and at-least-once probabilities from P(A) and P(B).Odds Ratio and Relative Risk CalculatorOdds ratio, relative risk, risk difference, 95% CIs and p-values from a 2x2 table.Binomial Distribution CalculatorBinomial probabilities P(X = k), at most, at least or between, with mean, variance and chart.Percentage CalculatorWork out percentages, increases and decreases.Weighted Average CalculatorCalculate a weighted mean from values and weights, step by step.Average CalculatorMean, weighted average, median, sum, min and max of any list.Standard Deviation CalculatorStandard deviation, variance, mean, median, mode and quartiles.A/B Test Significance CalculatorCheck if your A/B test result is statistically significant.Z-Score CalculatorZ-score from a value, mean and SD, plus percentile and p-value; or the value from z.Permutation and Combination CalculatorCalculate nPr and nCr, with or without repetition, as exact big numbers.Mean Median Mode CalculatorFind the mean, median, mode, range, min, max, sum and count of a list of numbers.Confidence Interval CalculatorConfidence interval and margin of error for a mean or a proportion, with steps.Sample Size CalculatorHow many survey responses you need for a given confidence level and margin of error.Percentile CalculatorValue at any percentile, percentile rank of a score, quartiles, IQR and outliers.Correlation Coefficient CalculatorPearson r and Spearman rank correlation with significance and interpretation.Average Order Value CalculatorAverage order value from revenue and orders, plus the revenue impact of raising AOV.Normal Distribution CalculatorNormal probabilities P(X < x), between two values and inverse percentiles, on a shaded bell curve.Poisson Distribution CalculatorPoisson probabilities for a rate λ: exactly k, at most, at least or between, with a chart.T-Test CalculatorOne-sample, two-sample (Welch/pooled) and paired t-tests with p-value and CI.Chi-Square CalculatorChi-square goodness-of-fit and independence tests with p-value and expected counts.P-Value CalculatorOne- or two-tailed p-values from z, t, chi-square or F statistics, with critical values.Variance CalculatorSample and population variance and standard deviation with a step-by-step deviations table.Five Number Summary CalculatorMin, Q1, median, Q3, max, IQR and fences of a data set, with a box plot.Outlier CalculatorFind outliers with 1.5×/3× IQR fences, z-scores or modified z-scores; get the cleaned data.Geometric Mean CalculatorGeometric, harmonic, arithmetic and quadratic means compared, or average growth from % changes.Expected Value CalculatorExpected value, variance and standard deviation from outcomes and their probabilities.One-Way ANOVA CalculatorOne-way ANOVA for 2-10 groups: SS, df, MS, F statistic, p-value, effect size and full table.Box Plot MakerPaste data to draw box-and-whisker plots with quartiles, IQR and outliers. Download PNG or SVG.Coefficient of Variation CalculatorCV % from a dataset (sample or population) with mean, SD and a two-dataset comparison.Critical Value CalculatorCritical values of z, t, chi-square and F for any alpha, tails and degrees of freedom.Dice Probability CalculatorOdds of rolling a sum (exactly, at least, at most) with any dice, plus the full distribution.Effect Size Calculator (Cohen's d)Cohen's d, Hedges' g and Glass's delta from two means, SDs and sample sizes, with CI.Frequency Table GeneratorMake a frequency, relative and cumulative frequency table from numbers or categories.Histogram MakerPaste numbers, choose bins and get a histogram, frequency table and PNG download.Margin of Error CalculatorSurvey margin of error from sample size, confidence and proportion, with population correction.Moving Average CalculatorSimple, exponential and weighted moving averages of a data series, with table and line chart.Standard Error CalculatorStandard error of the mean from data or SD and n, plus SE of a proportion, with CIs.Descriptive Statistics CalculatorPaste data and get mean, median, mode, quartiles, SD, skewness, kurtosis and a histogram.T Distribution CalculatorStudent's t probabilities and critical values for any df, with the area shaded on the curve.T-Table (Student's t Distribution)Interactive t-table: critical t-values for any df and α, p-values, and a printable full table.Z-Test CalculatorOne-sample, two-sample and proportion z-tests with z, p-value, decision and shaded curve.Shannon Entropy CalculatorEntropy of text, data or probabilities in bits, nats or hartleys with a frequency table.Empirical Rule Calculator68-95-99.7 rule ranges from a mean and standard deviation, with a shaded bell curve.Z-Table (Standard Normal Table)Interactive z-table: find the area for any z-score, or the z-score for a probability.Average Rate of Change CalculatorAverage rate of change of f(x), two points or a data table over [a, b], with the secant line.Binomial Expansion CalculatorExpand (a + b)^n with the binomial theorem: every term, Pascal coefficients and any specific term.Combinations GeneratorList every k-combination of your items, with or without repetition, and copy or export them.Covariance CalculatorSample and population covariance of paired X and Y data, with a step table and scatter plot.Grouped Data CalculatorMean, median, mode, variance and standard deviation from class intervals and frequencies.Inverse Normal Distribution CalculatorinvNorm: find the x or z value for a left, right, central or two-tail area, with a shaded curve.Permutations GeneratorList all permutations of letters, words or items, with k-permutations and repeats, and export them.Statistical Power CalculatorPower or required sample size for t-tests, proportions and correlations, with a power curve.
See all 52 Statistics & Probability Calculators →