Relative Risk Calculator
Risk ratio from two groups, with a confidence interval and absolute risk difference.
What it does
Relative risk, also called risk ratio, compares the probability of an outcome in an exposed group with the probability in an unexposed group. It fits cohort studies and trials because both groups are followed forward and each risk has a real denominator.
This tool takes the four counts from a 2x2 table, computes the two risks, divides them, and adds a confidence interval on the log scale. It also reports the absolute difference, which shows how many percentage points separate the groups.
The defaults use 28 cases among 157 exposed people and 4 cases among 137 unexposed people. The risks are 17.8% and 2.9%, the relative risk is 6.11, and the 95% interval runs from 2.2 to 16.98. The absolute difference is 14.9 percentage points.
The ratio and the difference answer different questions. A relative risk of 6.11 sounds large, but the extra 14.9 percentage points is what matters for planning and for number needed to treat. Report both when the decision depends on absolute benefit or harm.
How to use
- Enter the number of exposed people who had the outcome in cell a.
- Enter the number of exposed people who did not have the outcome in cell b.
- Enter the number of unexposed people who had the outcome in cell c.
- Enter the number of unexposed people who did not have the outcome in cell d.
- Choose a 90%, 95%, or 99% confidence level.
- Press Calculate to see the risk ratio, interval, risks, and risk difference.
Formula
- a
- Exposed people with the outcome.
- b
- Exposed people without the outcome.
- c
- Unexposed people with the outcome.
- d
- Unexposed people without the outcome.
- RR
- Risk in the exposed group divided by risk in the unexposed group.
- z
- Normal multiplier: 1.645 for 90%, 1.96 for 95%, or 2.576 for 99%.
Each group needs at least one event; a zero in the case cells makes the ratio and its standard error undefined here. The interval is a large-sample approximation. For a rare outcome, the odds ratio is close to the risk ratio, but the two are not interchangeable.
Worked example
Example: 28 exposed cases and 4 unexposed cases
Defaults: a = 28, b = 129, c = 4, d = 133, confidence level 95%.
- Exposed risk: 28 / (28 + 129) = 28 / 157 = 0.1783.
- Unexposed risk: 4 / (4 + 133) = 4 / 137 = 0.0292.
- RR = 0.1783 / 0.0292 = 6.11.
- SE of ln(RR) = sqrt(1/28 - 1/157 + 1/4 - 1/137) = 0.5216.
- 95% interval: exp(ln 6.11 ± 1.96 x 0.5216) = 2.2 to 16.98.
- Risk difference: 17.8 % - 2.9 % = +14.9 percentage points.
Reference table
| Relative risk | Plain reading |
|---|---|
| Below 1 | Lower risk in the exposed group. |
| 1 | The two groups have the same risk. |
| Above 1 | Higher risk in the exposed group. |
| 6.11 | The example ratio, with an interval from 2.2 to 16.98. |
Limits
- Needs a cohort or trial with a known denominator for each group.
- Cannot be computed from case-control data, where the case-to-control ratio is set by the researcher.
- The normal approximation can be poor when either group has very few events.
- The unadjusted ratio does not account for age, sex, or other confounders.
Common mistakes
- Entering group totals in the case and non-case cells.
- Swapping exposed and unexposed groups, which inverts the ratio.
- Reporting the ratio without the two baseline risks.
- Reading a 20% lower relative risk as 20 fewer cases per 100 people.
- Using a risk ratio when zero events occurred in one group.
Try it yourself
Quick checks. Answers sit tucked under each question.
What is the relative risk for 40 cases in 200 exposed people and 10 cases in 200 unexposed people?
Risks are 20.0 % and 5.0 %. RR = 4 with a 95% interval of 2.06 to 7.78, and the risk difference is +15.0 percentage points.
Both groups have 15 cases in 100 people. What does the tool show?
RR = 1 with a 95% interval of 0.52 to 1.93. The risk difference is 0.0 percentage points.
One group has zero events. Can the tool compute a relative risk?
No. It returns a clear error because the ratio and its standard error are undefined with no event in a group.
Questions
Is relative risk the same as odds ratio?
No. Relative risk compares probabilities; an odds ratio compares odds. They are close only when the outcome is rare.
When can I use relative risk?
When both groups are followed forward and you know how many people were at risk in each group, as in a cohort study or a trial.
What does a relative risk of 1 mean?
The outcome risk is the same in both groups.
Why is the confidence interval so wide?
Only four unexposed cases are in the example, so the log risk ratio is estimated with little precision.
Should I report the risk difference too?
Yes when the decision depends on absolute benefit or harm. The ratio hides the baseline risk.
What if the outcome is rare?
The odds ratio and relative risk become similar, but the relative risk still needs a real denominator for each group.
Sources
- CDC, Principles of Epidemiology, measures of association
- StatPearls, Relative Risk
- Monaghan et al., odds ratios, relative risk, absolute risk, and number needed to treat