⚾
✓ Editorially reviewed by Derek Giordano, Founder & Editor · BA Business Marketing

Baseball Stats Calculator

Batting and pitching stats from box-score numbers

Updated October 2026

🧮
700+ calculators, no signup required
Finance · Health · Math · Science · Business
nnng.com
AVG = hits ÷ at bats; OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF); SLG = total bases ÷ at bats; OPS = OBP + SLG. A hitter with 150 hits in 500 at bats (30 doubles, 3 triples, 25 homers), 60 walks, 5 hit-by-pitches and 5 sacrifice flies slashes .300 / .377 / .522 with an .899 OPS. A pitcher with 60 earned runs in 180⅓ innings has a 2.99 ERA (60 × 9 ÷ 180.33), and 160 hits plus 50 walks give a 1.16 WHIP.

The Formulas, From MLB’s Glossary

StatFormula
Batting averageH ÷ AB
On-base percentage(H + BB + HBP) ÷ (AB + BB + HBP + SF)
Total bases1B + 2 × 2B + 3 × 3B + 4 × HR
SluggingTB ÷ AB
OPSOBP + SLG
Isolated powerSLG − AVG
ERA9 × earned runs ÷ innings pitched
WHIP(Walks + hits) ÷ innings pitched

Enter the season or game totals from a box score or scorebook. Hits include doubles, triples and homers; the calculator works out singles as hits minus extra-base hits. Innings use box-score notation, and the game-length menu sets the ERA scale.

A Worked Example: the Default Hitter and Pitcher

Singles are 150 − 30 − 3 − 25 = 92, so total bases are 92 + 60 + 9 + 100 = 261. AVG = 150 ÷ 500 = .300. OBP = (150 + 60 + 5) ÷ (500 + 60 + 5 + 5) = 215 ÷ 570 = .377. SLG = 261 ÷ 500 = .522, OPS = .899 and ISO = .222. For the pitcher, 180.1 innings is 180⅓ = 180.333, so ERA = 9 × 60 ÷ 180.333 = 2.99 and WHIP = (50 + 160) ÷ 180.333 = 1.16.

Three Hitters, Three Shapes

Batting lineAVGOBPSLGOPSISO
Default: 150 H in 500 AB, 30 2B, 3 3B, 25 HR, 60 BB, 5 HBP, 5 SF.300.377.522.899.222
Contact hitter: 170 H in 500 AB, 25 2B, 5 3B, 5 HR, 30 BB, 3 HBP, 4 SF.340.378.440.818.100
Power and walks: 120 H in 500 AB, 25 2B, 1 3B, 40 HR, 90 BB, 8 HBP, 4 SF.240.362.534.896.294
High school season: 28 H in 80 AB, 6 2B, 1 3B, 2 HR, 12 BB, 2 HBP, 1 SF.350.442.525.967.175

The contact hitter has the best average, yet the power-and-walks hitter, 100 points lower in average, nearly matches his on-base percentage (.362 against .378) and beats his OPS by 78 points. Average alone misses walks and extra bases. Small high school samples swing widely: three more hits in 80 at bats move the average almost 40 points.

Pitching Lines and Game Length

Pitching lineInnings usedERAWHIP
180.1 IP, 60 ER, 160 H, 50 BB (default)180.3332.991.16
Same line with 180.1 typed as a decimal (the mistake)180.1003.001.17
High school: 45.2 IP, 15 ER, 40 H, 20 BB, 7-inning games45.6672.301.31
Same high school line on a 9-inning scale45.6672.961.31

Scoring Mistakes and Edge Cases

Treating .1 as a tenth. In box scores, .1 and .2 mean one and two outs. Typing 180.1 into a plain formula understates innings; the error is small over a season and large for a reliever with 10.2 innings.

Counting walks as at bats. Walks, hit-by-pitches, sacrifice bunts and sacrifice flies are not at bats, so they never lower batting average. Sacrifice flies do count against OBP.

Counting reached-on-error as on base. MLB’s glossary excludes errors, fielder’s choices and dropped third strikes from OBP, and hit batsmen, errors and fielder’s choices from WHIP.

Charging unearned runs. Runs that score because of an error or passed ball are unearned and stay out of ERA.

Comparing across leagues and seasons. A .300 average or a 3.00 ERA means more in a low-scoring league. Compare with the league average for the same season and level.

Frequently Asked Questions

How do you calculate batting average?
Divide hits by at bats: 150 ÷ 500 = .300. Walks, hit-by-pitches and sacrifices are not at bats.
What is the OBP formula?
(Hits + walks + hit by pitch) ÷ (at bats + walks + hit by pitch + sacrifice flies).
How do you calculate ERA?
9 × earned runs ÷ innings pitched, converting partial innings to thirds; use 7 instead of 9 for seven-inning games.
What does 180.1 innings mean?
180 innings and one out, or 180⅓ innings.
Does a walk count as an at bat?
No. Walks, hit-by-pitches, sacrifice bunts and sacrifice flies are plate appearances but not at bats.
Do errors count in on-base percentage?
No. Reaching on an error, a fielder’s choice or a dropped third strike does not count as reaching base for OBP.
What is a good OPS?
It depends on the league and season; compare with that season’s league average, since offense levels change from year to year.

How to Use This Calculator

  1. Enter batting numbers — at bats, hits by type, walks, hit by pitch and sacrifice flies.
  2. Enter pitching numbers — innings (with .1/.2), earned runs, hits and walks allowed.
  3. Pick game length — 9, 7 or 6 innings for ERA.
  4. Read the slash line — AVG / OBP / SLG, OPS, ISO, ERA and WHIP.
📚 Sources & References
  1. [1] MLB.com Glossary. On-base percentage (OBP). Accessed Oct 2026. www.mlb.com
  2. [2] MLB.com Glossary. Slugging percentage (SLG). Accessed Oct 2026. www.mlb.com
  3. [3] MLB.com Glossary. Earned run average (ERA). Accessed Oct 2026. www.mlb.com
  4. [4] MLB.com Glossary. Walks and hits per inning pitched (WHIP). Accessed Oct 2026. www.mlb.com
✅ Editorial Standards — Every calculator is built from peer-reviewed formulas and official data sources, editorially reviewed for accuracy, and updated regularly. Read our full methodology · About the author