Percentages and Math

Odds Ratio and Relative Risk Calculator

Enter the four counts of a 2 by 2 table to compare the outcome in two groups.

Your numbers

Counts of people, items or events. Example data.

Between 50 and 99.99. Example value.

Result

Odds ratio

2.429

95% interval 1.211 to 4.870. Relative risk 2.000.

Odds ratio
2.429 (1.211 to 4.870)
Relative risk
2.000 (1.149 to 3.482)
Risk difference
15.00 points (3.61 to 26.39)
Risk in group 1
30.00%
Risk in group 2
15.00%
Odds in group 1
0.4286
Odds in group 2
0.1765
How this was calculated
  1. Risk = outcome yes / group size. Group 1: 30 / 100 = 30.00%. Group 2: 15 / 100 = 15.00%.
  2. Relative risk = risk 1 / risk 2 = 2.0000. Odds ratio = (a x d) / (b x c) = 2.4286, the same as the odds in group 1 divided by the odds in group 2.
  3. Intervals: the ratios use exp(ln estimate +/- z x standard error) with z = 1.9600. The risk difference uses its own standard error, sqrt(p1 (1 - p1) / n1 + p2 (1 - p2) / n2).
  • These numbers describe the table you entered and do not show cause and effect. The intervals assume the groups are independent samples and are rough when counts are small; the Fisher exact test is the usual check for small tables. This is general information and not medical advice.

Calculated using SumPanda.com · https://sumpanda.com/odds-ratio-relative-risk-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the odds ratio and relative risk calculator

  1. Enter the four counts: for group 1 how many had the outcome and how many did not, then the same for group 2. The names are neutral, so they work for exposed and unexposed, treated and untreated, or any two groups.
  2. Choose a confidence level. 95 is common; the example value is only a starting point.
  3. Read the odds ratio, the relative risk and the risk difference, each with its interval. The risks and odds of each group are listed under them.
  4. If a count is zero, check the notice: half a count is added to every cell for the two ratios, and that choice is explained on the page.

Formula

risk = outcome yes / group size odds = outcome yes / outcome no

relative risk = risk 1 / risk 2 odds ratio = (a x d) / (b x c)

risk difference = risk 1 - risk 2

interval for a ratio = exp(ln estimate +/- z x standard error)

The standard error of ln(odds ratio) is sqrt(1/a + 1/b + 1/c + 1/d). For ln(relative risk) it is sqrt(1/a - 1/(a+b) + 1/c - 1/(c+d)). The risk difference has its own standard error, sqrt(p1(1-p1)/n1 + p2(1-p2)/n2). With a zero cell, 0.5 is added to each of a, b, c and d for the two ratios.

Thirty of a hundred against fifteen of a hundred

Group 1 has 30 with the outcome and 70 without, and group 2 has 15 and 85. The risks are 30.00% and 15.00%, so the relative risk is 2.000 (95% interval 1.149 to 3.482) and the risk difference is 15.00 percentage points (3.61 to 26.39). The odds are 0.4286 and 0.1765, so the odds ratio is 2.429 (1.211 to 4.870).

At a 90% level the odds ratio interval narrows to 1.354 to 4.355. With a zero cell, such as 0 and 20 in group 1 and 5 and 15 in group 2, the corrected odds ratio is 0.0687 (0.0035 to 1.339) and the relative risk is 0.0909 (0.0054 to 1.542).

Three ways to compare two groups

The relative risk says how many times as likely the outcome is in one group as in the other. The risk difference says how many percentage points apart they are, which tells you how much it matters in practice. The odds ratio compares odds instead of chances; it is close to the relative risk when the outcome is rare and drifts further from it as the outcome becomes common.

A ratio of 1 and a difference of 0 mean no difference. If the interval for a ratio contains 1, or the interval for the difference contains 0, the data are consistent with no difference at that confidence level.

Small counts

The intervals used here are approximate and work best when every cell holds at least a handful of counts. For small tables an exact test is the safer check, such as the Fisher Exact Test Calculator. To test association in a larger table, see the Chi-Square Calculator.

More statistics tools

To check reliability, fit a curve or describe a distribution, try the Grouped Data Statistics Calculator, Skewness and Kurtosis Calculator and Kaplan-Meier Estimator.

Assumptions and limits

  • The two groups are independent samples, and each person or item appears once.
  • The counts are whole numbers. Rates or percentages must be turned into counts first.
  • Intervals are Wald intervals on the log scale for the ratios, which can be inaccurate for small counts.
  • The numbers describe association in the table you entered; they do not show cause and effect and they are not medical advice.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

When are the odds ratio and the relative risk almost the same?

When the outcome is rare in both groups. For common outcomes the odds ratio is further from 1 than the relative risk, so reading it as "times as likely" overstates the difference.

Why are 0.5 counts added when a cell is zero?

With a zero in a cell the ratio can be zero or not defined, and the log-scale interval cannot be computed. Adding 0.5 to every cell, the Haldane-Anscombe correction, gives finite values, but they are an approximation.

What does it mean when the interval includes 1?

The data fit a true ratio of 1, which means no difference, as well as the ratios inside the interval. It does not prove that there is no difference, especially when the interval is wide.

Can I swap the groups?

Yes. Swapping the groups turns each ratio into its reciprocal and changes the sign of the risk difference. The interval limits swap in the same way.