Odds Ratio and Relative Risk Calculator

Calculate odds ratio, relative risk, risk difference and number needed to treat from a 2×2 table.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Step 1: Open Odds Ratio and Relative Risk Calculator and add your input

    Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.

  2. 2
    Step 2: What Odds Ratio and Relative Risk Calculator does

    Calculate odds ratio, relative risk, risk difference and number needed to treat from a 2×2 table.

  3. 3
    Step 3: Read the result and compare

    The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.

  4. 4
    Step 4: Copy or save it

    Copy the result or download it. For an important decision, confirm it with the official source or an adviser.

About this tool

Enter the four counts of a 2×2 table: exposed with the outcome, exposed without, unexposed with the outcome and unexposed without. The calculator gives the risks, the relative risk and the odds ratio with 95% confidence intervals, the risk difference, the number needed to treat and the chi-square p-value.

Definitions

Risk = outcomes ÷ group size. Relative risk = risk in the exposed ÷ risk in the unexposed. Odds ratio = (a × d) ÷ (b × c). Risk difference = risk in the exposed − risk in the unexposed. Number needed to treat (or harm) = 1 ÷ |risk difference|.

Confidence intervals

Intervals use the logarithm method: exp(ln(RR) ± 1.96 × SE). An interval that does not include 1 suggests the association is unlikely to be chance.

Caution

The odds ratio is close to the relative risk only when the outcome is rare. Association does not prove cause.

The table is: a = exposed with outcome, b = exposed without, c = unexposed with, d = unexposed without.

Worked example

30 of 100 exposed and 15 of 100 unexposed have the outcome: relative risk 2.0 (95% interval 1.15 to 3.48), odds ratio 2.43 (1.21 to 4.87), a risk difference of 15 points, a number needed to treat of 6.7 and p = 0.011.

Tips for best results

Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.

Quick facts

Embed this calculator on your site

Copy this code to show the calculator on your own page. A link back to shobfree.com is included.

Frequently asked questions

RR or OR?

RR is easier to read; OR is used in case-control studies and logistic regression.

What does NNT mean?

How many people need the exposure or treatment for one extra outcome.

Why is OR bigger than RR?

When the outcome is common, the odds ratio overstates the risk ratio.

Can I use percentages?

Use counts.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages