Relative Risk Calculator
Compare outcome risk between an exposed group and a control group, with a log-scale confidence interval for the risk ratio.
Study inputs
Relative risk
2 × 2 study table
| Group | Disease | No disease | Total | Risk |
|---|---|---|---|---|
| Exposed | 80 | 920 | 1,000 | 8.00% |
| Control | 10 | 990 | 1,000 | 1.00% |
How to use this relative risk calculator
What this calculator does
This calculator estimates a risk ratio, also called relative risk, from a two-group cohort-style table. It divides the observed disease risk in an exposed group by the observed disease risk in a control group, then calculates a two-sided confidence interval on the logarithmic scale. The result is a comparative measure: it tells you how many times the observed risk in one group is relative to the other. It does not establish causation, adjust for confounding, or replace a study-design-specific statistical analysis. The CDC Field Epidemiology Manual explains risk ratios in the context of analytic epidemiology.
When to use it
Use a risk ratio when you can directly estimate outcome risk in two groups, such as a cohort study, randomized trial, or outbreak investigation with exposed and unexposed populations. It is useful for comparing disease occurrence after an exposure, contrasting an intervention group with a control group, checking how a larger sample changes interval precision, or reproducing a published 2 × 2 risk-ratio calculation. For case-control studies, where the sampling design does not directly estimate risk, an odds ratio is usually the appropriate measure instead.
How to calculate
- The calculator opens with a complete demonstration: 80 disease cases and 920 non-cases in the exposed group, 10 cases and 990 non-cases in the control group, and a 95% confidence level. The results and a validated Excel workbook are available immediately.
- Replace the five values with your study counts and desired confidence level. Results update live. Read the Relative risk first, then use the Lower confidence bound and Upper confidence bound to assess the estimate's precision.
- Select Download Excel to export the current inputs, outputs, 2 × 2 table, and method notes. Reset clears the demonstration and all entered data; because an empty study cannot be exported, Download Excel is disabled until you enter another complete valid set.
Input guide
Confidence level is required and is entered as a percentage using a dot as the decimal separator, for example 95 or 99. It must be greater than 50 and less than 99.999. Higher confidence produces a larger Z-score and therefore a wider interval; lower confidence narrows it. Do not enter a percent sign inside the field or use a decimal comma such as 95,5.
Exposed group – Disease is the whole-number count of exposed participants with the outcome. This implementation requires at least 1 case so the logarithmic confidence interval remains finite; 80 is the demonstration value. Increasing this count while the exposed total is otherwise similar raises exposed risk and generally raises the relative risk. Exposed group – No disease is the whole-number exposed count without the outcome, may be zero, and is 920 in the example. Increasing it while cases stay fixed lowers exposed risk.
Control group – Disease is the whole-number count of control participants with the outcome and likewise must be at least 1; the demonstration uses 10. More control cases raise control risk and therefore reduce the relative risk when other values stay fixed. Control group – No disease is the whole-number count without the outcome, may be zero, and is 990 in the example. More control non-cases lower control risk and therefore tend to increase the relative risk. All four count fields reject negative values, fractions, scientific notation, grouping commas, and nonnumeric text.
Output guide
Relative risk is a unitless ratio. A value of 1 means equal observed risk; a value above 1 means higher observed risk in the exposed group; a value below 1 means lower observed risk. Lower confidence bound and Upper confidence bound are the endpoints of the selected two-sided interval. If the interval includes 1, the data are compatible with the null risk ratio under this approximation. Z-score is the standard-normal critical value implied by the Confidence level. Exposed risk and Control risk are displayed as percentages and are the two probabilities whose quotient produces Relative risk. The summary pills repeat those two risks and the selected confidence level for quick scanning. The 2 × 2 study table lists Group, Disease, No disease, Total, and Risk; its rows use the same canonical counts and risks as the result panel and Excel export.
Worked example
With 80 exposed cases and 920 exposed non-cases, exposed risk is 80 ÷ 1,000 = 0.08, or 8.00%. With 10 control cases and 990 control non-cases, control risk is 10 ÷ 1,000 = 0.01, or 1.00%. Relative risk is therefore 0.08 ÷ 0.01 = 8.000. At 95% confidence, the Z-score is approximately 1.960. The log-risk-ratio standard error is calculated from the four cell counts, giving a confidence interval of approximately 4.170 to 15.348. Because both bounds are above 1, this interval does not include the null value. A wider interval signals less precision; the CDC notes that imprecision often accompanies few events or small samples.
Formula and interpretation
If a is exposed disease, b is exposed no disease, c is control disease, and d is control no disease, then the risk ratio is:
The confidence interval uses ln(RR) ± Z × √(1/a + 1/c – 1/(a+b) – 1/(c+d)), followed by exponentiation. This is a large-sample log approximation and becomes unstable when event counts are extremely sparse. The calculator therefore rejects zero disease counts instead of inventing a continuity correction. For general background on how confidence levels use standard-normal critical values, see the NIST explanation of confidence intervals.
Interpret the ratio together with the actual risks and the interval. A ratio can be numerically large when the control risk is very small, even if the absolute difference is modest. Conversely, a ratio close to 1 can still matter in a high-risk setting. The CDC's epidemiology training materials emphasize that a risk ratio compares incidence proportions between groups, which is why correct group denominators are essential.
Common mistakes
- Do not enter percentages in the disease fields. They are counts, and each group risk is calculated from cases divided by that group's total.
- Do not swap the exposed and control groups unless you intend to invert the ratio. Reversing them changes RR to approximately 1/RR.
- Do not interpret a confidence interval as a probability that the true parameter lies inside this one realized interval. It is a repeated-sampling procedure tied to the chosen confidence level.
- Do not use this simple unadjusted ratio as a substitute for regression or stratified analysis when confounding, clustering, time-to-event data, or complex sampling materially affects the study.