Relative Risk Calculator

Quick answer

The relative risk calculator compares the risk of an outcome in an exposed and an unexposed (control) group from a 2 × 2 table. It returns the relative risk with a confidence interval and p-value, plus the odds ratio and its interval, the risk difference, the relative risk change and the number needed to treat or harm.

Relative risk (RR)
2
RR confidence interval – lower
0.9866
RR confidence interval – upper
4.0545
p-value (H₀: RR = 1)
0.0545
Risk in the exposed group
20 %
Risk in the control group
10 %
Risk difference
10 percentage points
Relative risk increase (+) / reduction (−)
100 %
Number needed to treat / harm
10
Odds ratio (OR)
2.25
OR confidence interval – lower
0.9943
OR confidence interval – upper
5.0915
Standard error of ln(RR)
0.36056
z value for the confidence level
1.96
Interpretation
No significant difference at this confidence level (interval includes 1)

Relative risk (the risk ratio) answers the question “how many times more likely is the outcome in the exposed group?”. Fill in a 2 × 2 table: a exposed people with the outcome, b exposed without it, c unexposed with it and d unexposed without it. The risk in each group is the share with the outcome, and the relative risk is their ratio. RR = 1 means no difference, RR = 2 means the risk is doubled and RR = 0.5 means it is halved.

A ratio from a sample is uncertain, so the calculator gives a confidence interval at the level you choose, built on the log scale where the sampling distribution is close to normal. If the interval includes 1, the data are consistent with no effect at that level; the accompanying p-value tells the same story.

Relative measures can make small effects sound large, so absolute ones are shown too: the risk difference in percentage points and the number needed to treat (or harm), which is how many people must be exposed for one extra outcome. The odds ratio, standard in case–control studies and logistic regression, is shown with its own interval; it is close to the relative risk only when the outcome is rare.

How to use the Relative Risk Calculator

  1. Exposed group, with the outcome (a)
  2. Exposed group, without the outcome (b)
  3. Control group, with the outcome (c)
  4. Control group, without the outcome (d)
  5. Confidence level

Results update as you type, and everything is calculated in your browser.

How it works

Risks are a/(a + b) and c/(c + d). The confidence interval uses the Katz log method; the odds ratio interval uses Woolf’s method, SE(ln OR) = √(1/a + 1/b + 1/c + 1/d). The p-value comes from the z statistic ln RR ÷ SE.

Worked example

20 of 100 exposed people and 10 of 100 controls develop the outcome. Risks: 20% and 10%, so RR = 2.0 and the risk difference is 10 percentage points (NNT = 10). SE(ln RR) = √(1/20 − 1/100 + 1/10 − 1/100) = 0.3606, so the 95% interval is exp(0.6931 ± 1.96 × 0.3606) = 0.987 to 4.054 and p = 0.055. The odds ratio is (20 × 90) ÷ (80 × 10) = 2.25 with a 95% interval of 0.994 to 5.092.

Interpreting the size of a relative risk

RR Meaning
0.5 Half the risk (50% reduction)
0.8 20% lower risk
1.0 No difference
1.5 50% higher risk
3.0 Three times the risk

Inputs explained

Field What to enter
Exposed group, with the outcome (a) A number
Exposed group, without the outcome (b) A number
Control group, with the outcome (c) A number
Control group, without the outcome (d) A number
Confidence level Choose one: 80%, 90%, 95%, 98% …

What each result means

  • Relative risk (RR) = [Exposed group, with the outcome (a)]÷([Exposed group, with the outcome (a)] + [Exposed group, without the outcome (b)])÷([Control group, with the outcome (c)]÷([Control group, with the outcome (c)] + [Control group, without the outcome (d)]))
  • RR confidence interval, lower = exp(ln([Relative risk (RR)]) – [z]×[se])
  • RR confidence interval, upper = exp(ln([Relative risk (RR)]) + [z]×[se])
  • p-value (H₀: RR = 1) = 2×(1 – ncdf(abs(ln([Relative risk (RR)]))÷[se]))
  • Risk in the exposed group = [Exposed group, with the outcome (a)]÷([Exposed group, with the outcome (a)] + [Exposed group, without the outcome (b)])×100
  • Risk in the control group = [Control group, with the outcome (c)]÷([Control group, with the outcome (c)] + [Control group, without the outcome (d)])×100
  • Risk difference = [Risk in the exposed group] – [Risk in the control group]
  • Relative risk increase (+) / reduction (−) = ([Relative risk (RR)] – 1)×100
  • Number needed to treat / harm = 100÷abs([Risk difference])
  • Odds ratio (OR) = [Exposed group, with the outcome (a)]×[Control group, without the outcome (d)]÷([Exposed group, without the outcome (b)]×[Control group, with the outcome (c)])
  • OR confidence interval, lower = exp(ln([Odds ratio (OR)]) – [z]×sqrt(1÷[Exposed group, with the outcome (a)] + 1÷[Exposed group, without the outcome (b)] + 1÷[Control group, with the outcome (c)] + 1÷[Control group, without the outcome (d)]))
  • OR confidence interval, upper = exp(ln([Odds ratio (OR)]) + [z]×sqrt(1÷[Exposed group, with the outcome (a)] + 1÷[Exposed group, without the outcome (b)] + 1÷[Control group, with the outcome (c)] + 1÷[Control group, without the outcome (d)]))
  • Standard error of ln(RR) = [se]
  • z value for the confidence level = [z]

Formula

RR = [a ÷ (a + b)] ÷ [c ÷ (c + d)] SE(ln RR) = √(1/a − 1/(a + b) + 1/c − 1/(c + d)) · CI = exp(ln RR ± z × SE) OR = (a × d) ÷ (b × c) · NNT = 1 ÷ |risk difference|

Worked example

Inputs: Exposed group – with the outcome (a): 20; Exposed group – without the outcome (b): 80; Control group – with the outcome (c): 10; Control group – without the outcome (d): 90; Confidence level: 95%.
Results: Relative risk (RR) = 2; RR confidence interval – lower = 0.9866; RR confidence interval – upper = 4.0545; p-value (H₀: RR = 1) = 0.0545; Risk in the exposed group = 20 %; Risk in the control group = 10 %; Risk difference = 10 percentage points; Relative risk increase (+) / reduction (−) = 100 %; Number needed to treat / harm = 10; Odds ratio (OR) = 2.25; OR confidence interval – lower = 0.9943; OR confidence interval – upper = 5.0915; Standard error of ln(RR) = 0.36056; z value for the confidence level = 1.96; Interpretation = No significant difference at this confidence level (interval includes 1).

Key terms

Risk
The probability of the outcome in a group, events ÷ group size.
Relative risk
The ratio of the risk in the exposed group to the risk in the control group.
Odds ratio
The ratio of the odds of the outcome in the two groups.
Number needed to treat
1 ÷ absolute risk difference.

Frequently asked questions

How do I interpret relative risk?

RR = 1: no difference. RR > 1: higher risk in the exposed group (RR = 2 means double). RR < 1: lower risk (RR = 0.75 means 25% lower).

What is the difference between relative risk and odds ratio?

RR compares probabilities, OR compares odds. They are similar when the outcome is rare (under about 10%); otherwise the OR is further from 1.

How is the confidence interval calculated?

On the log scale: ln RR ± z × √(1/a − 1/(a + b) + 1/c − 1/(c + d)), then exponentiated.

Why is my result not significant although RR = 2?

With small groups the interval is wide. Here 20/100 vs 10/100 gives a 95% interval of 0.99 to 4.05, which just includes 1 (p = 0.055).

What does NNT = 10 mean?

Ten people need the exposure or treatment for one extra person to have (or avoid) the outcome.

Can I use relative risk in a case–control study?

No, the groups are chosen by outcome, so risks cannot be estimated. Use the odds ratio.

What if one cell is zero?

The log-based interval breaks down. A common fix is to add 0.5 to every cell before calculating.

Sources

  1. NCBI Bookshelf: Relative risk (StatPearls)
  2. Penn State STAT 500: Applied Statistics
  3. OpenStax: Introductory Statistics 2e

Cite this calculator

Speedy Calculator. (2026). Relative Risk Calculator. Speedy Calculator. https://speedycalculator.com/calculators/statistics/relative-risk/