Relative Risk Calculator

Risk ratio from two groups, with a confidence interval and absolute risk difference.

Health and FitnessUpdated 2026-10-202 min read
Relative Risk Calculator
People with the exposure who had the outcome.
People with the exposure who did not have the outcome.
People without the exposure who had the outcome.
People without the exposure who did not have the outcome.
Relative risk
...
Confidence interval...
Risk in exposed group...
Risk in unexposed group...
Absolute risk difference...
Direction...

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

  1. Enter the number of exposed people who had the outcome in cell a.
  2. Enter the number of exposed people who did not have the outcome in cell b.
  3. Enter the number of unexposed people who had the outcome in cell c.
  4. Enter the number of unexposed people who did not have the outcome in cell d.
  5. Choose a 90%, 95%, or 99% confidence level.
  6. Press Calculate to see the risk ratio, interval, risks, and risk difference.

Formula

RR = [a / (a + b)] / [c / (c + d)]. SE(ln RR) = sqrt(1/a - 1/(a + b) + 1/c - 1/(c + d)). CI = exp(ln RR ± z x SE).
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%.

  1. Exposed risk: 28 / (28 + 129) = 28 / 157 = 0.1783.
  2. Unexposed risk: 4 / (4 + 133) = 4 / 137 = 0.0292.
  3. RR = 0.1783 / 0.0292 = 6.11.
  4. SE of ln(RR) = sqrt(1/28 - 1/157 + 1/4 - 1/137) = 0.5216.
  5. 95% interval: exp(ln 6.11 ± 1.96 x 0.5216) = 2.2 to 16.98.
  6. Risk difference: 17.8 % - 2.9 % = +14.9 percentage points.

Reference table

Reading a relative risk
Relative riskPlain reading
Below 1Lower risk in the exposed group.
1The two groups have the same risk.
Above 1Higher risk in the exposed group.
6.11The 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

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.