odds ratio confidence interval calculator

2×2 Odds Ratio & Confidence Interval Calculator

Enter counts from a standard 2×2 contingency table. This tool computes the odds ratio (OR), confidence interval (CI), and a two-sided Wald p-value.

Group Outcome Present (Cases) Outcome Absent (Controls)
Exposed
Unexposed
Useful when one or more table cells are zero.
Enter values and click Calculate to see results.

What this odds ratio calculator does

This page helps you calculate an odds ratio and its confidence interval from a 2×2 table. Odds ratios are common in case-control studies, cohort analyses, and logistic regression summaries.

In plain language, the odds ratio compares how the odds of an outcome differ between an exposed group and an unexposed group.

2×2 table setup

Use the following notation:

  • a = exposed with outcome
  • b = exposed without outcome
  • c = unexposed with outcome
  • d = unexposed without outcome

The odds ratio is calculated as:

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

How the confidence interval is computed

The calculator uses the log-transformed Wald method:

  • ln(OR) = ln((a×d)/(b×c))
  • SE = √(1/a + 1/b + 1/c + 1/d)
  • CI on log scale = ln(OR) ± z × SE
  • Back-transform using exp() to get the CI for OR

For 95% confidence, z = 1.96. For 90%, z = 1.645. For 99%, z = 2.576.

Zero cells and continuity correction

If any cell is zero, OR or SE can become undefined. This calculator can apply the classic Haldane–Anscombe continuity correction by adding 0.5 to all four cells when needed.

How to interpret the result

  • OR = 1: no association in odds.
  • OR > 1: higher odds of outcome in exposed group.
  • OR < 1: lower odds of outcome in exposed group.

Confidence intervals matter: if the CI includes 1, the result is not statistically significant at the chosen confidence level.

Example

Suppose: a = 30, b = 70, c = 20, d = 80. Then OR = (30×80)/(70×20) = 1.714. That suggests higher odds of outcome among exposed participants.

Best practices and caveats

  • Use odds ratios carefully when outcomes are common, because OR can overstate risk ratio interpretation.
  • For small samples, exact methods may be preferred over Wald intervals.
  • Association does not imply causation; consider confounding and study design.

When to use this tool

This calculator is useful for:

  • Rapid epidemiology checks
  • Medical and public health study summaries
  • Classroom biostatistics exercises
  • Quality-control and A/B style binary outcome analyses

🔗 Related Calculators