Batting Average Calculator: AVG, OBP, Slugging, OPS, ERA and WHIP
By FindMySum · Last reviewed
A batting average calculator turns a hitter's counting stats into the rate stats you see on a scoreboard. Enter at bats, hits, doubles, triples, home runs, walks, hit-by-pitches and sacrifice flies, and this one returns batting average, on-base percentage, slugging percentage, OPS, isolated power and total bases. Switch to pitching and it calculates ERA, WHIP and strikeouts, walks and hits per nine innings from innings pitched.
The batting formulas
Major League Baseball defines the percentage stats in its Official Baseball Rules:
- Batting average (AVG) = hits ÷ at bats
- On-base percentage (OBP) = (hits + walks + hit by pitch) ÷ (at bats + walks + hit by pitch + sacrifice flies)
- Slugging percentage (SLG) = total bases ÷ at bats
- Total bases = singles + 2 × doubles + 3 × triples + 4 × home runs, where singles = hits − doubles − triples − home runs
Two widely used stats are built from those:
- OPS = OBP + SLG, a quick measure of overall hitting
- Isolated power (ISO) = SLG − AVG, the extra bases per at bat, which strips singles out of slugging
The rates are calculated unrounded and rounded once, to three decimals, as box scores print them.
Worked example: Vladimir Guerrero Jr., 2024
The calculator opens with Guerrero's 2024 season for the Toronto Blue Jays: 616 at bats, 199 hits (44 doubles, 1 triple, 30 home runs), 72 walks, 5 hit-by-pitches and 4 sacrifice flies.
- Singles: 199 − 44 − 1 − 30 = 124
- Total bases: 124 + 88 + 3 + 120 = 335
- AVG: 199 ÷ 616 = .323
- OBP: (199 + 72 + 5) ÷ (616 + 72 + 5 + 4) = 276 ÷ 697 = .396
- SLG: 335 ÷ 616 = .544
- OPS: .39598 + .54383 = .940
- ISO: .54383 − .32305 = .221
Those match his published line of .323/.396/.544. The three numbers written with slashes, AVG/OBP/SLG, are the usual shorthand for a hitter's season.
Reading the numbers
Each stat answers a different question. Batting average asks how often an at bat ends in a hit, and treats every hit the same. On-base percentage asks how often the batter avoids making an out, so it rewards walks. Slugging asks how much damage each at bat does, giving a home run four times the weight of a single. OPS simply adds the last two, which double-counts hits slightly but tracks run scoring well enough to be the most quoted single number for hitters.
The pitching formulas
- ERA = 9 × earned runs ÷ innings pitched
- WHIP = (walks + hits) ÷ innings pitched
- K/9, BB/9, H/9 = 9 × strikeouts, walks or hits ÷ innings pitched
Innings pitched are written as whole innings plus outs: 177.2 means 177 innings and two outs, or 177⅔. The calculator converts to outs first and divides by three, so it never treats .2 as two-tenths of an inning, the most common mistake when working ERA by hand.
With the pitching default, Chris Sale's 2024 season for Atlanta, 47 earned runs in 177⅔ innings gives 9 × 47 ÷ 177.667 = 2.38, and 39 walks plus 141 hits gives a WHIP of 180 ÷ 177.667 = 1.01.
Earned and unearned runs
ERA only counts earned runs, those the official scorer decides would have scored without an error or a passed ball. If a fielder's error extends an inning, runs that score after the third out should have been made are unearned. This is why a pitcher's ERA can be much lower than the total runs he allowed per nine innings, and why ERA depends partly on the scorer's judgement.
Limits of the basic stats
Rate stats don't account for the ballpark, the league's run environment or the quality of opponents. Analysts use adjusted versions such as OPS+ and ERA+, which set the league average at 100, and more detailed measures such as weighted on-base average (wOBA) and fielding-independent pitching (FIP). They need league-wide data and are not calculated here. For team standings, use the winning percentage calculator.
More questions
What counts as an at bat?
Every plate appearance except a walk, a hit-by-pitch, a sacrifice bunt, a sacrifice fly and catcher's interference. Reaching on an error and hitting into a fielder's choice are at bats that count as outs for batting average, which is why they lower it.
Why is a batting average written without the leading zero?
Convention from newspaper box scores. Batting averages are almost always below 1, so .300 saves a character and is read aloud as three hundred. The same style is used for OBP, slugging and winning percentage, while ERA is written with its whole number, as in 2.38.
Who has the highest career batting average?
Ty Cobb is generally credited with the highest career average in major-league history, about .367. MLB recognised the Negro Leagues of 1920 to 1948 as major leagues in December 2020; since their statistics were added to its records in 2024, Josh Gibson has led the career list at about .372.
Can I use this for softball or little league?
Yes. The formulas are the same in softball and youth baseball. For ERA, use the number of innings in a regulation game for the league's version, for example seven instead of nine: multiply earned runs by 7 instead of 9, or multiply the calculator's ERA by 7/9.
What is a quality OBP compared with batting average?
On-base percentage runs higher than average because it adds walks and hit-by-pitches. A hitter who walks often can have an ordinary average and an excellent OBP. Many analysts value OBP more than average because not making an out is the most important thing a batter does.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.