Relative Risk and Odds Ratio Calculator (2×2 Table)
Relative risk, odds ratio, risk difference and number needed to treat from a 2×2 table, with 95 % confidence intervals.
Results
What this tool does
A 2×2 table compares how often an outcome happens with and without an exposure — a treatment, a habit, a risk factor. Relative risk compares the two rates directly and is what cohort studies and trials report; the odds ratio is what case-control studies can estimate, and it is close to the relative risk only when the outcome is rare. If a 95 % interval includes 1 the data are compatible with no effect. The risk difference and number needed to treat say how much an effect matters in practice, which a ratio alone hides. Intervals use the usual log method and need all four counts above zero.
Formula
RR = [a ÷ (a + b)] ÷ [c ÷ (c + d)] · OR = a d ÷ (b c) · 95 % CI = exp(ln θ ± 1.96 × SE)
Variables
| Symbol | Meaning | Unit |
|---|---|---|
a | Exposed, with the outcome (a) | — |
b | Exposed, without the outcome (b) | — |
c | Not exposed, with the outcome (c) | — |
d | Not exposed, without the outcome (d) | — |
RR | Relative risk | — |
RL | Relative risk, 95 % interval — lower | — |
RH | Relative risk, 95 % interval — upper | — |
OR | Odds ratio | — |
OL | Odds ratio, 95 % interval — lower | — |
OH | Odds ratio, 95 % interval — upper | — |
RD | Risk difference | % |
NN | Number needed to treat or harm (1 ÷ difference) | — |
Worked example
- Exposed, with the outcome (a)30
- Exposed, without the outcome (b)70
- Not exposed, with the outcome (c)15
- Not exposed, without the outcome (d)85
- Relative risk2.0000
- Relative risk, 95 % interval — lower1.1489
- Relative risk, 95 % interval — upper3.4817
- Odds ratio2.4286
- Odds ratio, 95 % interval — lower1.2110
- Odds ratio, 95 % interval — upper4.8704
- Risk difference15.00 %
- Number needed to treat or harm (1 ÷ difference)6.7
Limitations
- Standard deviation and variance are calculated for a sample (dividing by n − 1). For a full population, divide by n instead.
- This tool is informational only. It does not diagnose, treat or replace a qualified health professional. Speak to a doctor before making decisions about your health.