statcompute

A/B testing

Odds Ratio Calculator

How much more likely an outcome is in one group than another, on the odds scale.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R
The Haldane-Anscombe correction — without it a zero cell makes the odds ratio 0 or infinite.

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

Odds are not probability. A probability of 0.75 is odds of 3 to 1. The odds ratio compares the odds in two groups, and an odds ratio of 2 does not mean the outcome is twice as likely — it means the odds are twice as large, which is a smaller effect on probability whenever the outcome is common.

Read the interval, and note where 1 sits. The null value for a ratio is 1, not 0. An interval that includes 1 means the data are consistent with no association.

The interval is asymmetric because it is computed on the log scale. Odds ratios are skewed — they run from 0 to 1 for negative associations and 1 to infinity for positive ones — so the arithmetic is done in logs and transformed back.

The odds ratio and the relative risk are both reported, and they differ. With a rare outcome they are close; with a common one the odds ratio is always further from 1. Reporting one as the other systematically overstates the effect, and it happens constantly in press coverage.

02

The formula

OR=adbcCI=exp(lnOR±z1a+1b+1c+1d)
a,b
the first group's counts with and without the outcome
c,d
the second group's

The standard error is computed on the log scale, which is where the sampling distribution is approximately normal.

03

Worked example

Exposure and outcome in two groups of a hundred

Of 100 exposed people, 30 have the outcome. Of 100 unexposed, 15 do. How much does exposure change the odds?

outcomeno outcome
exposed3070
unexposed1585
  1. The odds in each group.
    exposed 30/70 = 0.4286 unexposed 15/85 = 0.1765
  2. Their ratio.
    OR = 0.4286 / 0.1765 = 2.4286
  3. The standard error of ln(OR).
    √(1/30 + 1/70 + 1/15 + 1/85) = 0.3550
  4. The interval on the log scale, then exponentiated.
    exp(0.8873 ± 1.96 × 0.3550) = 1.211 to 4.870
  5. For comparison, the relative risk.
    0.30 / 0.15 = 2.00
odds ratio 2.4395% CI 1.21 to 4.87relative risk 2.00risk difference +15 pp

The odds ratio is 2.43 and the risk ratio 2.00. With an outcome this common — 30% and 15% — the two differ by a fifth, and quoting 2.43 as “more than twice as likely” would be wrong.

Checked against the standard log-odds interval, computed in R.

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

  • Counts, from independent observations, cross-classified into a 2×2 table.
  • Adequate cell counts for the log-normal approximation. With any cell below about 5, the exact interval from Fisher's exact test is preferable.
  • A zero cell needs a correction. Adding 0.5 to every cell (Haldane-Anscombe) is the standard fix and is applied by default; the result should be treated as approximate.

Odds ratios can be computed from case-control studies, where relative risk cannot — the row totals are fixed by design, so risk is not estimable. That property is the main reason the odds ratio is so widely used in epidemiology.

  • You want risk rather than oddsRelative riskMore intuitive when the rows are the groups being compared and the outcome is common.
  • The counts are smallFisher's exact testExact p-value and an exact conditional interval for the odds ratio.
  • You want to test the associationChi-square testThe significance test for the same table.
  • You have predictors as well as groupsLogistic regressionAdjusted odds ratios, controlling for other variables.
05

Questions people ask

What is the difference between an odds ratio and relative risk?

Relative risk compares probabilities; the odds ratio compares odds. When the outcome is rare they are nearly identical. When it is common the odds ratio is further from 1 — in the example above, 2.43 against 2.00 — so reporting an odds ratio as if it were a risk ratio overstates the effect.

What does an odds ratio of 1 mean?

No association: the odds are the same in both groups. Above 1 means higher odds in the first group, below 1 means lower. A confidence interval spanning 1 means the data cannot establish a direction.

Why is the confidence interval not symmetric?

Because it is computed on the log scale and transformed back. Odds ratios are bounded below by 0 and unbounded above, so a symmetric interval would be wrong — and could run negative.

What do I do about a zero cell?

Add 0.5 to every cell — the Haldane-Anscombe correction, applied by default here. Without it the odds ratio is 0 or infinite. For small tables generally, Fisher's exact test gives an exact interval that handles zeros properly.