Bayes theorem calculator that rebuilds a probability after the test result
Enter the prior probability, sensitivity and false positive rate as percentages on the left, and P(A|B) after the observation appears on the right. Below that, the same numbers are restated as counts of people, followed by what the answer would be if only the prior changed.
Inputs
Pick a scenario or fill any one of the three boxes to start. Empty boxes fall back to the grey example values you can see in them.
Probability after the result
Enter a prior and the test performance and the updated probability appears here. The same test means far less when the prior probability is low.
- Chance of a positive P(B)
- —
- Opposite case P(¬A|B)
- —
- After a negative P(A|¬B)
- —
- Positive likelihood ratio LR+
- —
Natural frequencies 2×2
Once you enter values the same settings are restated as counts of people, split into true positive, false positive, false negative and true negative.
- True positive — case, tests positive—
- False positive — no case, tests positive—
- False negative — case, tests negative—
- True negative — no case, tests negative—
If only the prior changed
Test performance stays the same and only the prior probability moves. It shows how differently the same positive result reads depending on who is being tested.
- Prior——
- Prior——
- Prior——
- Prior——
- Prior——
Everything is calculated in your browser and no input is sent to a server. The output is exact arithmetic for the three values you typed, so clinical or regulatory decisions should follow the official standards and expert reading for that field.
ready to use.
- Visible firstKeep the input and result positions clear.
- Results firstPut the main number up front and keep the process secondary.
- Less to askNo sign-up or extra information before using the tool.
Reading a positive result as a probability
When a test with 99 percent sensitivity comes back positive, most people hear it as a 99 percent chance of being a real case. The actual figure can be 16 percent or 98 percent depending on the situation. What moves it is not the quality of the test but the probability before testing, the prior. Bayes theorem combines the two into one expression and returns the probability after the observation.
The calculator on this page takes the prior, the sensitivity and the false positive rate as percentages, returns P(A|B), and restates the same situation as counts of people. The sections below explain what each input actually measures, how the four outcome cards are divided, and when the likelihood ratio and the post-negative probability are the numbers you should be looking at.
The range where the prior decides everything
The prior is the base rate of the thing being true before any observation. However good a test is, if real cases are rare then the false positives drawn from the much larger non-case group outnumber the true positives. This is why the same test means one thing when used on people with symptoms and something else entirely in population-wide screening.
- Prior 0.1 percent — false positives swamp true positives and a positive carries almost no weight
- Prior 1 percent — typical screening territory, a positive still lands under 20 percent
- Prior 10 percent — closer to a group selected by symptoms or exposure
- Prior 50 percent — the test performance now shows through directly
Sensitivity and false positive rate are separate axes
Sensitivity measures how many real cases get caught. The false positive rate measures how many non-cases get flagged anyway. They move independently, so a high figure on one says nothing about the other. Published material usually reports specificity instead of the false positive rate, and the two add up to 100. The hint line in the tool shows the conversion after you type.
- Sensitivity 99 percent — 99 of every 100 real cases test positive
- False positive rate 5 percent — 5 of every 100 non-cases test positive anyway
- Specificity = 100 − false positive rate, which is 95 percent here
- Miss rate = 100 − sensitivity, which is 1 percent here
What the four outcome cards separate
The natural frequency section turns the settings into counts and splits them four ways: two where the result matched reality and two where it did not. Counts make the size of the false positive group far more visible than decimals do, which is why risk communication research recommends presenting numbers this way.
- True positive — a real case that tested positive
- False positive — not a case, but tested positive
- False negative — a real case that tested negative and was missed
- True negative — not a case and tested negative
Following the arithmetic step by step
Take a prior of 1 percent, sensitivity of 99 percent and a false positive rate of 5 percent, with 10,000 people as the base. Rounded the way the screen rounds, the numbers come out as follows. With 99 real cases inside 594 positive results, P(A|B) is 16.7 percent.
- 100 real cases, 99 of them positive — true positives
- 9,900 non-cases, 495 of them positive — false positives
- 594 positive results in total, so P(B) is 5.94 percent
- 99 ÷ 594 = 0.1667, which is P(A|B) at 16.7 percent
- The opposite case P(¬A|B) is 83.3 percent
What the likelihood ratio says about the test itself
The likelihood ratio divides sensitivity by the false positive rate. It describes how strong the observation is as evidence independently of the prior, which makes it the right number for comparing two different tests. In the example 0.99 divided by 0.05 gives 19.8. Worked in odds, the pre-test odds multiplied by this value give the post-test odds.
- Above 10 — strong evidence that moves the probability a long way
- Between 5 and 10 — moderate evidence
- Between 2 and 5 — worth noting, not decisive
- Near 1 — the observation carries essentially no information
- Below 1 — evidence pointing the other way
The probability after a negative needs its own calculation
It is common to read the positive figure and treat a negative result as the all-clear. The probability that remains after a negative is a separate expression, shown on screen as P(A|¬B). When the prior is high and sensitivity is mediocre, a negative leaves a meaningful probability behind, so the two numbers have to be read together.
- Post-negative probability = cases that tested negative ÷ all negatives
- In the example there are 9,406 negatives out of 10,000, one of which is a real case
- That gives 0.01 percent, close enough to rule the case out
- Drop sensitivity to 80 percent and the post-negative figure rises noticeably at the same prior
Why the inputs are percentages
The numbers you are copying from are almost always percentages. Sensitivity in a paper abstract and the reject rate on a datasheet are both written that way. Converting them to decimals is where a misplaced digit creeps in, so this calculator takes them in the form they are published in. Fractional percentages still work, and 0.1 means a tenth of a percent.
- English, Korean and Japanese pages use a period as the decimal mark
- Spanish and Indonesian pages use a comma
- Anything outside 0 to 100 is clamped back into range
- Boxes you leave empty are calculated with the grey example values
Misreadings that keep coming back
Mistakes in Bayes calculations cluster in the same few places: treating test performance as if it were the answer, or taking a prior from the general population when the group being tested was already filtered. Checking these four points first removes most of the large errors.
- Reading sensitivity as the probability of being a case — the two conditionals point in opposite directions
- Typing specificity into the false positive box — 5 goes where 95 was meant
- Using general population prevalence for a symptomatic group — the answer comes out too low
- Treating a negative as zero — false negatives never disappear
Where the prior actually comes from
Because the prior drives the answer, the quality of the whole calculation depends on where that number came from. Published prevalence, your own historical data, and the way the tested group was selected are the three usual sources. If selection has already happened, general population figures no longer apply.
- Prevalence or defect rate published by an official body
- Confirmed positive share in your own records under the same conditions
- Whether the group was already narrowed by symptoms, exposure or prior screening
- When the value cannot be pinned down, bracket it and read the upper and lower rows in the prior comparison panel
Chaining a second test onto the first
Feeding the first result back in as the prior continues the update. Starting from 16.7 percent after the first positive and rerunning the same performance figures gives 79.8 percent. The step assumes the two tests are independent of each other, which is a real constraint rather than a formality.
- Put the post-test probability straight into the prior box
- Recalculate with the same sensitivity and false positive rate
- Repeating one method repeats its errors, so the true rise is smaller
- The arithmetic fits best when the two tests work on different principles
Before you quote the number
Run through these points before copying a figure into a report. Recording the source of the prior along with the group it describes is what lets you reconstruct the conditions when you look at the same number months later.
- Is the source and reference date of the prior written down
- Was the third box filled with the false positive rate rather than specificity
- Were sensitivity and false positive rate measured on a group like yours
- Did you check the post-negative probability as well as the positive one
- Does your write-up give both the probability and the counts
Bayes theorem calculator questions
Do I enter probabilities as decimals between 0 and 1?
No. This calculator takes percentages. Type 1 for one percent and 99 for ninety-nine percent. If you type 0.01 out of habit it is read as 0.01 percent, which is a hundred times smaller than intended. Decimals are still allowed when you need them, so 0.1 works for a tenth of a percent. Any value outside 0 to 100 is clamped back into range automatically.
Should I enter sensitivity or specificity?
The second box takes sensitivity and the third takes the false positive rate. False positive rate is 100 minus specificity, so a paper reporting 95 percent specificity means you type 5 in the third box. After you enter values the hint line under the fields shows the specificity your numbers imply, which is the quickest way to check you did not swap the two.
Sensitivity is 99 percent, so why is the answer only 16.7 percent?
Because the prior is low. Out of 10,000 people only 100 are real cases, and 99 of them test positive. The other 9,900 are not cases, but a 5 percent false positive rate still turns 495 of them positive. That leaves 594 positive results of which 99 are real, which is 16.7 percent. In this range the composition of the tested group, not the quality of the test, decides the answer.
What does P(B) actually represent?
It is the overall chance of seeing the observation at all, regardless of which group you belong to. For a test it is the chance that a randomly chosen person comes back positive. It adds the positives coming from real cases to the false positives coming from everyone else, which is why it sits in the denominator of Bayes theorem. If it is zero, no positive result exists and P(A|B) cannot be defined.
What does a likelihood ratio below 1 mean?
It means the observation is evidence in the opposite direction. The likelihood ratio divides sensitivity by the false positive rate, and a value of 1 carries no information at all. Below 1 the probability drops after a positive result, which usually happens when the false positive rate was typed in above the sensitivity. Check whether the two boxes were swapped before reading anything into the result.
Does changing the number of people change the probability?
No. The 1,000, 10,000 and 100,000 options only restate the same ratios as counts. They matter for readability rather than arithmetic. When the prior is very small, 1,000 people leaves fewer than one real case and the counts stop being intuitive, so raising the base to 100,000 usually makes the picture clearer.
How do I handle a second test?
Feed the first result back in as the new prior. In the example above the first positive gives 16.7 percent, so typing 16.7 into the prior box with the same performance figures returns 79.8 percent. This chaining assumes the two tests are independent. Repeating a test that works on the same principle repeats the same error as well, so the real increase is smaller than the arithmetic suggests.
Can I use this for a medical decision?
Not on its own. The tool gives exact arithmetic for the three numbers you typed and nothing else. Real sensitivity and false positive rates shift with timing, age, symptoms, specimen quality and reading criteria, and published values carry confidence intervals. Use it to understand the size of the effect, and leave the diagnosis to the clinician reading your case.
Does this work outside medicine?
Anywhere the conditional structure is the same. For a spam filter the prior is the share of mail that is spam, sensitivity is how much spam gets caught, and the false positive rate is how much legitimate mail gets flagged. For manufacturing the prior is the defect rate, sensitivity is detection, and the false positive rate is good units rejected. The scenario chips at the top of the tool load exactly these cases so you can compare them.
References
Checked 2026-09-02. Bayes theorem is derived from the axioms of probability and is not subject to revision. The references below cover the definition of the theorem, the standard vocabulary for sensitivity, specificity and likelihood ratios, and the evidence behind presenting results as natural frequencies.