Skip to content
Popular Calculators
Browse Statistics calculators

Odds Ratio Calculator

Find the odds ratio from a 2 × 2 table of exposure and outcome, with its confidence interval, z test and p-value.

For example, smokers who developed the disease.

About the Odds Ratio Calculator

The odds ratio (OR) measures the strength of association between an exposure and an outcome. It compares the odds of the outcome in an exposed group — smokers, people given a drug, customers who saw an advert — with the odds in an unexposed group. It is the standard measure in case-control studies, the natural output of logistic regression, and a common summary in medical research and epidemiology.

This odds ratio calculator takes the four counts of a 2 × 2 table and gives the odds ratio, its confidence interval at the level you choose, a z test with its p-value, the odds and risks in each group, and a plain-language reading of whether the association is statistically significant. If any count is zero, it applies the standard Haldane–Anscombe correction.

How to Use the Odds Ratio Calculator

Arrange your data as a 2 × 2 table and enter the four counts:

  • a — exposed, with the outcome
  • b — exposed, without the outcome
  • c — not exposed, with the outcome
  • d — not exposed, without the outcome

Choose the confidence level, usually 95%.

The odds ratio, interval and test appear below.

The Formulas

                  outcome    no outcome
  exposed            a            b
  not exposed        c            d

  OR = (a × d) ÷ (b × c)
  SE(ln OR) = √(1/a + 1/b + 1/c + 1/d)
  CI = exp( ln OR ± z × SE )          z = 1.96 for 95%

The interval is built on the log scale, where the sampling distribution is close to normal, and then converted back. That is why odds ratio intervals are not symmetric around the estimate.

Step-by-Step Example

40 of 100 exposed people and 20 of 100 unexposed people develop a condition.

  a = 40, b = 60, c = 20, d = 80
  Odds exposed:    40 ÷ 60 = 0.6667
  Odds unexposed:  20 ÷ 80 = 0.25
  OR = 0.6667 ÷ 0.25 = (40 × 80) ÷ (60 × 20) = 2.6667

  SE = √(1/40 + 1/60 + 1/20 + 1/80) = √0.104167 = 0.3227
  ln OR = 0.9808
  95% CI = exp(0.9808 ± 1.96 × 0.3227) = 1.42 to 5.02

The odds of the condition are about 2.67 times as high in the exposed group. The whole interval lies above 1, and the z test gives p ≈ 0.0024, so the association is statistically significant.

A Non-Significant Example

20 of 100 exposed and 10 of 100 unexposed.

  OR = (20 × 90) ÷ (80 × 10) = 2.25
  SE = √(1/20 + 1/80 + 1/10 + 1/90) = 0.4167
  95% CI = 0.99 to 5.09        p ≈ 0.052

The estimate suggests more than double the odds, but the interval just includes 1. The data is consistent with no association; a larger study would be needed to be sure.

Odds Ratio Versus Relative Risk

The relative risk compares probabilities: 40 percent against 20 percent is a relative risk of 2. The odds ratio compares odds, and for the same data it is 2.67. When the outcome is rare — under about 10 percent in both groups — odds and probabilities are nearly equal, and the two measures agree closely. When the outcome is common, the odds ratio is always further from 1 than the relative risk, and reporting it as if it were a relative risk exaggerates the effect. Relative risk is more intuitive, but it cannot be calculated from a case-control study, which is why odds ratios are so widely used.

Why Case-Control Studies Use Odds Ratios

In a case-control study, researchers pick people who already have a disease (cases) and similar people who do not (controls), then look back at their exposures. Because the researchers choose how many cases to include, the proportion with the disease in the study says nothing about the real risk. Remarkably, the odds ratio is unaffected by this sampling: the odds ratio of exposure between cases and controls equals the odds ratio of disease between exposed and unexposed. This symmetry makes the odds ratio the key measure for studying rare diseases efficiently.

Zero Counts

If any cell is zero, the odds ratio is zero or infinite and the standard error cannot be calculated. The usual fix, applied here automatically, is to add 0.5 to every cell. The result is a finite estimate with a wide interval — a reminder that the data holds little information. For very small tables, an exact method such as Fisher's exact test gives more reliable p-values.

Odds Ratios in Everyday Research

Odds ratios appear well beyond medicine. Marketers compare the odds that customers who saw a campaign go on to buy with the odds for customers who did not. Education researchers compare the odds of passing an exam with and without extra tutoring. Whatever the setting, the same four counts and the same formula apply.

Understanding Your Result

The headline is the odds ratio.

The confidence interval line gives the range of plausible values at your chosen level.

The what it means line says whether the interval lies above, below or across 1.

The odds in each group and risks lines show the figures behind the ratio, including the matching relative risk.

The significance test line gives the z statistic and two-sided p-value.

When Should You Use This Calculator?

Use it for case-control studies and other 2 × 2 tables of exposure and outcome.

Use it to check odds ratios reported in papers or produced by software.

Use it for coursework in epidemiology, medical statistics and biostatistics.

Use it to compare conversion odds between two versions of a web page or campaign.

Common Mistakes

Putting counts in the wrong cells. Keep exposure in the rows and outcome in the columns.

Reporting an odds ratio as a relative risk. They differ when the outcome is common.

Ignoring the confidence interval. A large odds ratio from a small study may not be significant.

Reading association as causation. Confounding factors can create an association without a causal link.

Forgetting the direction. An odds ratio below 1 means lower odds in the exposed group.

Frequently Asked Questions

How do I calculate an odds ratio?

Put the counts in a 2 × 2 table and divide the cross products: OR = (a × d) ÷ (b × c). With 40 of 100 exposed and 20 of 100 unexposed people affected, OR = (40 × 80) ÷ (60 × 20) = 3,200 ÷ 1,200 = 2.67.

How is the confidence interval for an odds ratio found?

Work on the log scale. The standard error of ln OR is √(1/a + 1/b + 1/c + 1/d), which is 0.3227 for the example. The 95 percent interval is exp(ln 2.67 ± 1.96 × 0.3227), about 1.42 to 5.02.

What does an odds ratio of 1 mean?

An odds ratio of 1 means the odds of the outcome are the same in both groups, so there is no association. Above 1 the outcome is more likely with the exposure; below 1 it is less likely, suggesting a protective effect.

What if the confidence interval includes 1?

Then the data is consistent with no association at that confidence level. For 20 of 100 exposed and 10 of 100 unexposed, the odds ratio is 2.25 but the 95 percent interval runs from 0.99 to 5.09, so the result is not significant.

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

Relative risk compares probabilities, while the odds ratio compares odds. In the example the risks are 40 and 20 percent, a relative risk of 2, but the odds ratio is 2.67. The two agree closely only when the outcome is rare.

What happens if one of the counts is zero?

A zero cell makes the odds ratio zero or infinite and its standard error undefined. The calculator then adds 0.5 to every cell, the Haldane–Anscombe correction, which gives a finite estimate and interval that should be interpreted cautiously.

Last reviewed September 28, 2026 by the CalculatorPeak editorial team.