Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Bayes theorem calculator

Enter a base rate and two conditional probabilities to get P(A | B), the probability of A once you know B happened, explained in plain counts.

Private: calculated on your device. Nothing you type is sent anywhere.

Next: Combining independent events with and, or and at least once? Use the probability calculator.

Bayes' theorem

Bayes' theorem turns "how likely is the evidence if A is true" into "how likely is A now that I've seen the evidence".

P(A | B) = P(B | A) · P(A) ÷ P(B)
P(B) = P(B | A) · P(A) + P(B | not A) · (1 − P(A))

You can type each probability as a decimal (0.09), a percent (9%) or a fraction (9/100). Numbers above 1 are read as percents.

Worked example: a medical test

A condition affects 1% of people. A test catches 90% of people who have it (sensitivity) and wrongly flags 9% of people who don't (the false-positive rate). If you test positive, what's the chance you have it?

Think of 10,000 people:

  • 100 have the condition (1%). 90 of them test positive.
  • 9,900 don't. 9% of them, 891 people, test positive anyway.
  • That's 90 + 891 = 981 positive tests, and only 90 of them are real: 90 ÷ 981 ≈ 9.17%.

With the formula: P(B) = 0.9 × 0.01 + 0.09 × 0.99 = 0.0981, and P(A | B) = 0.009 ÷ 0.0981 = 0.0917. A positive result raises the chance from 1% to about 9%, but most positives are still false alarms, because healthy people vastly outnumber sick ones.

Getting a realistic number

  • The base rate P(A) matters most and is the number people most often forget. Use the rate for people like the one being tested. Someone tested because of symptoms has a higher starting chance than a random person.
  • Sensitivity and false-positive rates come from studies and vary by test, lab and population. Use figures for the specific test.
  • Bayes' theorem itself is exact. The answer is only as good as the three numbers you put in. This page is a math tool, not medical advice.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • 1% base rate, 90% sensitivity, 9% false positives: 9.17431% ✓
  • Same test in natural frequencies: 981 positives ✓
  • Decimals 0.5, 0.8, 0.2: P(A | B) = 80% ✓
  • 0.1%, 99%, 5%: P(A | B) = 1.94346% ✓
  • Edge: B that can never happen is rejected ✓
  • Edge: a probability of 150% is rejected ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking cookies, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

What is P(B | not A)?

The chance of seeing B when A is false. For a medical test, it's the false-positive rate, which equals 1 minus the specificity. A test with 91% specificity has a 9% false-positive rate.

Why is P(A | B) so low even with an accurate test?

When A is rare, the few true positives are swamped by false positives from the much larger group without A. In the example, 891 false positives outnumber 90 true ones.

What are natural frequencies?

Counts of people instead of percentages, like "90 out of 981". Research by Gerd Gigerenzer and others found that people reason about Bayes problems far more accurately this way.

What happens with a second positive test?

Use the first answer as the new P(A) and run it again, assuming the tests' errors are independent. With the example numbers, a second positive raises the chance from 9.17% to about 50%.

Is P(A | B) the same as P(B | A)?

No, and mixing them up is a common mistake (sometimes called the prosecutor's fallacy). In the example, P(positive | sick) is 90% but P(sick | positive) is only 9.17%.

Related calculators