🧮
🧮 Math & statistics

Relative Risk Calculator (RR, odds ratio, risk difference & NNT with confidence intervals)

Results update as you type.

Your numbers

Understanding the relative risk calculator — concept and principle

This calculator compares the risk of an outcome between an exposed and an unexposed group from a 2 × 2 table. It gives the relative risk (RR), odds ratio (OR), risk difference, their confidence intervals, and the number needed to treat or harm. Use it for cohort studies, trials and reading medical research.

Relative risk of 2Out of 100 people in each groupExposed30%Unexposed15%each dot = 2 peopleRR = 30% ÷ 15%295% CI 1.149–3.482 · OR 2.43 · NNH 7
The outcome is twice as common in the exposed group: 30 versus 15 per 100.

How it is calculated

Table: exposed a (outcome) and b (no outcome); unexposed c and d.

z = 1.645, 1.960 or 2.576 for 90, 95 or 99%. If any cell is 0, 0.5 is added to every cell for the ratios.

The principle

Risk is the share of a group that has the outcome. Dividing two risks says how many times more likely the outcome is in one group, which is easy to interpret in cohort studies and trials. The odds ratio compares odds instead and is the measure available in case–control studies, where the groups are chosen by outcome. Ratios are skewed, so their intervals are built on the log scale, where the sampling distribution is close to normal, and then converted back. The risk difference shows the absolute effect, which drives the number needed to treat or harm.

Worked example

Default inputs: a = 30, b = 70, c = 15, d = 85, 95% confidence.

  1. Risks: 30/100 = 30% exposed, 15/100 = 15% unexposed.
  2. RR = 0.30 ÷ 0.15 = 2, a 100% relative increase.
  3. SE(ln RR) = √(1/30 + 1/15 − 1/100 − 1/100) = √0.08 ≈ 0.2828; interval = exp(ln 2 ± 1.96 × 0.2828) = 1.149 to 3.482.
  4. OR = (30 × 85) ÷ (70 × 15) = 2,550 ÷ 1,050 ≈ 2.429, interval 1.211 to 4.870.
  5. RD = 15 points, interval 3.61 to 26.39; NNH = 1 ÷ 0.15 = 6.67, rounded up to 7.

How to read the result

RR = 1 means no difference; above 1 means higher risk with exposure, below 1 lower. If the interval excludes 1, the difference is statistically significant at that level. The OR is close to the RR only when the outcome is rare; here, with a 30% risk, the OR (2.43) exaggerates the RR (2). An NNH of 7 means that, on average, for every 7 people exposed, one extra person has the outcome.

Common mistakes

Keep in mind: These are statistical summaries, not proof of cause. Confounding, bias and chance can all produce an association. This tool does not give medical advice or a diagnosis.

Frequently asked questions

What is the difference between relative risk and odds ratio?

RR compares probabilities; OR compares odds. They are similar only for rare outcomes.

What does a confidence interval of 1.149 to 3.482 mean?

The data are consistent with a true RR anywhere in that range at 95% confidence; it does not include 1.

When is NNT used instead of NNH?

NNT when the exposure lowers risk (a benefit), NNH when it raises risk (a harm).

Sources: Altman, D. G., Practical Statistics for Medical Research (1991) · MedCalc Software manual, "Relative risk, risk difference and odds ratio"

Checked 9 Nov 2026. MedCalc Software, manual “Relative risk, risk difference and odds ratio” (formulas after Altman DG, Practical Statistics for Medical Research, 1991, and Deeks & Higgins, Statistical algorithms in Review Manager 5, 2010): RR, SE(ln RR) = √(1/a + 1/c − 1/(a+b) − 1/(c+d)); OR = ad/bc, SE(ln OR) = √(1/a + 1/b + 1/c + 1/d); SE(RD) = √(ab/(a+b)³ + cd/(c+d)³); 0.5 added to all cells when a cell is zero.

🧮 All math & statistics tools →🌍 Calculators by country →