How to calculate batting average
MLB’s Rule 9.21 says: divide the hits by the at-bats. Walks, hit by pitch, sacrifices and times reaching on interference don’t count as at-bats, so they don’t change the average. Averages are written to 3 decimals, usually without the leading zero (.300).
Here it is with your numbers:
- Batting average: 150 ÷ 500 = .300.
- Total bases: 95 singles + 2 × 30 + 3 × 5 + 4 × 20 = 250.
- Slugging: 250 ÷ 500 = .500.
- Times on base: 150 hits + 60 walks + 5 hit by pitch = 215.
- Plate appearances that count: 500 + 60 + 5 + 5 sacrifice flies = 570.
- On-base: 215 ÷ 570 = .377.
- OPS: on-base + slugging, from the exact fractions, = .877.
It means the batter got a hit in 30% of official at-bats.
Source MLB · Official Baseball Rules, 2026 edition (Rules 9.02 and 9.21) ↗
On-base percentage, slugging and OPS
- On-base percentage (OBP) = (hits + walks + hit by pitch) ÷ (at-bats + walks + hit by pitch + sacrifice flies). Reaching on an error or a fielder’s choice doesn’t count.
- Slugging percentage (SLG) = total bases ÷ at-bats, where a single is 1 base, a double 2, a triple 3 and a home run 4.
- OPS = on-base percentage + slugging percentage. We add the exact fractions, then round, so OPS can differ by .001 from adding the two rounded figures.
Source MLB.com Glossary · On-base Plus Slugging (OPS) ↗MLB.com Glossary · On-base Percentage (OBP) ↗
How to calculate ERA (earned run average)
Rule 9.21(e): multiply the earned runs by 9 and divide by the innings pitched, including part innings. Each out is a third of an inning (Rule 9.02(c)), so box scores write 6⅔ innings as 6.2. The rulebook’s own example: 3 earned runs in 9⅓ innings is an ERA of 2.89.
Here it is with your numbers:
- Innings: 180.1 means 180 innings and 1 out, each out a third of an inning, so 180 1/3 innings (541 outs).
- Runs × 9: 60 × 9 = 540.
- ERA: 540 ÷ 180 1/3, or 1,620 ÷ 541 outs, = 2.99 (exact 2.9945, to 2 decimals).
It means the pitcher gave up 2.99 earned runs for every 9 innings pitched.
Sources
- MLB: Official Baseball Rules, 2026 edition (Rules 9.02 and 9.21)
- MLB.com Glossary: On-base Plus Slugging (OPS)
- MLB.com Glossary: On-base Percentage (OBP)