About the Relative Risk Calculator
Relative risk (RR), also called the risk ratio, compares the probability of an outcome in two groups. If 40 percent of smokers and 20 percent of non-smokers develop a condition, the relative risk is 2: smokers are twice as likely to develop it. It is the most intuitive measure of association in clinical trials and cohort studies, where groups are followed forward in time and the risk in each can be measured directly.
This relative risk calculator takes the four counts of a 2 × 2 table and gives the relative risk, its confidence interval, the risk in each group, the relative change in risk, the absolute risk difference and the number needed to treat or harm. Looking at relative and absolute measures together gives the clearest picture of how much an exposure or treatment really matters.
How to Use the Relative Risk Calculator
Enter the four counts:
- a — exposed or treated, with the outcome
- b — exposed or treated, without the outcome
- c — not exposed or control, with the outcome
- d — not exposed or control, without the outcome
Choose the confidence level.
The results appear below.
The Formulas
risk exposed R₁ = a ÷ (a + b)
risk unexposed R₀ = c ÷ (c + d)
RR = R₁ ÷ R₀
SE(ln RR) = √(1/a − 1/(a + b) + 1/c − 1/(c + d))
CI = exp( ln RR ± z × SE )
risk difference = R₁ − R₀
number needed to treat or harm = 1 ÷ |R₁ − R₀|
Step-by-Step Example
40 of 100 exposed and 20 of 100 unexposed people develop the outcome.
R₁ = 40 ÷ 100 = 0.40 R₀ = 20 ÷ 100 = 0.20
RR = 0.40 ÷ 0.20 = 2
SE = √(1/40 − 1/100 + 1/20 − 1/100) = √0.055 = 0.2345
95% CI = exp(0.6931 ± 1.96 × 0.2345) = 1.26 to 3.17
Risk difference = 20 percentage points → 1 ÷ 0.20 = 5
The exposed group has twice the risk, a 100 percent increase. The interval excludes 1, so the increase is statistically significant. For every 5 people exposed, about one extra case occurs.
A Treatment Example
A trial: 10 of 200 treated patients and 20 of 200 controls have a stroke.
R₁ = 10 ÷ 200 = 5% R₀ = 20 ÷ 200 = 10%
RR = 0.05 ÷ 0.10 = 0.5
Relative risk reduction = 1 − 0.5 = 50%
Absolute risk reduction = 5 points → NNT = 1 ÷ 0.05 = 20
95% CI = 0.24 to 1.04
The treatment halves the risk, and about 20 patients need treating to prevent one stroke. But the interval runs just above 1, so with this sample size the benefit is not yet statistically certain.
Relative Versus Absolute Risk
Relative risk tells you how many times more or less likely something is; absolute risk tells you how many extra or fewer cases actually occur. Both matter. A drug that halves the risk of a condition affecting 20 in 100 people prevents 10 cases per 100 treated. The same halving for a condition affecting 2 in 10,000 prevents only 1 case per 10,000. Headlines tend to report relative risks because they sound more dramatic; the absolute difference and the number needed to treat show the real-world impact.
Number Needed to Treat
The number needed to treat (NNT) is the number of people who must receive a treatment for one to benefit. An NNT of 1 would mean everyone benefits; most effective preventive treatments have NNTs from about 20 into the hundreds. When the exposure increases risk, the same calculation gives the number needed to harm (NNH): how many people must be exposed for one extra person to be harmed. The calculator rounds these up to whole people, as is conventional.
Reading Risk in the News
Health stories often report that something "raises the risk by 50 percent" — a relative risk of 1.5. To judge whether that matters, ask what the baseline risk is. If 2 people in 1,000 normally develop a condition, a 50 percent increase takes it to 3 in 1,000: one extra case per 1,000 people, a number needed to harm of 1,000. If the baseline is 200 in 1,000, the same relative increase adds 100 cases per 1,000. Also check the confidence interval and the type of study. A single observational study showing a modest relative risk, with an interval that barely excludes 1, is weak evidence on its own, especially when confounding factors such as age, income or smoking could explain the association.
Relative Risk and Odds Ratio
For the example with risks of 40 and 20 percent, the relative risk is 2 but the odds ratio is 2.67. The two agree only when the outcome is rare. Relative risk needs the true risks, so it can be used in cohort studies and trials but not in case-control studies, where the number of cases is fixed by the researchers. For those, use the odds ratio instead.
Understanding Your Result
The headline is the relative risk.
The confidence interval line gives the plausible range and whether it excludes 1.
The risk in each group line shows the proportions behind the ratio.
The relative change line expresses the RR as a percentage increase or reduction.
The absolute difference line gives the risk difference and the number needed to treat or harm.
When Should You Use This Calculator?
Use it to summarise clinical trials and cohort studies.
Use it to judge the size of risks reported in news stories and papers.
Use it to calculate the number needed to treat for a treatment decision.
Use it for coursework in epidemiology and evidence-based medicine.
Common Mistakes
Using relative risk for a case-control study. Use the odds ratio.
Quoting relative risk without the baseline risk. Doubling a tiny risk is still small.
Mixing up the groups. Put the exposed or treated group in the first row.
Ignoring the confidence interval. A large effect from a small study may be chance.
Assuming causation. Observational studies can show association without cause.
Rounding the NNT down. It is conventionally rounded up to the next whole person.