Bayes' Theorem Calculator
Find the posterior probability P(A|B).
Result
How it is calculated
The tool computes the posterior probability that the condition is really present given a positive result:
P(A|B) = (sens × prior) / (sens × prior + fpr × (1 − prior))
Here prior is the base rate before testing, sens is the sensitivity (chance of a positive when the condition is present) and fpr is the false-positive rate (chance of a positive when it is absent). All three are entered as fractions between 0 and 1, not percentages. The denominator is the total chance of a positive result from both groups. The answer is shown as a percentage with two decimals. A value outside 0 to 1, or a zero denominator, gives no result.
Worked example
Take a condition affecting 1 in 100 people (prior = 0.01), a test with sensitivity 0.9 and a false-positive rate of 0.05.
- True positives: 0.9 × 0.01 = 0.009
- False positives: 0.05 × 0.99 = 0.0495
- Total positives: 0.009 + 0.0495 = 0.0585
- Posterior: 0.009 / 0.0585 ≈ 15.38%
Despite a good-looking test, a positive result means only about a 15% chance, because the condition is rare.
Common mistakes
- Typing percentages such as 1 or 90 instead of fractions such as 0.01 or 0.9: values above 1 are rejected and a prior of 1 means certainty.
- Confusing sensitivity with the posterior: a 90% sensitive test does not mean a positive result is 90% likely to be right.
- Entering the specificity where the false-positive rate belongs: the false-positive rate is 1 minus specificity.
- Ignoring the prior (base rate): for rare conditions most positives are false positives even with an accurate test.
About this calculator
This calculator applies Bayes' theorem, P(A|B) = P(B|A)·P(A) / P(B), to update a prior probability P(A) into a posterior probability P(A|B) once new evidence B is observed — using a test's sensitivity (true positive rate) and false-positive rate to work out how likely something is to actually be true given a positive result. It's the mathematical backbone of Bayesian inference: reasoning that formally combines what you believed beforehand with what new data tells you.
Doctors and epidemiologists use it to interpret medical test results correctly — a positive result for a rare disease can still mean a low actual probability of having it if the false-positive rate is high relative to the disease's prevalence. Statisticians, data scientists building spam filters and machine-learning classifiers, and forensic analysts weighing evidence all use this same reasoning; students learning probability use this calculator to build intuition for why “positive” doesn't always mean “likely.”
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
You can chain evidence: enter the posterior from a first positive as the new prior, written as a fraction, to see what a second positive would imply. In the 1-in-100 example, a prior of 0.1538 gives about 76.6%. That holds only if the second test's errors are independent of the first, which fails when the same method or sample repeats the same mistake. Which situation are you modelling: a screening test, a spam filter, a quality check? Post the three numbers you used.