Relative Risk Calculator
Enter how many people in an exposed group and in a control group did and did not experience the outcome. You get the risk ratio, two-sided and one-sided confidence intervals, a one-sided p-value, the z-score and the number needed to treat.
Related calculators
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
What relative risk means
Relative risk (RR), also called the risk ratio, compares how likely an outcome is in one group with how likely it is in another. Usually the first group is exposed to something (a drug, a chemical, a habit) and the second is an unexposed control, and the outcome is something you can count: an infection, an injury, a failure, a death.
RR = risk in the exposed group ÷ risk in the control group
Here risk is simply a proportion: the people who had the outcome divided by everybody in that group. An RR of 1 means both groups carry the same risk. An RR above 1 means the exposure is associated with more events, and an RR below 1 means fewer. An RR of 0.5 says the exposed group's risk is half the control's, and an RR of 3 says it is three times as high.
How to use the calculator
The form is a 2 × 2 table split over four boxes. Every person goes into exactly one of them.
- Negative events in exposed group: how many exposed people had the outcome you are counting. "Negative" only means "the event of interest"; it does not have to be bad news.
- Non-events in exposed group: how many exposed people did not have it.
- Negative events in the control group and Non-events in the control group: the same two counts for the comparison group.
- Confidence level: 95 is the default. Raise it for wider, more cautious intervals or lower it for narrower ones.
Enter counts of people, not percentages, and use at least 1 in every box. After you press Calculate the results table lists:
- the relative risk itself;
- a two-sided confidence interval, plus a left-sided interval (a lower bound only) and a right-sided interval (an upper bound only);
- a one-sided p-value and the z-score it comes from;
- the number needed to treat (NNT) and its confidence interval.
The formulas behind the numbers
Call the four counts a (exposed, event), b (exposed, no event), c (control, event) and d (control, no event). The two risks are a ÷ (a + b) and c ÷ (c + d), so:
RR = [a ÷ (a + b)] ÷ [c ÷ (c + d)]
Ratios are skewed, so the interval is built on the natural-log scale, where the estimate is closer to a normal distribution. The standard error of ln RR is
SE = √( 1/a − 1/(a + b) + 1/c − 1/(c + d) )
interval = exp( ln RR ± z × SE )z is 1.96 for a two-sided 95% interval.
That is why the interval is not centred on the RR: it is symmetric around ln RR and becomes asymmetric once you exponentiate. The z-score reported in the table is |ln RR| ÷ SE, and the p-value is the one-sided tail area beyond it. Double it if you want a two-sided p-value.
NNT = 1 ÷ |risk in exposed group − risk in control group|
Worked example
Suppose 200 workers are exposed to a solvent and 24 of them develop a skin condition, while 12 of 200 unexposed colleagues develop it. Enter 24, 176, 12 and 188 with a 95% confidence level.
| Quantity | Working | Result |
|---|---|---|
| Risk, exposed | 24 ÷ 200 | 0.12 (12%) |
| Risk, control | 12 ÷ 200 | 0.06 (6%) |
| Relative risk | 0.12 ÷ 0.06 | 2 |
| Standard error of ln RR | √(1/24 − 1/200 + 1/12 − 1/200) | 0.3391 |
| 95% interval | exp(0.6931 ± 1.96 × 0.3391) | 1.029 to 3.888 |
| z-score | 0.6931 ÷ 0.3391 | 2.044 |
| One-sided p-value | area beyond z = 2.044 | 0.0205 |
| NNT (harm) | 1 ÷ (0.12 − 0.06) | 16.667 |
The exposed workers have twice the risk, and the interval stays above 1, so a real increase is plausible. The lower end of 1.03 is barely above 1, which tells you the data only just rule out "no effect" at this confidence level. About 17 workers would need to be exposed for one extra case to appear.
A protective exposure works the same way. If 9 of 300 vaccinated people and 30 of 300 unvaccinated people fall ill, the risks are 3% and 10%, the RR is 0.30, and the 95% interval runs from 0.145 to 0.621. Its benefit NNT is 1 ÷ (0.10 − 0.03) = 14.3.
Number needed to treat: harm and benefit
The NNT turns a difference in risk into a head count. It is the number of people who must be treated (or exposed) for one additional person to benefit (or be harmed), and it is the reciprocal of the absolute risk difference. A treatment that prevents one event per 10 patients treated is far more effective than one that needs 50.
Because the sign of the risk difference matters, the calculator labels the result NNT (Harm) when the exposed group has the higher risk and NNT (Benefit) when it has the lower risk. In the vaccine example above it is 1 ÷ (0.10 − 0.03) = 14.3 people vaccinated per illness avoided. If the two groups have identical risks, the NNT is infinite and the line reports that it cannot be estimated.
The NNT interval comes from inverting the confidence limits of the risk difference. If those limits straddle zero, the true effect could be zero, meaning an infinite NNT, so the calculator prints the interval as a harm bound, then ∞, then a benefit bound. Read that as "not distinguishable from no effect", not as an error.
One-sided and two-sided results
A two-sided interval is the overlap of two one-sided intervals, each with half of the error rate. So a two-sided 90% interval excludes values below its lower limit with 95% confidence, and the same holds for the upper limit.
If you only care about one direction, for example whether the risk is higher at all, read the matching one-sided line instead: the left-sided interval gives a lower bound with an open upper end, the right-sided interval an upper bound with an open lower end. The p-value shown is also one-sided, so compare it with your one-sided significance threshold.
Setting the confidence level to 100 or above collapses every interval onto the point estimate, which is rarely useful. For a wide, cautious interval try 99.
Relative risk, odds ratio and hazard ratio
The three are related but not interchangeable. Relative risk compares probabilities, an odds ratio compares odds, and a hazard ratio compares instantaneous event rates over time. For rare outcomes the odds ratio and the risk ratio are almost identical; for common outcomes the odds ratio drifts away from 1 faster.
Which outcome you call the event also changes the answer. If 4% of one group and 5% of another fail, the risk ratio for failure is 0.80. Count the survivors instead (96% against 95%) and the ratio becomes 1.01. Define the event first, then keep it consistent.
Assumptions and common mistakes
- Swapped rows: putting the control counts in the exposed boxes inverts the ratio (RR becomes 1 ÷ RR).
- Percentages instead of counts: the standard error depends on the real group sizes, so always enter counts.
- Dependent groups: the formulas assume two independent groups. Matched pairs or repeated measures need other methods.
- Small counts: the interval uses a normal approximation on the log scale, which is rough when any cell is very small.
- Confounding: a raw risk ratio does not adjust for age, smoking or other factors that differ between the groups.
Results are statistical estimates for learning and quick checks, not medical or professional advice. See the disclaimer.
Frequently asked questions
What counts as a high or low relative risk?
1 means no difference. Anything above 1 means more events in the exposed group and anything below 1 means fewer. How large is large depends on the field and on the baseline risk: a doubling of a very rare event can still be a small absolute change, which is why the NNT is worth reading alongside the RR.
What does it mean if the confidence interval includes 1?
The data are compatible with no difference in risk at that confidence level. It does not prove there is no effect, only that this sample cannot separate an effect from chance.
How is relative risk different from an odds ratio?
Relative risk divides two probabilities (events per person), while an odds ratio divides two odds (events per non-event). They agree when the outcome is rare and diverge when it is common. Case-control studies can only estimate odds ratios.
When does the NNT line say Harm and when Benefit?
It says Harm when the exposed group has the higher risk, so the NNT counts how many people must be exposed for one extra event. It says Benefit when the exposed group has the lower risk, so the NNT counts how many must be treated to prevent one event. If both risks are equal there is no finite NNT.
References
- Cook RJ, Sackett DL (1995). The number needed to treat: a clinically useful measure of treatment effect. BMJ 310(6977):452-454.
- Altman DG (1998). Confidence intervals for the number needed to treat. BMJ 317(7168):1309-1312.
- Katz D, Baptista J, Azen SP, Pike MC (1978). Obtaining confidence intervals for the risk ratio in cohort studies. Biometrics 34(3):469-474.
Cite this calculator and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Relative Risk Calculator. Reeliy. https://reeliy.com/calculators/relative-risk-calculator“Relative Risk Calculator.” Reeliy, 2026, https://reeliy.com/calculators/relative-risk-calculator.