The tool you need, ready to use

Bayes’ Theorem Calculator

Enter the prior probability, sensitivity and specificity and you get P(A|B), the chance you actually have it after a positive test. With a 1% prior, 99% sensitivity and 95% specificity, a positive result still means only 16.7%. The same case is drawn as 1,000 dots to show how many positives are true and false, alongside the chance left after a negative, the positive likelihood ratio, the chance after two positives, and a curve showing how the result shifts with the prior.

Last updated 2026-11-25All math stays in your browser
Chance of actually having it after a positive result, P(A|B)

—

Chance of a positive result, P(B)
Chance left after a negative, P(A|¬B)
Positive likelihood ratio, LR+
After two positives
Examples

In terms of people
  • True positivesHave it, test positive
  • False positivesDon't have it, test positive
  • False negativesHave it, test negative
  • True negativesDon't have it, test negative

If the prior probability changes
  • After a positive, P(A|B)
  • After a negative, P(A|¬B)
  • Same as before the test

Last updated 2026-11-25Your inputs are not stored

ROBERIN standardThe tool you need,
ready to use.
  • Clear at a glanceInputs and results sit where you expect them.
  • Result firstThe key number comes first; the working only when you need it.
  • Ask lessNo sign-up and no unnecessary details.

With a 1% prior, 99% sensitivity and 95% specificity, a positive result means only a 16.7% chance you actually have it

Hearing that a test with 99% sensitivity came back positive, it is easy to conclude there is a 99% chance of having the condition. But if the chance of having it before testing (the prior probability) is 1% and the specificity is 95%, the chance of actually having it after a positive result is 16.7%. Only about one in six positives is real.

Turn the percentages into people and the reason shows. Out of 10,000 people, 100 truly have the condition, and 99 of them test positive. Of the 9,900 who do not have it, 5% (495 people) also test positive by mistake. So 594 people test positive, 99 of them genuinely, and 99 ÷ 594 = 16.7%. The test is not bad. There are simply so many people without the condition that even a small error rate produces a large crowd of false alarms.

The calculator above takes the prior probability, sensitivity and specificity and returns P(A|B), the chance of actually having it after a positive result. If your source gives a false positive rate instead of specificity, enter it in the false positive rate field and the two fields update each other. It also draws the same case as 1,000 dots so you can see how true and false positives mix inside the positive group, and it works out the chance left after a negative, the positive likelihood ratio, the chance after two or three positives, and a curve showing what happens when only the prior changes.

Why a positive result needs to be recalculated

When a screening test comes back positive, when a lab asks you to repeat a test, or when a spam filter or a security system raises an alarm, the question is the same: how much should you trust this signal? A test's documentation usually lists sensitivity and specificity, but those numbers measure how often the test is right for people whose true status is already known. Someone holding a result needs the reverse: the probability of the true status given the result. Bayes' theorem is the calculation that reverses the direction.

That reversal is hard even for experts. In 1978, 60 physicians, residents and students at Harvard Medical School were asked what the chance is that a person with a positive result really has the disease, given a prevalence of 1/1000 and a false positive rate of 5%. Only 11 gave the correct answer of about 2%, and the most common answer, from 27 of them, was 95%. When the same question was put to 61 people at a Boston-area hospital in July 2013, 14 (23%) answered correctly and 27 (44%) said 95%. In a mammography problem (prevalence 1%, sensitivity 90%, false positive rate 9%), 60% of 160 gynecologists chose an answer of 80% to 90%, while the true value is about 1 in 10.

Restating the problem as head counts (natural frequencies) helped a great deal. In a study where 48 physicians worked through four diagnostic problems, only 10% of the solutions were correct when the information came as probabilities, but 46% were correct when it was given as natural frequencies such as "10 out of every 1,000 people have the disease, and...". After one training session on converting to natural frequencies, 87% of the gynecologists solved the problem. That is why the calculator shows a dot picture alongside the probabilities.

How to calculate it

The Bayes' theorem formula

Let A mean "actually has it" and B mean "tests positive". The chance of actually having it after a positive result is:

P(A|B) = P(B|A) × P(A) ÷ P(B)
P(B) = P(B|A) × P(A) + P(B|¬A) × (1 − P(A))

P(A) is the prior probability, P(B|A) is the sensitivity, and P(B|¬A) is the false positive rate (1 − specificity). The denominator P(B) is the chance that a randomly chosen person tests positive, the sum of true and false positives. In the example, P(B) = 0.99 × 0.01 + 0.05 × 0.99 = 0.0594, so P(A|B) = 0.0099 ÷ 0.0594 = 16.7%.

Solving with natural frequencies

  1. Pick a population size. 10,000 people leaves almost no decimals.
  2. Split it by the prior probability. At 1%, that is 100 people who have it and 9,900 who do not.
  3. Multiply those who have it by the sensitivity to get true positives, and those who do not by the false positive rate to get false positives: 99 and 495.
  4. Divide true positives by all positives: 99 ÷ (99 + 495) = 16.7%.

Solving with odds and likelihood ratios

Using odds (the chance of having it divided by the chance of not having it) turns the problem into a single multiplication. The odds after the test equal the odds before the test times the likelihood ratio. The positive likelihood ratio is sensitivity ÷ false positive rate, here 0.99 ÷ 0.05 = 19.8. A prior of 1% has odds of 1/99, so the odds after a positive are 19.8/99 = 0.2, which converts back to a probability of 0.2 ÷ 1.2 = 16.7%, the same answer. A ratio of 1 leaves the probability unchanged, and a ratio below 1 lowers it even though the result is positive.

After a negative result, and repeated tests

For a negative result, use the same formula but replace the sensitivity with the miss rate (1 − sensitivity) and the false positive rate with the specificity. In the example, 0.01 × 0.01 ÷ (0.01 × 0.01 + 0.95 × 0.99) = 0.0106%. If a second positive follows, feed the first result of 16.7% back in as the prior to get 79.8%, and a third positive gives 98.7%. The "After two positives" tile in the calculator shows these values. If the second test is a different test, use the "Use result as prior" button to carry the result over, then enter that test's own sensitivity and specificity.

How the result changes with the prior probability

Here the test quality stays fixed at 99% sensitivity and 95% specificity, and only the prior probability changes. The same positive result can mean 2% or 95%, depending on who is being tested.

Results by prior probability at 99% sensitivity and 95% specificity (per 10,000 people)
Prior probabilityTest positiveOf those, actually have itAfter a positiveAfter a negative
0.1%509 people9.9 people1.94%0.00105%
1%594 people99 people16.7%0.0106%
5%970 people495 people51%0.0554%
10%1,440 people990 people68.8%0.117%
20%2,380 people1,980 people83.2%0.262%
50%5,200 people4,950 people95.2%1.04%

Raising the prior fivefold from 1% to 5% lifts the chance after a positive from 16.7% to 51%, more than threefold. At the other end, with a prior of 0.1%, fewer than 10 of the 509 positives actually have the condition. This is why a positive from broad screening of people without symptoms is usually followed by a confirmatory test. The curve below the calculator extends this table from 0.01% to 100%.

Comparing different situations

Results for different example inputs (hypothetical cases use numbers chosen for illustration)
SituationPrior probabilitySensitivitySpecificityAfter a positiveAfter a negative
Screening (hypothetical)1%99%95%16.7%0.0106%
Mammography problem1%90%91%9.17%0.111%
1978 Harvard problem0.1%100%95%1.96%0%
Product defect check (hypothetical)3%95%92%26.9%0.168%
Spam filter (hypothetical)60%98%97%98%3%

The mammography problem is the one used in training gynecologists: of about 98 positives per 1,000 women, 9 actually have the disease. The 1978 Harvard problem did not state a sensitivity, so 100% is assumed, and only about 2% of the people who test positive truly have the disease. For a spam filter, 60% of incoming mail is spam, so the prior is high and the alarm can almost be trusted, but 3 out of every 100 legitimate emails still end up in the spam folder. In the hypothetical defect-inspection case (a 3% defect rate), roughly three out of four alarms are good items.

Common mistakes

  • Reading sensitivity as the chance after a positive. A sensitivity of 99% means that 99 out of 100 people who have it test positive, not that 99 out of 100 positives have it. P(B|A) and P(A|B) are equal only when the chance of a positive, P(B), equals the prior P(A), for example with a 50% prior and equal sensitivity and specificity.
  • Ignoring the prior probability. Judging a result from test quality alone overestimates a positive more and more as the condition gets rarer. In the table above, the same test moves from 1.94% to 95.2% depending on the prior.
  • Entering specificity in the false positive rate field. Typing a specificity of 95% as a false positive rate of 95% drops the positive likelihood ratio to 1.04 (99% ÷ 95%), so a prior of 1% stays at 1.04% even after a positive. If the result is almost the same as before the test, or the sentence says the chance goes down despite a positive, check the two fields first.
  • Using prevalence as an individual's prior. Prevalence is a rate for a whole group. A person tested because of symptoms, family history or contact has a higher prior, so the same positive result means a higher real probability.
  • Assuming repeated tests are independent. Repeating a test on the same sample or with the same principle tends to repeat the same false positive for the same reason. The 79.8% after two positives assumes the two tests err independently, so the real figure may be lower.
  • Treating a negative as 0%. Unless sensitivity is 100%, some chance remains after a negative, and it grows as the prior rises. With a 50% prior, 90% sensitivity and 95% specificity, a negative still leaves 9.52%.

Limitations of the calculation

  • The result is arithmetic that assumes the three numbers you enter are exact. Real sensitivity and specificity differ from study to study and come with confidence intervals, which the calculator does not reflect.
  • It treats a result as simply positive or negative. For tests that cut a continuous value, such as a blood level, at a threshold, moving the threshold changes sensitivity and specificity together.
  • The repeated-test values rely on the tests being independent of each other, which fits poorly when the same principle is applied again.
  • The calculator does not choose a prior for you. Which group's prevalence to use, and how much to adjust for symptoms and risk factors, is up to the person using it and should rest on evidence.
  • Health examples are for explaining the concept and do not replace diagnosis or treatment decisions. Interpret real test results with your healthcare provider.

As of 2026-10-20 · The study figures were checked directly against the original papers and abstracts listed below. Table values were computed exactly as fractions and then rounded.

Sources

Frequently asked questions

Does a positive result on a 99% sensitivity test mean a 99% chance I have it?

No. The 99% is the chance that someone who has it tests positive, P(B|A). What you want is the chance of having it given a positive, P(A|B). With a 1% prior and 95% specificity, 99 of the 594 positives per 10,000 people are real, which is 16.7%. With a 50% prior the same test gives 95.2%.

What should I enter as the prior probability?

The chance that the person has it before the test. For broad screening of people without symptoms, use the prevalence of that group. If the person is tested because of symptoms or risk factors, use a higher value than the prevalence. The same test gives 1.94% after a positive at a 0.1% prior but 68.8% at 10%, so settle the evidence for the number first.

What is the difference between specificity and the false positive rate?

Specificity is the share of people without the condition who correctly test negative. The false positive rate is the share of them who wrongly test positive. The two add up to 100%. The calculator pairs the fields, so entering whichever one your source gives updates the other. Entering a specificity of 95% as a false positive rate changes the result completely, so check the field name.

What is the chance after two positive results in a row?

Feed the first result back in as the next prior. With a 1% prior, 99% sensitivity and 95% specificity, the chance is 16.7% after the first positive, 79.8% after the second and 98.7% after the third. These values assume the two tests err independently. Repeating a test with the same principle tends to repeat the same error, so the real rise may be smaller.

Can I relax after a negative result?

Usually yes when the prior is low. With a 1% prior, 99% sensitivity and 95% specificity, the chance left after a negative is 0.0106%. A high prior changes this: with a 50% prior, 90% sensitivity and 95% specificity, 9.52% remains even after a negative. If symptoms are clear and the test is negative, consider the possibility of a false negative.

What is the positive likelihood ratio and what is it for?

It is sensitivity divided by the false positive rate, and it shows how many times a positive result multiplies the odds before the test. With 99% sensitivity and a 5% false positive rate it is 19.8. Multiply the odds of a 1% prior, 1/99, by 19.8 to get 0.2, which converts to 0.2 ÷ 1.2 = 16.7%. A ratio of 1 means a positive tells you nothing, and below 1 a positive lowers the chance.

There are 1,000 dots but the population is 10,000. How do I read it?

Each dot stands for 10 people. For 10,000 people, the 99 true positives are about 10 dots and the 495 false positives about 50 dots. Dot counts are rounded to total 1,000, so read exact head counts from the legend. Groups smaller than one dot are not drawn and are listed in the sentence under the picture. At a very low prior, switch to 100,000 people to make the counts easier to read.

Where else can I use it besides medicine, and can I rely on it for diagnosis?

It fits anything where you know how often a signal appears when the condition is true and when it is false: spam filters, product defect checks, fraud alerts and security alarms all share the same structure. It is not enough for diagnosis on its own, though. Real sensitivity and specificity vary with the population and the timing of the test and have confidence intervals, so interpret results with your healthcare provider.