{
  "id": "odds-ratio",
  "version": "5470074ab6b0",
  "status": "published",
  "name": "Odds Ratio Calculator",
  "question": "What is the odds ratio?",
  "summary": "Computes the odds ratio (ad ÷ bc) and the relative risk (risk ratio) from the four counts of a 2 × 2 table, with the risk and odds in each group.",
  "category": "statistics",
  "subcategory": "probability",
  "url": "https://www.acalculator.org/statistics/odds-ratio-calculator",
  "markdown": "https://www.acalculator.org/statistics/odds-ratio-calculator.md",
  "kind": "function",
  "method": "Risk, exposed = a ÷ (a + b); risk, unexposed = c ÷ (c + d); relative risk = risk exposed ÷ risk unexposed; odds ratio = (a ÷ b) ÷ (c ÷ d) = ad ÷ bc.",
  "assumptions": [
    "a and b are the exposed group (with and without the outcome); c and d are the unexposed group.",
    "No zero correction: when b or c is 0 there is no answer; when d is 0 the unexposed odds are not shown.",
    "The page gives point values only, not confidence intervals."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "a: exposed, with the outcome",
        "description": "People in the exposed group who have the disease or outcome.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "b": {
        "title": "b: exposed, without the outcome",
        "description": "People in the exposed group who do not have the outcome.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "c": {
        "title": "c: unexposed, with the outcome",
        "description": "People in the unexposed group who have the outcome.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "d": {
        "title": "d: unexposed, without the outcome",
        "description": "People in the unexposed group who do not have the outcome.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "or": {
      "label": "Odds ratio (OR)",
      "description": "ad ÷ bc: the odds of the outcome in the exposed group divided by the odds in the unexposed group.",
      "format": "number"
    },
    "rr": {
      "label": "Relative risk (risk ratio)",
      "description": "The risk in the exposed group divided by the risk in the unexposed group.",
      "format": "number"
    },
    "riskExposed": {
      "label": "Risk, exposed",
      "description": "The share of the exposed group with the outcome, a ÷ (a + b), as a percent.",
      "format": "percent"
    },
    "riskUnexposed": {
      "label": "Risk, unexposed",
      "description": "The share of the unexposed group with the outcome, c ÷ (c + d), as a percent.",
      "format": "percent"
    },
    "oddsExposed": {
      "label": "Odds, exposed",
      "description": "The odds of the outcome in the exposed group, a ÷ b.",
      "format": "number"
    },
    "oddsUnexposed": {
      "label": "Odds, unexposed",
      "description": "The odds of the outcome in the unexposed group, c ÷ d.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": 28,
      "b": 129,
      "c": 4,
      "d": 133
    },
    "outputs": {
      "or": 7.217054263565892,
      "rr": 6.10828025477707,
      "riskExposed": 17.8343949044586,
      "riskUnexposed": 2.9197080291970803,
      "oddsExposed": 0.21705426356589147,
      "oddsUnexposed": 0.03007518796992481
    },
    "text": "The odds ratio is 7.217 and the relative risk is 6.108."
  },
  "examples": [
    {
      "given": {
        "a": 28,
        "b": 129,
        "c": 4,
        "d": 133
      },
      "expect": {
        "or": 7.217054263565892,
        "rr": 6.10828025477707,
        "riskExposed": 17.8343949044586,
        "riskUnexposed": 2.9197080291970803
      },
      "source": "CDC, Principles of Epidemiology, Lesson 3, section 5, Example A (risk ratio 6.1) and Exercise 3.8 (OR = 28 × 133 ÷ (129 × 4) = 7.2); Python 3 cross-check in docs/progress/WP-126/xcheck.py; https://archive.cdc.gov/www_cdc_gov/csels/dsepd/ss1978/lesson3/section5.html"
    },
    {
      "given": {
        "a": 100,
        "b": 1900,
        "c": 80,
        "d": 7920
      },
      "expect": {
        "or": 5.2105263157894735,
        "rr": 5,
        "oddsExposed": 0.05263157894736842,
        "oddsUnexposed": 0.010101010101010102
      },
      "source": "CDC, Principles of Epidemiology, Lesson 3, section 5, Table 3.15 (risk 5.0% and 1.0%, RR 5.0, OR 792,000 ÷ 152,000 = 5.2); https://archive.cdc.gov/www_cdc_gov/csels/dsepd/ss1978/lesson3/section5.html"
    },
    {
      "given": {
        "a": 18,
        "b": 134,
        "c": 3,
        "d": 4
      },
      "expect": {
        "rr": 0.27631578947368424,
        "or": 0.1791044776119403
      },
      "source": "CDC, Principles of Epidemiology, Lesson 3, section 5, Example B (risk 11.8% and 42.9%, RR 0.28); OR by hand in content.mdx: 72 ÷ 402 = 0.179; https://archive.cdc.gov/www_cdc_gov/csels/dsepd/ss1978/lesson3/section5.html"
    }
  ],
  "sources": [
    "Centers for Disease Control and Prevention. Principles of Epidemiology in Public Health Practice, 3rd ed., Lesson 3, Section 5: Measures of Association (risk ratio, rate ratio, odds ratio, Examples A and B, Table 3.15), retrieved 2026-10-18. https://archive.cdc.gov/www_cdc_gov/csels/dsepd/ss1978/lesson3/section5.html"
  ],
  "related": [
    "nnt",
    "sensitivity-specificity",
    "incidence-rate",
    "chi-square",
    "probability"
  ],
  "changelog": []
}
