# What is my batting average?

Computes a batting average (hits ÷ at-bats) as Official Baseball Rule 9.21 defines it, with on-base percentage, slugging percentage and OPS when you add walks, hit by pitches, sacrifice flies and extra-base hits.

- Page: https://www.acalculator.org/sports/batting-average-calculator
- JSON spec: https://www.acalculator.org/sports/batting-average-calculator.json
- Version: cab427588b25

## Default answer

Example with the default inputs (Hits (H) 165, At-bats (AB) 440): 165 hits in 440 at-bats is a batting average of .375.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| h | Hits (H) | Safe hits of any kind: singles, doubles, triples and home runs. |
| ab | At-bats (AB) | Official times at bat: plate appearances minus walks, hit by pitches, sacrifices and catcher’s interference. |
| bb | Walks (BB) | Bases on balls, intentional ones included. Leave empty to skip OBP. |
| hbp | Hit by pitch (HBP) | Times hit by a pitch. Empty counts as 0. |
| sf | Sacrifice flies (SF) | Sacrifice flies. Empty counts as 0. |
| d | Doubles (2B) | Two-base hits. Fill in any of 2B, 3B or HR to get slugging and OPS. |
| t | Triples (3B) | Three-base hits. Empty counts as 0. |
| hr | Home runs (HR) | Home runs. Empty counts as 0. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| average | Batting average (AVG) | Hits ÷ at-bats. |
| display | Batting average | The batting average to three places, as box scores write it. |
| obp | On-base percentage (OBP) | (H + BB + HBP) ÷ (AB + BB + HBP + SF). |
| slg | Slugging percentage (SLG) | Total bases ÷ at-bats. |
| ops | OPS | On-base percentage + slugging percentage. |
| totalBases | Total bases (TB) | H + 2B + 2 × 3B + 3 × HR. |

## Method

AVG = H ÷ AB; OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF); SLG = TB ÷ AB with TB = H + 2B + 2 × 3B + 3 × HR; OPS = OBP + SLG.

## Assumptions

- At-bats are official at-bats (Rule 9.02(a)): walks, hit by pitches, sacrifice bunts and flies, and catcher’s interference do not count.
- Empty walks leave out OBP and OPS; empty doubles, triples and home runs leave out slugging and OPS. Inside each, an empty count is 0.

## Worked examples

1. h = 165, ab = 440 gives average = 0.375, display = .375. Source: Official Baseball Rules (2025), Rule 9.22(a) Minimum Standards for Individual Championships, example (Baker, .375), https://baseballrulesacademy.com/official-rule/mlb/9-22-minimum-standards-individual-championships/.
2. h = 165, ab = 452 gives average = 0.365044, display = .365. Source: Official Baseball Rules (2025), Rule 9.22(a), example (.365 with 12 more at-bats), https://baseballrulesacademy.com/official-rule/mlb/9-22-minimum-standards-individual-championships/.
3. h = 150, ab = 500, bb = 60, hbp = 5, sf = 5, d = 30, t = 2, hr = 25 gives average = 0.3, display = .300, obp = 0.377193, totalBases = 259, slg = 0.518, ops = 0.895193. Source: Official Baseball Rules (2025), Rule 9.21 Determining Percentage Records, https://baseballrulesacademy.com/official-rule/mlb/9-21-determining-percentage-records/.
4. h = 3, ab = 16 gives average = 0.1875, display = .188. Source: Official Baseball Rules (2025), Rule 9.21 Determining Percentage Records, https://baseballrulesacademy.com/official-rule/mlb/9-21-determining-percentage-records/.

## FAQ

### How do you calculate a batting average?

Divide hits by official at-bats. Official Baseball Rule 9.21 says to divide the safe hits, not the total bases, by the times at bat. 165 hits in 440 at-bats is 165 ÷ 440 = .375.

### Do walks count as at-bats?

No. Walks, hit by pitches, sacrifice bunts, sacrifice flies and catcher’s interference are plate appearances but not at-bats, so they do not change the batting average. Walks and hit by pitches do raise the on-base percentage.

### How is a batting average rounded?

It is written to three decimal places with the leading zero left off, so 0.2875 is written .288. This page rounds half up from the exact fraction: 3 hits in 16 at-bats is 0.1875 and is written .188.

### What is a good batting average?

In Major League Baseball, .300 or better is excellent and about .250 is typical; few regular hitters finish below .200. In youth and amateur leagues, averages are often higher because of the level of pitching and defence.

### How do you calculate OBP, slugging and OPS?

OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF). Slugging = total bases ÷ AB, where total bases = H + 2B + 2 × 3B + 3 × HR. OPS = OBP + SLG. A .300 hitter with 60 walks, 5 HBP, 5 SF and 259 total bases in 500 at-bats has a .377 OBP, a .518 SLG and a .895 OPS.

### How many plate appearances does a batting title need?

Rule 9.22(a) asks for 3.1 plate appearances per scheduled game, 502 in a 162-game season. A player short of that still wins if his average stays the highest after the missing appearances are added as hitless at-bats: Baker’s 165 for 440 (.375) becomes 165 for 452, .365.

## Sources

- Official Baseball Rules (2025), Rule 9.21 Determining Percentage Records: batting average, slugging percentage and on-base percentage. https://baseballrulesacademy.com/official-rule/mlb/9-21-determining-percentage-records/ (retrieved 2026-10-01)
- Official Baseball Rules (2025), Rule 9.22(a) Minimum Standards for Individual Championships, with the Baker example. https://baseballrulesacademy.com/official-rule/mlb/9-22-minimum-standards-individual-championships/ (retrieved 2026-10-01)
