Bayes' theorem calculator

A test that is 99% accurate for a disease affecting one person in a thousand still gives mostly false positives. This is why.

%
%
%
Chance of really having it after a positive test
9.0164%
= Exact Bayes' theorem
Chance of really being clear after a negative test
99.998 989 %
True positives per 10 000 tested
9.90
False positives per 10 000 tested
99.90
Show the working
  1. Prevalence in the population = 0.1
  2. Sensitivity (true positive rate) = 99
  3. Specificity (true negative rate) = 99
  4. p = 0.1 / 100 = 0.001
  5. sens = 99 / 100 = 0.99
  6. spec = 99 / 100 = 0.99
  7. true_pos = 0.001 * 0.99 = 0.000 99
  8. false_pos = (1 - 0.001) * (1 - 0.99) = 0.009 99
  9. Chance of really having it after a positive test = (0.000 99 + 0.009 99) > 0 ? 0.000 99/(0.000 99 + 0.009 99)*100 : 0 = 9.016 39
  10. false_neg = 0.001 * (1 - 0.99) = 0.000 01
  11. true_neg = (1 - 0.001) * 0.99 = 0.989 01
  12. Chance of really being clear after a negative test = (0.989 01 + 0.000 01) > 0 ? 0.989 01/(0.989 01 + 0.000 01)*100 : 0 = 99.999
  13. True positives per 10 000 tested = 0.000 99 * 10000 = 9.9
  14. False positives per 10 000 tested = 0.009 99 * 10000 = 99.9

Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.

Scenarios & local history

Compare a saved scenario

Recent calculations

    The formula

    • P(disease | positive) = P(pos | disease) P(disease) / P(positive)
    • P(positive) = sensitivity x prevalence + (1 - specificity)(1 - prevalence)

    At the default values — 0.1% prevalence and 99% on both accuracy measures — a positive result means only about a 9% chance of actually having the condition.

    This is the single most consequential piece of arithmetic in screening policy.

    Related calculators

    Settings

    Theme

    System follows your operating system and changes with it.

    Text size
    High contrast

    Maximises text and border contrast and removes the grid background.

    Graph-paper background

    Round to
    Notation
    Thousands separators
    Decimal mark
    Nearest fraction

    Shows the result as the nearest tape-measure fraction, with the error it costs.


    Accessibility & interaction
    Reduce motion Stops interface animations even when the operating system does not.
    Underline links Keeps links visually distinct without relying on colour.
    Larger touch targets Makes buttons and form controls easier to tap.
    Shorter reading lines Limits article width for easier scanning.
    Monochrome display Removes colour as an information cue.
    Always-visible focus Makes the keyboard focus ring persistent and stronger.
    Verbose screen-reader results Announces the complete conversion equation.
    Sticky action bars Keeps converter and calculator actions within reach.
    Select values on focus Replaces a value immediately when you start typing.
    Left-handed mobile layout Moves key mobile actions toward the left thumb.

    Your data

    Settings, recent conversions and favourites live in this browser only. Nothing is sent anywhere.

    Offline library