Skip to content

Batting Average, OBP & Slugging Calculator

Calculate batting average, on-base percentage, slugging, OPS and ISO from a batting line, or ERA, WHIP and K/9 for a pitcher, using the MLB rule definitions.

Calculator Details

AVG / OBP / SLG:.323 / .396 / .544See results ↓

A hitter’s batting line or a pitcher’s line

Plate appearances minus walks, hit by pitch, sacrifices and interference

All hits, including doubles, triples and home runs

Included in hits

Included in hits

Included in hits

Bases on balls, including intentional walks

Times hit by a pitch

Count against OBP but not AVG; sacrifice bunts count in neither

Your Results

AVG / OBP / SLG: .323 / .396 / .544

AVG / OBP / SLG

.323 / .396 / .544

OPS .940

  • Batting average (AVG)

    .323

  • On-base percentage (OBP)

    .396

  • Slugging (SLG)

    .544

  • OPS

    .940

  • Isolated power (ISO)

    .221

  • Total bases

    335

A .323/.396/.544 hitter (AVG/OBP/SLG) with an OPS of .940 and 335 total bases.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

Batting line
StatFormulaValue
Total bases1B + 2×2B + 3×3B + 4×HR335
AVGH ÷ AB.323
OBP(H + BB + HBP) ÷ (AB + BB + HBP + SF).396
SLGTB ÷ AB.544
OPSOBP + SLG.940
ISOSLG − AVG.221

How This Calculator Works

How it's calculated

The definitions follow MLB's Official Baseball Rules (Rule 9.21, determining percentage records). Rates are worked out unrounded, then rounded to three decimals as box scores show them (ERA and WHIP to two). OPS and ISO use the unrounded OBP, SLG and AVG.

With your numbers

1B = 199 − 44 − 1 − 30 = 124
TB = 124 + 2×44 + 3×1 + 4×30 = 335
AVG = 199 ÷ 616 = 0.323052
OBP = 276 ÷ 697 = 0.395983
SLG = 335 ÷ 616 = 0.543831
OPS = 0.939814

Frequently Asked Questions

How is batting average calculated?

Divide hits by official at bats: AVG = H ÷ AB. Three hits in 10 at bats is .300, read “three hundred”. Walks, hit-by-pitches, sacrifice bunts and sacrifice flies are not at bats, so they neither help nor hurt the average.

What is on-base percentage and why does it count sacrifice flies?

OBP is how often a batter reaches base by a hit, walk or hit-by-pitch: (H + BB + HBP) ÷ (AB + BB + HBP + SF). The rule adds sacrifice flies to the denominator, so a fly ball that scores a run still counts as a time the batter did not reach base. Sacrifice bunts are left out of both numerator and denominator, and reaching on an error does not count as on base.

How is slugging percentage different from batting average?

Slugging weighs each hit by the bases it earns: total bases ÷ at bats, with a single worth 1, a double 2, a triple 3 and a home run 4. It measures power, and it can be above 1.000. With the default 2024 line, Guerrero’s 335 total bases in 616 at bats give a slugging percentage of .544.

What is OPS?

On-base plus slugging, OBP + SLG. It combines getting on base with hitting for power in one number. Over a full season, an OPS around .800 is commonly treated as good and 1.000 as outstanding. The default line gives .940. OPS+ adjusts it for the ballpark and the league average; that needs league data and is not calculated here.

How do I enter innings pitched like 6.2?

Innings are written as whole innings plus outs, so .1 means one out (⅓ of an inning) and .2 means two outs (⅔). 6.2 innings is 6⅔, or 20 outs. Values like 6.3 or 6.5 are not valid. The calculator converts to outs before dividing, which is why its ERA matches the official figure.

How is ERA calculated?

Earned run average is the earned runs a pitcher allows per nine innings: ERA = 9 × ER ÷ IP. For example, 3 earned runs in 9⅓ innings is an ERA of 2.89. Unearned runs, those that score because of an error or passed ball, are left out.

What is WHIP?

Walks plus hits per inning pitched: (BB + H) ÷ IP. It measures how many baserunners a pitcher allows, regardless of whether they score. Hit batters and batters who reach on errors are not included. A WHIP near 1.00 is excellent for a starting pitcher.

Why do my numbers differ slightly from a website?

Usually rounding. Box scores round rates to three decimals (ERA to two), and OPS is OBP plus SLG before rounding, so adding two rounded figures can be off by .001. Small differences can also come from data sources that count catcher’s interference or reached-on-error differently, or that apply a minimum number of plate appearances for leaderboards.

Batting and pitching rates by MLB's Official Baseball Rules (Rule 9.21) and MLB.com glossary definitions, checked against published Baseball-Reference season lines. Defaults are Vladimir Guerrero Jr.'s 2024 batting line and Chris Sale's 2024 pitching line. Not included: park- and league-adjusted stats (OPS+, ERA+), wOBA, WAR, FIP, qualifying minimums for batting titles, and fielding.

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.

  1. Singles: 199 − 44 − 1 − 30 = 124
  2. Total bases: 124 + 88 + 3 + 120 = 335
  3. AVG: 199 ÷ 616 = .323
  4. OBP: (199 + 72 + 5) ÷ (616 + 72 + 5 + 4) = 276 ÷ 697 = .396
  5. SLG: 335 ÷ 616 = .544
  6. OPS: .39598 + .54383 = .940
  7. 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.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy