{
    "name": "Baseball Batting Average Calculator",
    "url": "https://calculators.geekmidst.com/calculators/baseball-batting-average-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/baseball-batting-average-calculator.md",
    "category": "Everyday tools",
    "description": "Calculate a baseball batting average from hits and at-bats, plus on-base percentage, slugging percentage and OPS using the official stat definitions.",
    "summary": "Batting average is hits divided by at-bats, shown to three decimals (.300). Add walks, hit-by-pitches, sacrifice flies and extra-base hits to get OBP, SLG and OPS too.",
    "also_called": [
        "AVG calculator",
        "OPS calculator",
        "Softball batting average calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "hits",
            "label": "Hits (H)",
            "type": "number",
            "default": "150"
        },
        {
            "name": "at_bats",
            "label": "At-bats (AB)",
            "type": "number",
            "default": "500"
        },
        {
            "name": "doubles",
            "label": "Doubles (2B)",
            "type": "number",
            "default": "30",
            "optional": true
        },
        {
            "name": "triples",
            "label": "Triples (3B)",
            "type": "number",
            "default": "3",
            "optional": true
        },
        {
            "name": "home_runs",
            "label": "Home runs (HR)",
            "type": "number",
            "default": "20",
            "optional": true
        },
        {
            "name": "walks",
            "label": "Walks (BB)",
            "type": "number",
            "default": "60",
            "optional": true
        },
        {
            "name": "hbp",
            "label": "Hit by pitch (HBP)",
            "type": "number",
            "default": "5",
            "optional": true
        },
        {
            "name": "sac_flies",
            "label": "Sacrifice flies (SF)",
            "type": "number",
            "default": "5",
            "optional": true
        }
    ],
    "outputs": [
        {
            "key": "avg",
            "label": "Batting average (AVG)",
            "format": "text"
        },
        {
            "key": "obp",
            "label": "On-base percentage (OBP)",
            "format": "text"
        },
        {
            "key": "slg",
            "label": "Slugging percentage (SLG)",
            "format": "text"
        },
        {
            "key": "ops",
            "label": "OPS (OBP + SLG)",
            "format": "text"
        },
        {
            "key": "total_bases",
            "label": "Total bases",
            "format": "integer"
        }
    ],
    "formula": {
        "text": "AVG = H ÷ AB;  OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF);  SLG = (1B + 2×2B + 3×3B + 4×HR) ÷ AB;  OPS = OBP + SLG",
        "variables": {
            "1B": "singles = H − 2B − 3B − HR",
            "AB": "official at-bats",
            "BB, HBP, SF": "walks, hit-by-pitches and sacrifice flies"
        }
    },
    "worked_example": {
        "inputs": {
            "hits": "150",
            "at_bats": "500",
            "doubles": "30",
            "triples": "3",
            "home_runs": "20",
            "walks": "60",
            "hbp": "5",
            "sac_flies": "5"
        },
        "steps": [
            "AVG = 150 ÷ 500 = .300.",
            "OBP = (150 + 60 + 5) ÷ (500 + 60 + 5 + 5) = 215 ÷ 570 = .377.",
            "Singles = 150 − 30 − 3 − 20 = 97; total bases = 97 + 60 + 9 + 80 = 246; SLG = 246 ÷ 500 = .492.",
            "OPS = .3772 + .4920 = .869."
        ],
        "result": "A 150-for-500 season with 30 doubles, 3 triples and 20 home runs is a .300/.377/.492 slash line with an .869 OPS."
    },
    "interpretation": "AVG counts every hit the same and ignores walks. OBP shows how often a batter avoids making an out, and SLG how much damage each hit does, which is why OPS is a better single summary.",
    "assumptions": [
        "Definitions follow MLB’s official statistics; reaching on an error or fielder’s choice is not a hit or a time on base."
    ],
    "limitations": [
        "Sacrifice bunts are excluded from at-bats and OBP, as in the official definitions."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Why is batting average written without a leading zero?",
            "answer": "It is a convention: .300 is read “three hundred” and means 30% of at-bats ended in a hit."
        },
        {
            "question": "Do walks count as at-bats?",
            "answer": "No. Walks, hit-by-pitches, sacrifice flies and sacrifice bunts are plate appearances but not at-bats, so they do not lower a batting average."
        }
    ],
    "sources": [
        {
            "title": "Batting average (MLB.com glossary)",
            "url": "https://www.mlb.com/glossary/standard-stats/batting-average"
        },
        {
            "title": "Slugging percentage (MLB.com glossary)",
            "url": "https://www.mlb.com/glossary/standard-stats/slugging-percentage"
        },
        {
            "title": "On-base percentage (Baseball-Reference)",
            "url": "https://www.baseball-reference.com/glossary/?p=97"
        }
    ],
    "related": [
        {
            "name": "Basketball Effective Field Goal Percentage Calculator",
            "url": "https://calculators.geekmidst.com/calculators/basketball-effective-field-goal-percentage-calculator"
        },
        {
            "name": "Percentage Calculator",
            "url": "https://calculators.geekmidst.com/calculators/percentage-calculator"
        },
        {
            "name": "Average Calculator",
            "url": "https://calculators.geekmidst.com/calculators/average-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}