Batting average, OBP, SLG and ERA calculator
Enter a hitter's or a pitcher's counting stats and every rate stat is worked out as you type. It works the same for baseball and softball.
How to use it
Copy the counting stats from a scorebook, a league website or a box score into the hitting form. The results update as you type. Only at-bats and hits are needed for a batting average; fill in the rest for the full line. Impossible combinations, such as more home runs than hits, are flagged rather than silently producing nonsense.
For pitchers, enter innings the way box scores write them: 180.1 means 180 innings
and one out. If your league plays seven-inning games, as most high school baseball and softball
does, set the game length to 7 so that ERA and the per-game rates describe a full game in your
league rather than a nine-inning one.
The formulas
| Stat | Formula | What it measures |
|---|---|---|
| AVG | H ÷ AB | How often an at-bat ends in a hit |
| OBP | (H + BB + HBP) ÷ (AB + BB + HBP + SF) | How often a plate appearance reaches base |
| SLG | TB ÷ AB, TB = 1B + 2×2B + 3×3B + 4×HR | Bases per at-bat: power |
| OPS | OBP + SLG | A quick all-round hitting number |
| ISO | SLG − AVG | Extra bases per at-bat: raw power |
| BABIP | (H − HR) ÷ (AB − SO − HR + SF) | Hit rate on balls put in play |
| ERA | 9 × ER ÷ IP | Earned runs per nine innings |
| WHIP | (BB + H) ÷ IP | Base runners allowed per inning |
| K/9, BB/9, H/9 | 9 × SO (or BB, H) ÷ IP | Strikeouts, walks, hits per nine innings |
| K/BB | SO ÷ BB | Strikeouts for every walk |
Worked example
The default hitter has 150 hits in 500 at-bats, so the average is 150 ÷ 500 = .300.
Of the 150 hits, 30 are doubles, 5 triples and 20 home runs, leaving 95 singles. Total bases are
95 + 2×30 + 3×5 + 4×20 = 250, so slugging is 250 ÷ 500 = .500. With 60
walks, 5 hit-by-pitches and 5 sacrifice flies, on-base percentage is
(150 + 60 + 5) ÷ (500 + 60 + 5 + 5) = 215 ÷ 570 = .377, and OPS is
.377 + .500 = .877. BABIP, with 100 strikeouts, is
(150 − 20) ÷ (500 − 100 − 20 + 5) = 130 ÷ 385 = .338.
The default pitcher has thrown 180⅓ innings (541 outs) and allowed 60 earned runs, so ERA is
9 × 60 ÷ 180.33 = 2.99. With 45 walks and 150 hits, WHIP is
195 ÷ 180.33 = 1.08, and 190 strikeouts is 9.48 per nine innings.
Reading the numbers carefully
Rate stats are only as good as the sample behind them. Over 20 at-bats one extra hit moves a batting average by 50 points; over 500 at-bats it moves it by 2. BABIP in particular swings widely over short spells, which is exactly why analysts look at it: a hitter with an unusually high BABIP over a month is often getting lucky on where the ball lands, and tends to come back toward their norm.
ERA depends on the official scorer's split between earned and unearned runs, and on the fielders behind the pitcher. WHIP and the strikeout and walk rates are less affected by defence, which is why they are shown alongside. None of these numbers adjust for ballpark or league; comparing a high-school pitcher's ERA with a professional's, or a softball average with a baseball one, says little.
If you keep a whole team's results, the standings calculator turns game scores into a league table with run differential and winning percentage.
Common questions
How do you calculate batting average?
Hits divided by at-bats. 150 hits in 500 at-bats is .300. Walks, hit-by-pitches, sacrifice bunts and sacrifice flies are not at-bats, so they neither help nor hurt batting average; that is the main thing on-base percentage adds.
Why is a sacrifice fly in the OBP denominator but not a sacrifice bunt?
That is how the official rule defines it. OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF). A sacrifice fly counts as a plate appearance that did not reach base, so it lowers OBP slightly, while a sacrifice bunt is left out entirely. It is a convention rather than a principle, and it is why OBP can come out a hair below batting average for a hitter with no walks and several sacrifice flies.
How do you calculate ERA?
Earned runs × 9 ÷ innings pitched: the earned runs a pitcher would allow over a nine-inning game at their current rate. 60 earned runs in 180⅓ innings is 60 × 9 ÷ 180.33 = 2.99. For seven-inning games (high school baseball, softball) the multiplier is 7 instead of 9; choose it in the pitching form.
What does 6.1 innings pitched mean?
Six and one third innings: six full innings plus one out. The digit after the point counts outs, so it can only be 0, 1 or 2. Entering 6.1 as the decimal 6.1 would understate the innings slightly, which is why this calculator converts box-score notation to outs before doing any arithmetic.
What is OPS and why do people use it?
On-base plus slugging: OBP + SLG. It adds a measure of getting on base to a measure of hitting for power, and although adding two fractions with different denominators is mathematically untidy, it tracks run scoring well enough that it became the most widely quoted single hitting number. More refined measures such as wOBA weight each event by its run value.
Other tools
- League manager How do I keep our league table and fixtures up to date for free?
- Tournament bracket maker How do I run a bracket for 11 teams and keep it up to date?
- Printable tournament brackets Where can I print a blank 16-team bracket?
- Round-robin schedule generator Who plays whom each week in a 7-team league?
- League standings calculator Turn our season results into a league table.
- Magic number calculator How many more wins does the leader need to clinch?
- Bowling score calculator How is a bowling score with strikes and spares worked out?
- Golf handicap calculator What is my handicap index from my last rounds?
- Odds converter and implied probability What probability does -150 actually mean?