About the Relative Risk Calculator
This relative risk calculator compares how often an outcome happens in an exposed (or treated) group versus an unexposed (or control) group. Enter the four counts of a 2×2 table — outcome yes and no in each group — and it returns the relative risk (risk ratio) with its confidence interval and p-value, the risk in each group, the absolute risk difference with its own interval, the relative risk reduction or increase, and the number needed to treat (or harm).
It is built for epidemiology and biostatistics students, people reading clinical trials and cohort studies, and analysts comparing conversion or failure rates between two groups. Relative risk answers "how many times more likely?", while the risk difference answers "how many more cases per 100 people?" — reporting both gives a far more honest picture than either alone.
Relative risk is appropriate for cohort studies and randomised trials where you follow groups forward; for case-control studies use the odds ratio instead. The confidence interval for RR uses the standard log (Katz) method and the risk difference uses the Wald method. If any cell is zero, 0.5 is added to every cell for the RR interval and test (Haldane–Anscombe correction). This is a statistics tool, not medical advice.
With the default inputs, the relative risk (risk ratio) is 2. Change any value above to recalculate instantly.
How to use the relative risk calculator
- 1Enter how many exposed (or treated) people had the outcome (a) and did not (b).
- 2Enter how many unexposed (or control) people had the outcome (c) and did not (d).
- 3Pick the confidence level.
- 4Read the relative risk and its confidence interval; check whether the interval includes 1.
- 5Use the risk difference and NNT to judge the absolute size of the effect.
Formula and method
The risk in each group is the number with the outcome divided by the group total. Relative risk divides the exposed risk by the unexposed risk: 1 means no difference, above 1 means the exposure is associated with more outcomes, below 1 with fewer. Because the sampling distribution of RR is skewed, the confidence interval is built on the log scale using the Katz standard error and then exponentiated, and the p-value comes from the z statistic ln(RR)/SE.
The risk difference (absolute risk reduction or increase) is p₁ − p₂, with a Wald confidence interval. Its reciprocal is the number needed to treat (when the treated group has lower risk) or the number needed to harm (when it has higher risk). When any cell is zero, 0.5 is added to all cells for the RR interval and test so the log is defined.
- a, b
- Exposed group with and without the outcome
- c, d
- Unexposed group with and without the outcome
- p₁, p₂
- Risk in exposed and unexposed groups
- z
- Critical value: 1.645 (90%), 1.960 (95%), 2.576 (99%)
- RD
- Risk difference (absolute risk change)
Worked examples
Cohort study: 20/100 exposed vs 10/100 unexposed
Risks are 20% and 10%, so RR = 0.20 ÷ 0.10 = 2. SE(ln RR) = √(1/20 − 1/100 + 1/10 − 1/100) = √0.13 ≈ 0.3606, giving a 95% CI of exp(ln 2 ± 1.96 × 0.3606) ≈ 0.987 to 4.054 — just including 1 (p ≈ 0.055). The risk difference is 10 points, so 10 exposed people yield one extra case.
Vaccine-style trial: 8 cases in 1,000 vaccinated vs 40 in 1,000 placebo
Risks are 0.8% and 4%, so RR = 0.2 — an 80% relative risk reduction. The 95% CI is about 0.094 to 0.425, clearly below 1. In absolute terms the risk falls by 3.2 points, so about 31.25 people (round up to 32) must be vaccinated to prevent one case.
Zero events in the treated group: 0/50 treated vs 5/50 control
The observed RR is 0 ÷ 0.10 = 0, but its log is undefined, so 0.5 is added to every cell: RR ≈ (0.5/51) ÷ (5.5/51) = 0.091 with a 95% CI of about 0.005 to 1.60, which still includes 1 (p ≈ 0.10). The Wald risk-difference interval (−18.3 to −1.7 points) excludes 0, a reminder that small samples with zero cells give unstable inferences.
Frequently asked questions
How do you interpret relative risk?+
RR = 1 means the outcome is equally likely in both groups. RR = 2 means the exposed group is twice as likely to have the outcome; RR = 0.5 means half as likely (a 50% relative risk reduction). Always check whether the confidence interval includes 1.
What is the difference between relative risk and odds ratio?+
Relative risk compares probabilities (risks), while the odds ratio compares odds. They are similar when the outcome is rare (under about 10%), but the odds ratio exaggerates the effect for common outcomes. Use RR for cohort studies and trials, OR for case-control studies.
Why report the risk difference as well as relative risk?+
A relative risk of 2 sounds large, but doubling a risk from 0.01% to 0.02% adds only one case per 10,000 people. The risk difference and number needed to treat show the absolute impact, which matters for real-world decisions.
How is the confidence interval for relative risk calculated?+
Take the natural log of RR, compute its standard error as √(1/a − 1/(a+b) + 1/c − 1/(c+d)), add and subtract z times that SE, and exponentiate the two limits. This is the standard log (Katz) method taught in epidemiology courses.
What is the number needed to treat?+
NNT is 1 divided by the absolute risk reduction. An NNT of 25 means 25 people must receive the treatment for one to benefit compared with control. When the exposure increases risk, the same quantity is called the number needed to harm (NNH).