Relative Risk Calculator

Two-by-two table

Relative risk2.00
Risk in exposed20.0%
Risk in unexposed10.0%
95% confidence interval1.21 to 3.30
How this was calculated
  1. Risk in the exposed group = 40 / 200 = 20.0 percent.
  2. Risk in the unexposed group = 20 / 200 = 10.0 percent.
  3. The relative risk is the ratio of the two risks: 20.0 / 10.0 = 2.00.
  4. The 95% confidence interval uses the log method with standard error 0.255, giving 1.21 to 3.30.

This relative risk calculator turns a two-by-two table into the risk of an outcome in an exposed group divided by the risk in an unexposed group. Enter the events and group sizes, and it gives you the relative risk plus a 95 percent confidence interval. For example, 40 events in 200 exposed people (20.0 percent) against 20 in 200 unexposed people (10.0 percent) gives a relative risk of 2.00. A result below 1 points the other way: 15 of 150 against 30 of 150 gives 0.50, meaning the exposure is associated with lower risk.

The confidence interval uses the log method, the accepted standard for this calculation. The standard error of log(RR) is the square root of 1/a - 1/n1 + 1/c - 1/n0, which gives 1.21 to 3.30 for the 2.00 example and 0.28 to 0.89 for the 0.50 example. Relative risk is not the odds ratio: the two agree for rare outcomes and drift apart as outcomes get common, as in the 12.0 versus 10.0 percent example, where the relative risk is 1.20. This page shows the formula, step-by-step workings, worked examples and sources so you can check every number yourself.

Worked examples

Risk doubled

(40 · 200 · 20 · 200)

Relative risk2.00
Risk in exposed20.0%
Risk in unexposed10.0%
95% confidence interval1.21 to 3.30

Protective exposure

(15 · 150 · 30 · 150)

Relative risk0.50
Risk in exposed10.0%
Risk in unexposed20.0%
95% confidence interval0.28 to 0.89

Small increase

(120 · 1000 · 100 · 1000)

Relative risk1.20
Risk in exposed12.0%
Risk in unexposed10.0%
95% confidence interval0.93 to 1.54

Reading a two-by-two table

A two-by-two table sorts people into four cells by two questions: were they exposed, and did the outcome occur? Label the rows exposed and unexposed, and the columns events and no events. Everything a relative risk calculator needs sits in those four cells, and reading them in the right order keeps the arithmetic honest.

Take the worked example: 40 events among 200 exposed people, and 20 events among 200 unexposed people. The four cells are 40 (exposed, event), 160 (exposed, no event), 20 (unexposed, event) and 180 (unexposed, no event). The row totals, 200 and 200, are what you divide by. Risk in the exposed group is 40 divided by 200, which is 20.0 percent. Risk in the unexposed group is 20 divided by 200, which is 10.0 percent. Only after both risks are computed do you take their ratio: 20.0 percent divided by 10.0 percent gives a relative risk of 2.00. The exposed group's risk is twice the unexposed group's risk.

The same layout works when the exposure looks protective. With 15 events among 150 exposed and 30 among 150 unexposed, the risks are 10.0 percent and 20.0 percent, and the ratio is 0.50. A relative risk below 1 means the exposure is associated with lower risk. A value of exactly 1.00 would mean the two risks are equal. Because these are sample estimates, the page also reports a 95 percent confidence interval, built with the log method: the standard error of log(RR) is the square root of 1/a - 1/n1 + 1/c - 1/n0, where a and c are the event counts and n1 and n0 the group totals. For the 40-versus-20 example that gives 1.21 to 3.30; for the 15-versus-30 example, 0.28 to 0.89.

One caution belongs with the table. Relative risk is not the odds ratio. The two agree for rare outcomes and drift apart as outcomes get common, as in the 12.0 versus 10.0 percent example, where the relative risk is 1.20. If you have been handed an odds ratio, do not read it as a relative risk without checking how common the outcome is.

  • Exposed, event: 40 | Exposed, no event: 160 | Exposed total: 200
  • Unexposed, event: 20 | Unexposed, no event: 180 | Unexposed total: 200
  • Risk, exposed: 40 / 200 = 20.0 percent
  • Risk, unexposed: 20 / 200 = 10.0 percent
  • Relative risk: 20.0 percent / 10.0 percent = 2.00 (95 percent CI 1.21 to 3.30)
Compute the two risks first, then divide one by the other. A relative risk of 2.00 means double the risk, 0.50 means half the risk, and 1.00 means no difference between the groups.

The confidence interval, honestly

A relative risk on its own is a single number: the risk of an outcome in an exposed group divided by the risk in an unexposed group, read from a two-by-two table. A relative risk calculator that stops there leaves out the part most readers need, which is how much that number could plausibly move if the data had come out a little differently. That is what the 95 percent confidence interval describes, and the standard way to build it is the log method.

The log method works in a few ordered steps. First, take the natural logarithm of the relative risk. Second, compute the standard error of log(RR) as the square root of 1/a - 1/n1 + 1/c - 1/n0, where a and c are the event counts in the exposed and unexposed groups and n1 and n0 are the group sizes. Third, multiply that standard error by 1.96, the factor for 95 percent confidence, and add it to and subtract it from log(RR) to get the interval on the log scale. Fourth, exponentiate both ends to return to the relative risk scale. The log step matters because relative risk is a ratio, and ratios are lopsided: they can climb without limit above 1 but cannot fall below 0. Working on the log scale makes the interval symmetric before it is converted back.

Take the worked example: 40 events in 200 exposed (20.0 percent) against 20 in 200 unexposed (10.0 percent). The relative risk is 2.00, and the log-method interval runs from 1.21 to 3.30. Both ends sit above 1, so the data point consistently toward higher risk with exposure. Now take a relative risk below 1, where exposure is associated with lower risk: 15 of 150 against 30 of 150 gives 0.50, with an interval of 0.28 to 0.89. Both ends sit below 1, so the direction of the finding holds across the whole interval.

The third example is the instructive one. An interval of 0.93 to 1.54 straddles 1.0. A relative risk of exactly 1.0 means the two groups had the same risk, so an interval that crosses 1.0 contains that no-effect value among the results the data are compatible with. The point estimate may look like a real difference, but the study is not precise enough to rule out no effect. That is why an interval crossing 1.0 should be read as inconclusive about direction rather than as a confirmed harm or benefit. This is also why a relative risk calculator should show the interval next to the estimate, not instead of it.

One caution belongs here. Relative risk is not the odds ratio. The two agree for rare outcomes and drift apart as outcomes get common, as in the 12.0 versus 10.0 percent example, where the relative risk is 1.20. Keep that distinction in mind when comparing an interval from this page with one reported as an odds ratio.

ExampleExposedUnexposedRelative risk95% confidence interval
40 events in 200 exposed (20.0 percent)40 of 20020 of 2002.001.21 to 3.30
15 of 150 against 30 of 15015 of 15030 of 1500.500.28 to 0.89
Third exampleNot givenNot givenNot given0.93 to 1.54
12.0 versus 10.0 percent12.0 percent10.0 percent1.20Not given
An interval that crosses 1.0, such as 0.93 to 1.54, means the data cannot rule out no effect: a relative risk of 1.0 sits inside the range the study is compatible with.

Relative risk versus odds ratio and risk difference

The relative risk calculator on this page reports one of three related measures. The other two, the odds ratio and the risk difference, answer different questions from the same two-by-two table, and knowing which one a study reports matters when you read its conclusions. Relative risk compares risks directly: the risk in the exposed group divided by the risk in the unexposed group. The odds ratio compares odds instead of risks. The risk difference subtracts one risk from the other and reports the gap in percentage points.

Take the first worked example: 40 events in 200 exposed people (20.0 percent) against 20 events in 200 unexposed people (10.0 percent). The relative risk is 2.00, with a 95 percent confidence interval of 1.21 to 3.30. The risk difference for the same table is 20.0 minus 10.0, or 10.0 percentage points. The odds ratio is noticeably larger than the RR of 2.00 here, because the outcome is common: when roughly one in five exposed people has the event, odds and risks diverge. The odds ratio is not the relative risk, and on this table the gap is wide enough to change how impressive the association looks.

The two measures agree when outcomes are rare and drift apart as outcomes become common. A second example makes the drift plain: 12.0 percent against 10.0 percent gives a relative risk of 1.20, yet the odds ratio would sit further from 1.00. Neither number is wrong; they simply measure different things. Relative risk answers how many times more likely the outcome is among the exposed. The odds ratio answers how many times larger the odds are. For a patient or a reader deciding whether an exposure matters, the relative risk and the risk difference are usually the more intuitive pair, since both are built from risks you can state as percentages.

A relative risk below 1 means the exposure is associated with lower risk. In the protective example, 15 events of 150 against 30 of 150 gives a relative risk of 0.50, with a 95 percent confidence interval of 0.28 to 0.89. The risk difference there is 10.0 minus 20.0, or negative 10.0 percentage points, and the odds ratio again departs from the RR because the outcome is not rare.

Cohort studies, which follow exposed and unexposed groups forward and count events in each, can report any of the three. They report relative risk most often because the design yields risks directly, and they add the risk difference when the absolute size of the effect matters. Case-control studies, which select people by outcome rather than by exposure, cannot compute risks the same way and typically report the odds ratio instead. When a cohort study gives you an odds ratio, treat it with care if the outcome is common, as in the 20.0 versus 10.0 percent table.

Same table, three measures: 40 of 200 against 20 of 200 gives an RR of 2.00 (95 percent CI 1.21 to 3.30) and a risk difference of 10.0 percentage points. The odds ratio from that table comes out noticeably larger than the RR of 2.00 because the outcome is common.

What relative risk hides

A relative risk calculator gives you a single ratio, and a ratio can be honest and still mislead. The number tells you how many times larger one risk is than another, not how large either risk is. That distinction matters most when the baseline risk is small. A doubling from 0.1 percent is not the same event as a doubling from 10 percent. The first moves one person in a thousand to two in a thousand; the second moves one person in ten to two in ten. Both show a relative risk of 2.00, yet the practical difference in lives affected is enormous. Whenever you read a relative risk, look for the two underlying risks before you react to the ratio.

The size of the effect also depends on how much data stands behind it. The 95 percent confidence interval shows the range of values compatible with the observed counts, and it is computed on the log scale: the standard error of log(RR) is the square root of 1/a - 1/n1 + 1/c - 1/n0. Take 40 events in 200 exposed people (20.0 percent) against 20 events in 200 unexposed people (10.0 percent). The relative risk is 2.00, and the interval runs from 1.21 to 3.30. That interval excludes 1, so the result is statistically meaningful, but it still spans a modest increase to a more than threefold one. A ratio quoted without its interval hides that uncertainty.

Direction is the other thing a bare ratio can obscure. A relative risk below 1 means the exposure is associated with lower risk, not higher. If 15 of 150 exposed people have the outcome against 30 of 150 unexposed, the relative risk is 0.50, with an interval of 0.28 to 0.89. Read carelessly, 0.50 can look like a small or trivial number rather than a halving of risk. Always check which group is in the numerator and which is the reference before you interpret the direction.

Confounding is the deeper problem. An observed relative risk can reflect a third factor that differs between the exposed and unexposed groups rather than the exposure itself. When that factor is accounted for through adjustment, a relative risk that looked striking can shrink toward 1 or disappear. A single unadjusted ratio, however precise its interval, cannot rule this out; only the study design and the adjusted analysis can. It is also worth remembering that relative risk is not the odds ratio. The two agree for rare outcomes and drift apart as outcomes become common, as in a 12.0 versus 10.0 percent comparison where the relative risk is 1.20. If a report labels one as the other, the numbers may not mean what you think.

Before trusting any relative risk, find the baseline risk in each group, the confidence interval, and whether the analysis was adjusted for confounders. The ratio alone answers none of those questions.

FAQs

How is relative risk calculated?

Divide the risk in the exposed group by the risk in the unexposed group. In the first worked example, the exposed group had 40 events out of 200 and the unexposed group had 20 out of 200. So the calculation is (40/200) / (20/200), which equals 2.00.

What does a relative risk of 2.00 mean?

A relative risk of 2.00 means the outcome was twice as frequent in the exposed group as in the unexposed group over the study period. This describes an association between exposure and outcome. It is not proof of causation, since other factors could explain the difference.

What does a relative risk of 0.50 mean?

A relative risk of 0.50 means half the risk. The exposure is associated with fewer outcomes than in the unexposed group, as in the example comparing 10.0 percent with 20.0 percent. A value below 1.0 points to a lower risk in the exposed group, again describing an association rather than proof of cause.

Why is there a confidence interval?

Sample counts are noisy, so a single relative risk estimate carries uncertainty. The log-method confidence interval shows the range of true effects the data are compatible with. In the first example, that interval runs from 1.21 to 3.30. A narrow interval suggests a more precise estimate than a wide one.

Is relative risk the same as the odds ratio?

No. Relative risk and the odds ratio coincide for rare events but separate as events get common. Case-control studies usually report odds ratios because risks cannot be computed there. So the two measures answer related but distinct questions, and they should not be treated as interchangeable when events are frequent.

Can relative risk be negative?

No. Risks are proportions, so their ratio runs from 0 upward. A value of 1.0 means identical risk in both groups, values above 1.0 mean higher risk in the exposed group, and values below 1.0 mean lower risk. A relative risk can never be negative.

Sources

Related calculators

Framingham Risk Score Calculator
The D'Agostino 2008 Framingham general cardiovascular risk score: points for age, cholesterol, HDL, blood pressure, smoking and diabetes converted to a 10-year CVD risk percentage.
TIMI Risk Score Calculator (UA/NSTEMI)
The seven-item TIMI risk score for unstable angina and NSTEMI, with the 14-day composite event rate published for each score in the original Antman cohort.
ASCVD Risk Calculator
ASCVD risk calculator: 10-year risk of a first heart attack or stroke from the pooled cohort equations (Goff 2014) for ages 40 to 79.