Odds Ratio Calculator
A 2 × 2 table into both odds, the odds ratio, the log interval and a 95 % interval at 1.96.
What the odds ratio calculator does
It reads the four cells of a 2 × 2 table — a, b, c and d — and prints the odds in each group and their ratio. The exposed odds are a ÷ b, the unexposed odds are c ÷ d, and the odds ratio is (a × d) ÷ (b × c), which is the same as the exposed odds divided by the unexposed odds.
Twenty exposed cases against eighty exposed non-cases give odds of 0.25; ten unexposed cases against ninety give 0.1111. The ratio is 2.25. The page also prints ln(OR), its standard error √(1/a + 1/b + 1/c + 1/d), and a 95 % interval of exp(ln OR ± 1.96·SE), which here runs from 0.9943 to 5.0916.
Every cell must be at least 1. A zero cell makes an odds zero or infinite and the log interval undefined, so the page refuses it and names the cell rather than adding 0.5 to every cell: the Haldane correction is a decision about the data, and the page does not make it for you.
This is arithmetic on a table. It makes no claim about how the table was collected, whether the exposure caused the outcome, or what a result means clinically. Those are study-design and subject-matter judgements, and they are not on this page.
The four cells are whole numbers and each is taken from 1 to 1 000 000; a fractional count, a zero cell and a non-numeric value are refused by name.
Figures print to up to four decimal places with trailing zeros trimmed.
How to use it
Enter Exposed cases (a) and Exposed non-cases (b), then Unexposed cases (c) and Unexposed non-cases (d).
Press Run. The result prints both odds, the odds ratio, ln OR, its standard error and the 95 % interval.
Worked example
Input with the defaults:
a 20, b 80, c 10, d 90
Output:
Odds, exposed: 0.25 (a ÷ b = 20 ÷ 80)
Odds, unexposed: 0.1111 (c ÷ d = 10 ÷ 90)
Odds ratio: 2.25 (exposed odds ÷ unexposed odds)
95% CI: 0.9943 … 5.0916
Why it runs in your browser
The four odds and the interval are computed in this tab. Your table is never uploaded.
The page reads the four cells of a 2 × 2 table and prints both odds and their ratio. Twenty exposed cases against eighty exposed non-cases give odds of 0.25; ten unexposed cases against ninety give 0.1111, so the odds ratio is 2.25.
It also prints ln(OR), its standard error √(1/a + 1/b + 1/c + 1/d) and a 95 % interval of exp(ln OR ± 1.96·SE). With these defaults the interval runs from 0.9943 to 5.0916.
Every cell must be at least 1. A zero cell is refused with the cell named, rather than silently corrected: adding 0.5 to every cell is a decision about the data, and the page does not make it for you.
Odds, odds ratio and what they are not
The odds of an outcome in a group are the cases divided by the non-cases. The odds ratio divides one group's odds by the other's, which is the same as (a × d) ÷ (b × c). An odds ratio of 1 means the two groups have the same odds; above 1 means the exposed group's odds are higher.
An odds ratio is not a risk ratio, and the two diverge as the outcome becomes common. The relative-risk page computes the ratio of risks directly when the totals are known, which is why this page prints both odds rather than only the ratio.
Why a zero cell is refused
If any cell is 0, one of the odds is 0 or infinite, the log is undefined at one end, and the interval cannot be computed. The common fix is to add 0.5 to every cell — the Haldane correction — but that changes the data and the answer, and it is not always the right choice.
The page refuses and names the cell instead. A reader who has decided the correction is appropriate can apply it to the table and enter the corrected counts, which keeps the decision where it belongs.
How to use Odds Ratio Calculator
Enter Exposed cases (a) and Exposed non-cases (b).
Enter Unexposed cases (c) and Unexposed non-cases (d).
Press Run. The result prints both odds, the odds ratio, ln OR, its standard error and the 95 % interval.
What to Expect
Best for
- Turning a 2 × 2 count table into an odds ratio
- Reporting an interval for an odds ratio with all four cells
- Seeing the two group odds beside their ratio
Not ideal for
- A table with a zero cell, which needs a decision about a correction first
- A risk ratio from known totals, which the relative-risk page computes
- An adjusted odds ratio controlling for other variables
What this tool keeps
- All four cell counts
- The table orientation you entered
What may need cleanup
- A published table reported as percentages, which must become counts
- A zero cell, which must be corrected deliberately before entry
Common errors
- Swapping cases and non-cases between the groups
- Reading the odds ratio as a risk ratio for a common outcome
Example use cases
- Reading a case-control table
- Checking a published odds ratio from its raw cells
- Comparing two group odds directly
Sample input
a 20, b 80, c 10, d 90.
Sample output
Odds of 0.25 and 0.1111, an odds ratio of 2.25, and a 95 % interval from 0.9943 to 5.0916.
Who this is for
- Students reading a 2 × 2 table
- Analysts checking a reported odds ratio
Frequently asked questions
Why does the interval include 1?
With these counts the 95 % interval runs from 0.9943 to 5.0916, which includes 1, the value of no association. That is a statement about the precision of this table, not a verdict on any hypothesis.
Can I enter a zero cell?
No. A zero makes an odds zero or infinite and the log interval undefined. If you have decided a 0.5 continuity correction is right for your data, add 0.5 to all four cells and enter the corrected counts.
Is the odds ratio the same as relative risk?
No. The odds ratio compares odds and the risk ratio compares risks. They are close when the outcome is rare and diverge as it becomes common; the relative-risk page computes the risk ratio when the totals are known.
Does the page adjust for anything?
No. It is arithmetic on four counts. It does not adjust for confounders, weight a study design or make a causal claim, and the result line says so.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.