⚾ Batting Average Calculator
Enter hits, at-bats, and optional walks/total bases to compute batting average, on-base percentage (OBP), and slugging percentage (SLG).
Four numbers, four rates
Batting average is hits over at-bats. The other three widen the denominator or the numerator to count walks and extra-base hits:
AVG = H / AB
OBP = (H + BB) / (AB + BB)
SLG = TB / AB
OPS = OBP + SLG
The sample line - 45 hits in 150 at-bats, 10 walks, 63 total bases - gives .300, .344, .420 and an OPS of .764. Results print in baseball's leading-dot style to three decimals, so .300 means 30 hits per 100 at-bats.
Where total bases comes from
Total bases counts each hit by how far it went: a single is 1, a double 2, a triple 3, a home run 4.
TB = 1B + 2×2B + 3×3B + 4×HR
- The 63 in the example fits 31 singles, 12 doubles and 2 home runs: 31 + 24 + 8 = 63, and 31 + 12 + 2 = 45 hits.
- If you leave total bases equal to your hit count, SLG collapses to AVG, which is what happens to a batter who only ever singles.
- Walks lift OBP but never AVG or SLG. A player hitting .300 with 10 walks in 160 plate appearances is on base 34% of the time.
Frequently asked questions
How do you calculate batting average?
Divide hits by at-bats and round to three decimals. 45 hits in 150 at-bats is .300. Walks, sacrifices and hit-by-pitch are not at-bats, so they are left out entirely.
What is a good batting average?
.300 has been the marker of a strong hitter for a century. League average runs around .245 to .250, and .200 is the line below which a player is said to be batting under the Mendoza line.
Why is OPS not a percentage?
It adds two rates with different denominators, so it is an index rather than a real proportion. It is used because it is simple and tracks run scoring well; .800 is good and .900 is excellent.