Odds ratio and risk ratio calculator

Enter the events and totals from a two-by-two table and get the odds ratio, risk ratio, and risk difference, each with a 95% confidence interval, plus the log effect and standard error for pooling.

An odds ratio is the odds of an event in the treatment arm divided by the odds in the control arm, while a risk ratio divides the two arms’ probabilities of the event and a risk difference subtracts them. This calculator takes a two-by-two table of events and totals, applies a continuity correction when a cell is zero, and reports each measure with its 95% confidence interval along with the log odds ratio and its standard error for meta-analysis.

Odds ratio

0.476

95% CI 0.269 to 0.841

Other effect measures

Risk ratio (RR)0.654 (95% CI 0.469 to 0.911)
Risk difference (RD)-0.180 (95% CI -0.315 to -0.045)
Chi-square test of association (1 df)6.61, p = 0.0101
Number needed to treat (fewer events on treatment)5.6

The number needed here is 1 divided by the absolute risk difference. For its confidence interval and the full benefit versus harm breakdown, use the dedicated number needed to treat calculator.

Meta-analysis ready

ln(OR)-0.7433
SE of ln(OR)0.2909
ln(RR)-0.4249
SE of ln(RR)0.1692

Paste the log effect size and its standard error straight into the meta-analysis calculator as the per-study inputs when pooling on the log scale.

Report-ready text

Treatment was associated with lower odds of the event (odds ratio = 0.48, 95% CI 0.27 to 0.84, chi-square = 6.61, p = 0.0101; risk ratio = 0.65, 95% CI 0.47 to 0.91; risk difference = -0.180, 95% CI -0.315 to -0.045).

Ratios, odds, and what they really compare

Both the odds ratio and the risk ratio answer the same broad question, has the event become more or less likely in one group than another, but they measure likelihood in different units. Risk is the plain probability of the event: the number of people who had it divided by everyone in the arm. Odds is that probability divided by its complement, the chance of the event against the chance of no event. A risk ratio compares two risks; an odds ratio compares two odds. When you read an effect aloud as “twice as likely,” you almost always mean a risk ratio of two, even when the table in front of you reports an odds ratio.

That distinction is harmless when the outcome is rare and dangerous when it is common. With a 2 per cent event rate, odds and risk are nearly equal and the two ratios agree to a decimal place. As the baseline rate climbs toward 30, 40, or 50 per cent, the odds ratio drifts steadily further from one than the risk ratio does, because the denominator of the odds shrinks as the event becomes common. Our side-by-side guide to how the odds ratio and risk ratio diverge works through the arithmetic with worked tables.

When to use which

Reach for a risk ratio whenever readers will interpret the result as a statement about probability, which covers most cohort studies and randomised controlled trials. It is intuitive and rarely overstates an effect. Reach for an odds ratio when the design forces it: case-control studies sample on the outcome, so risks cannot be estimated directly, and logistic regression produces odds ratios as its natural output. Whichever you pick, keep it consistent across the review and label it plainly, a discipline covered in our overview of choosing and reporting effect sizes.

Interpreting the numbers

A ratio of one means no difference. Below one signals a reduction in the event in the treatment arm; above one signals an increase. The confidence interval matters as much as the point estimate: if it crosses one, the data are compatible with no effect. Resist the urge to read an odds ratio of 3.0 as “three times the risk” when the outcome is common, because the corresponding risk ratio could be far closer to one. And always pair the relative measure with the absolute one. A risk difference, and the number needed to treat that follows from it, tells you whether a statistically clear effect is clinically worth anything.

A worked example

Take a trial where 30 of 100 treated patients have the event and 50 of 100 controls do. The risk in each arm is 0.30 and 0.50, so the risk ratio is 0.30 divided by 0.50, which is 0.60, a 40 per cent relative reduction. The odds are 30 over 70 and 50 over 50, giving odds of 0.4286 and 1.0, so the odds ratio is 0.4286, noticeably further from one than the risk ratio. The risk difference is 0.30 minus 0.50, which is minus 0.20, meaning twenty fewer events per hundred patients treated. Reporting the odds ratio of 0.43 alone would exaggerate the effect to a reader who hears it as a risk; the risk ratio of 0.60 and the absolute drop of twenty per hundred tell the honest story. To pool this with other trials, carry forward the log odds ratio and its standard error into the inverse-variance meta-analysis calculator.

Common mistakes

  • Reading an odds ratio as a risk ratio. The single most common error in reporting, and it inflates the apparent effect whenever the outcome is common.
  • Reporting only the relative measure. Without the risk difference, a reader cannot tell a life-changing benefit from a trivial one.
  • Mishandling zero cells. A zero event count makes the ratio or its standard error undefined; a continuity correction is needed, and it should be reported when applied.
  • Building symmetric intervals on the ratio scale. Intervals must be computed on the log scale and exponentiated back, or they will be wrong.
  • Mixing measures within one analysis. Pooling some studies as odds ratios and others as risk ratios without conversion corrupts the result; see our notes on reading the combined picture in a forest plot of ratio measures.

How it works

Let a and c be the events in the treatment and control arms, with arm totals n1 and n2, so the non-event cells are b = n1 - a and d = n2 - c. If any of the four cells is zero, 0.5 is added to all four cells (the Haldane-Anscombe continuity correction) before the formulas below run.

The odds ratio, on the log scale for its interval:

OR = (a * d) / (b * c)

SE(ln OR) = sqrt(1/a + 1/b + 1/c + 1/d)

95% CI = exp( ln(OR) +/- 1.96 * SE(ln OR) )

The risk ratio, also intervalled on the log scale:

RR = (a / n1) / (c / n2)

SE(ln RR) = sqrt(1/a - 1/n1 + 1/c - 1/n2)

95% CI = exp( ln(RR) +/- 1.96 * SE(ln RR) )

The risk difference, on the natural scale:

RD = a/n1 - c/n2

SE(RD) = sqrt( a*b/n1^3 + c*d/n2^3 )

95% CI = RD +/- 1.96 * SE(RD)

The constant 1.96 is the standard normal value for a 95% interval. The log odds ratio and its standard error are the per-study inputs for inverse-variance pooling.

Frequently asked questions

What is the difference between an odds ratio and a risk ratio?
A risk ratio compares the probability of the event in two groups, while an odds ratio compares the odds, which is the probability of the event divided by the probability of no event. When the outcome is rare the two are close, but as the event becomes common the odds ratio moves further from 1 than the risk ratio, so it can overstate the size of an effect if read as if it were a risk ratio.
Why apply a 0.5 continuity correction when a cell is zero?
The odds ratio and risk ratio formulas divide by cell counts and take logarithms, so a zero cell makes the estimate or its standard error undefined or infinite. Adding 0.5 to every cell keeps the calculation finite and is the standard Haldane-Anscombe correction. This calculator applies it to all four cells whenever any single cell is zero and tells you when it has done so.
Should I report an odds ratio or a risk ratio in my review?
Risk ratios are usually easier for readers to interpret because they speak directly about probabilities, so they are often preferred for cohort studies and trials. Odds ratios are standard for case-control studies and are the natural output of logistic regression. Whichever you choose, stay consistent across the review and state the measure clearly alongside its confidence interval.
How do I use this output in a meta-analysis?
Meta-analysis of ratio measures runs on the log scale. Take the log odds ratio and its standard error from this calculator for each study, pool them with inverse-variance weighting, and exponentiate the pooled value back to an odds ratio. The same approach applies to risk ratios using the log risk ratio and its standard error.
What does a risk difference add that the ratios do not?
A risk difference reports the effect in absolute terms, the change in the probability of the event, which a ratio never conveys on its own. A halving of risk sounds dramatic but means very little if the baseline risk was one in ten thousand. Reporting the risk difference alongside the ratio, and the number needed to treat derived from it, keeps the clinical importance of an effect in view.
Why are the confidence intervals calculated on the log scale?
Ratios are bounded at zero and skewed, so a symmetric interval on the natural scale would be wrong and could even dip below zero. Taking logarithms makes the sampling distribution roughly symmetric, so a standard normal interval is valid. The calculator builds the interval on the log scale and then exponentiates the limits back to the ratio scale, which is why the interval around the point estimate looks asymmetric.