Odds Ratio Calculator With Relative Risk and 95% CI
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free odds ratio calculator. Enter a 2×2 table to get the odds ratio, relative risk and risk difference, each with a 95% confidence interval.
- 95% CI for the odds ratio
- 0
- Relative risk
- 0
- 95% CI for relative risk
- 0
- Risk difference
- 0
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the odds ratio calculator
Arrange your data as a 2 × 2 table:
| Outcome | No outcome | |
|---|---|---|
| Exposed | a | b |
| Not exposed | c | d |
- Enter a: the number of exposed people (or items) with the outcome.
- Enter b: exposed without the outcome.
- Enter c: not exposed, with the outcome.
- Enter d: not exposed, without the outcome.
"Exposed" can mean any factor you're studying: a treatment, a risk factor, a marketing campaign or a group. The odds ratio calculator shows the odds ratio with its 95% confidence interval, the relative risk with its 95% confidence interval, and the risk difference.
What is an odds ratio?
Odds compare the chance that something happens with the chance that it doesn't. If 20 out of 100 people have an outcome, the odds are 20 to 80, or 0.25. The odds ratio compares the odds in two groups:
Odds ratio = (a ÷ b) ÷ (c ÷ d) = (a × d) ÷ (b × c)
With the default data, 20 of 100 exposed people and 10 of 100 unexposed people have the outcome. The odds are 20 ÷ 80 = 0.25 in the exposed group and 10 ÷ 90 ≈ 0.111 in the unexposed group. The odds ratio is 0.25 ÷ 0.111 = (20 × 90) ÷ (80 × 10) = 2.25.
- An odds ratio of 1 means the odds are the same in both groups.
- Above 1 means the outcome is more likely in the exposed group.
- Below 1 means it's less likely in the exposed group.
The confidence interval
Because data comes from samples, the odds ratio is an estimate with uncertainty. The 95% confidence interval shows the range of values consistent with the data. The odds ratio calculator uses the standard log method, sometimes called the Woolf method:
SE of ln(OR) = √(1/a + 1/b + 1/c + 1/d)
95% CI = exp(ln(OR) ± 1.96 × SE)
For the default data, the interval is about 0.994 to 5.09. Because it includes 1, the data doesn't show a clear difference between the groups at the conventional 5% level, even though the estimate of 2.25 looks large. More data would narrow the interval.
Relative risk and risk difference
The odds ratio calculator also shows two related measures:
- Relative risk (risk ratio) compares the probability of the outcome: [a ÷ (a + b)] ÷ [c ÷ (c + d)]. For the default data, it's 20% ÷ 10% = 2. The exposed group is twice as likely to have the outcome.
- Risk difference is the absolute difference in probability: 20% − 10% = 10 percentage points.
Relative risk is easier to interpret than the odds ratio, but it can only be calculated directly from cohort studies and trials, where you follow groups forward and count outcomes. In case-control studies, where people are selected because they have or don't have the outcome, only the odds ratio is valid.
Odds ratio versus relative risk
When the outcome is rare, say under about 10% in both groups, the odds ratio and the relative risk are close. As the outcome becomes more common, the odds ratio moves further from 1 than the relative risk. In the default example, the odds ratio of 2.25 is noticeably larger than the relative risk of 2. With very common outcomes, the gap can be large, and reporting an odds ratio as if it were a relative risk overstates the effect. That's a common error in news reports of medical studies.
A worked example
In a study, 45 of 100 people who received a training programme passed an exam, compared with 15 of 100 who didn't.
- Table: a = 45, b = 55, c = 15, d = 85.
- Odds ratio: (45 × 85) ÷ (55 × 15) ≈ 4.64, with a 95% CI of about 2.36 to 9.11.
- Relative risk: 45% ÷ 15% = 3, with a 95% CI of about 1.79 to 5.02.
- Risk difference: 30 percentage points.
Because both intervals exclude 1, the data suggests a real difference. Note how much larger the odds ratio is than the relative risk, because passing the exam is a common outcome. Enter these figures in the odds ratio calculator to check.
Zero counts
If any cell in the table is zero, the odds ratio or its confidence interval can't be calculated directly. The odds ratio calculator then adds 0.5 to every cell, a standard adjustment called the Haldane–Anscombe correction, and tells you it has done so. Results with zero cells are very uncertain, and the confidence interval will be wide.
Who uses an odds ratio calculator
Epidemiologists and medical researchers use it to analyse case-control studies and clinical trials. Public health analysts use it to compare risks between groups. Social scientists use it for survey data. Marketers and product analysts use it to compare conversion between groups in experiments. Students use it in statistics, epidemiology and evidence-based medicine courses.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. That is the whole job of DeepRit: a PPC-only agency that sets up and runs Google Ads accounts so every click is accounted for. You keep full ownership of your account, get a written report every week, and can stop at any time. See our pricing or ask for a free audit.
Odds ratios in logistic regression
When researchers want to adjust for several factors at once, such as age, sex and smoking, they often use logistic regression. Its coefficients are log odds ratios, so exponentiating them gives adjusted odds ratios. The odds ratio calculator gives the unadjusted (crude) odds ratio from a single 2 × 2 table, which is a good first look at the data and a useful check on regression results.
Interpreting odds ratios below 1
An odds ratio below 1 means the exposure is associated with lower odds of the outcome, which is often described as protective. An odds ratio of 0.5 means the odds are halved. To make it easier to read, you can swap the groups: an odds ratio of 0.5 for exposed versus unexposed is the same as 2 for unexposed versus exposed.
Association, not causation
An odds ratio shows an association between exposure and outcome. On its own, it doesn't prove that the exposure causes the outcome. Confounding factors, bias in how people were selected, and chance can all produce associations. Randomised trials provide the strongest evidence of cause; observational studies need careful design and analysis.
Common mistakes
- Reporting an odds ratio as if it were a relative risk, especially for common outcomes.
- Ignoring the confidence interval and focusing only on the point estimate.
- Mixing up rows and columns in the 2 × 2 table, which inverts the result.
- Calculating relative risk from a case-control study, where it isn't valid.
Case-control studies
In a case-control study, researchers start with people who already have the outcome (cases) and a comparable group who don't (controls), then look back at how many in each group were exposed. Because the researchers choose how many cases and controls to include, the proportion with the outcome in the study doesn't reflect how common it is in the population, so risks and relative risks can't be calculated directly. The odds ratio is still valid, because it doesn't depend on the ratio of cases to controls. That's why case-control studies, which are common for rare diseases, report odds ratios. To use the odds ratio calculator with a case-control study, put the cases in the "with the outcome" column and the controls in the "without" column. Ignore the relative risk and risk difference it shows, which aren't meaningful for this design.
Sample size and precision
The width of the confidence interval depends mostly on the smallest counts in the table. Doubling every cell of the default data, to 40, 160, 20 and 180, leaves the odds ratio at exactly 2.25 but narrows the 95% confidence interval to roughly 1.3 to 4.0, which now excludes 1. If you're planning a study, use the odds ratio calculator with expected counts at different sample sizes to see how many people you need for a usefully precise answer.
Sources and further reading
- Odds ratio on Wikipedia: definition, interpretation and confidence intervals.
- Relative risk on Wikipedia: how it differs from the odds ratio.
- Szumilas M. Explaining odds ratios, Journal of the Canadian Academy of Child and Adolescent Psychiatry (2010).
Frequently asked questions
How is the odds ratio calculated?
OR = (a × d) ÷ (b × c), from a 2 × 2 table of exposure and outcome.
What does an odds ratio of 2 mean?
The odds of the outcome are twice as high in the exposed group as in the unexposed group.
What if the confidence interval includes 1?
The data doesn't show a clear difference between the groups at the 5% significance level.
When is the odds ratio close to the relative risk?
When the outcome is rare in both groups, roughly under 10%.
What happens if a cell is zero?
The calculator adds 0.5 to every cell so the odds ratio can be estimated, and tells you it has done so.
Is the odds ratio calculator free?
Yes. It's free, needs no sign-up, and works in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.