{
  "id": "era",
  "version": "3bcf95dc6291",
  "status": "published",
  "name": "ERA Calculator",
  "question": "What is my ERA?",
  "summary": "Computes a pitcher’s earned run average (ERA), the earned runs allowed per nine innings, from earned runs and innings pitched in box-score notation (6.2 is 6⅔ innings).",
  "category": "sports",
  "subcategory": "scoring",
  "url": "https://www.acalculator.org/sports/era-calculator",
  "markdown": "https://www.acalculator.org/sports/era-calculator.md",
  "kind": "function",
  "method": "ERA = earned runs × innings in a game ÷ innings pitched, with innings pitched in thirds (outs ÷ 3), so 6.2 is 20 outs, 6⅔ innings.",
  "assumptions": [
    "Innings pitched use box-score notation: the digit after the point counts outs (.1 is one out, .2 is two outs). Any other decimal has no answer.",
    "The ERA is scaled to 9 innings unless you change Innings in a game (a league of 7-inning games may use 7).",
    "Earned runs are whole numbers from 0 to 100,000; innings pitched are up to 100,000.",
    "With earned runs but no outs recorded the ERA is infinite, and with no outs and no runs there is none; both give no answer.",
    "The ERA is shown to two decimal places, rounded half up from the exact fraction."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "er": {
        "title": "Earned runs",
        "description": "The earned runs charged to the pitcher.",
        "type": "integer",
        "minimum": 0,
        "maximum": 100000
      },
      "ip": {
        "title": "Innings pitched",
        "description": "The innings pitched in box-score notation: .1 is one out and .2 is two outs, so 6.2 means 6⅔ innings.",
        "type": "number",
        "minimum": 0,
        "maximum": 100000
      },
      "inn": {
        "title": "Innings in a game",
        "description": "The innings in a regulation game that the ERA is scaled to: 9 in MLB and college baseball.",
        "type": "integer",
        "minimum": 1,
        "maximum": 12
      }
    }
  },
  "outputs": {
    "era": {
      "label": "ERA",
      "description": "Earned runs allowed per game of the chosen length: earned runs × innings in a game ÷ innings pitched, written with exactly two decimals as box scores print it (2.00).",
      "format": "text"
    },
    "innings": {
      "label": "Innings pitched",
      "description": "The innings pitched with the partial inning as a fraction, for example 6⅔.",
      "format": "text"
    },
    "outs": {
      "label": "Outs recorded",
      "description": "The innings pitched counted in outs: 3 per whole inning plus the partial outs.",
      "format": "integer"
    },
    "perInning": {
      "label": "Earned runs per inning",
      "description": "Earned runs ÷ innings pitched.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "er": 25,
      "ip": 90.1,
      "inn": 9
    },
    "outputs": {
      "era": "2.49",
      "innings": "90⅓",
      "outs": 271,
      "perInning": 0.2767527675276753
    },
    "text": "The ERA is 2.49 (earned runs 25, innings pitched 90⅓)."
  },
  "examples": [
    {
      "given": {
        "er": 3,
        "ip": 4,
        "inn": 9
      },
      "expect": {
        "era": "6.75",
        "innings": "4",
        "outs": 12,
        "perInning": 0.75
      },
      "source": "Baseball-Reference, Earned Run Average glossary (3 ÷ 4 × 9 = 6.75). https://www.baseball-reference.com/glossary/earned-run-average/"
    },
    {
      "given": {
        "er": 2147,
        "ip": 7356,
        "inn": 9
      },
      "expect": {
        "era": "2.63",
        "outs": 22068
      },
      "source": "Baseball-Reference, Earned Run Average glossary (2,147 ÷ 7,356 × 9, shown as 2.63). https://www.baseball-reference.com/glossary/earned-run-average/; Python 3: Fraction(2147 * 9, 7356)"
    },
    {
      "given": {
        "er": 3,
        "ip": 9.1,
        "inn": 9
      },
      "expect": {
        "era": "2.89",
        "innings": "9⅓",
        "outs": 28
      },
      "source": "hand calculation in content.mdx: 9.1 is 9⅓ innings, 28 outs; 3 × 9 × 3 ÷ 28 = 81/28 = 2.89 (formula from Baseball-Reference, https://www.baseball-reference.com/glossary/earned-run-average/)"
    },
    {
      "given": {
        "er": 58,
        "ip": 180.2,
        "inn": 9
      },
      "expect": {
        "era": "2.89",
        "innings": "180⅔",
        "outs": 542
      },
      "source": "hand calculation in content.mdx: 180.2 is 180⅔ innings, 542 outs; 58 × 9 × 3 ÷ 542 = 783/271 = 2.89 (formula from Baseball-Reference, https://www.baseball-reference.com/glossary/earned-run-average/)"
    },
    {
      "given": {
        "er": 10,
        "ip": 35,
        "inn": 7
      },
      "expect": {
        "era": "2.00",
        "perInning": 0.2857142857142857
      },
      "source": "hand calculation in content.mdx: 10 × 7 ÷ 35 = 2"
    },
    {
      "given": {
        "er": 0,
        "ip": 0.2,
        "inn": 9
      },
      "expect": {
        "era": "0.00",
        "innings": "⅔",
        "outs": 2
      },
      "source": "hand calculation in content.mdx: 0 × 9 × 3 ÷ 2 = 0"
    }
  ],
  "sources": [
    "Baseball-Reference, Earned Run Average (ERA) glossary: ERA = (earned runs ÷ innings pitched) × 9; worked examples 3 ER in 4 IP = 6.75, 2,147 ER in 7,356 IP = 2.63. https://www.baseball-reference.com/glossary/earned-run-average/",
    "Wikipedia, Earned run average (ERA = 9 × earned runs ÷ innings pitched; infinite ERA with no outs). https://en.wikipedia.org/wiki/Earned_run_average"
  ],
  "related": [
    "win-percentage",
    "percentage"
  ],
  "changelog": []
}
