Batting and pitching stats from box-score numbers
Updated October 2026
| Stat | Formula |
|---|---|
| Batting average | H ÷ AB |
| On-base percentage | (H + BB + HBP) ÷ (AB + BB + HBP + SF) |
| Total bases | 1B + 2 × 2B + 3 × 3B + 4 × HR |
| Slugging | TB ÷ AB |
| OPS | OBP + SLG |
| Isolated power | SLG − AVG |
| ERA | 9 × 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.
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.
| Batting line | AVG | OBP | SLG | OPS | ISO |
|---|---|---|---|---|---|
| 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 line | Innings used | ERA | WHIP |
|---|---|---|---|
| 180.1 IP, 60 ER, 160 H, 50 BB (default) | 180.333 | 2.99 | 1.16 |
| Same line with 180.1 typed as a decimal (the mistake) | 180.100 | 3.00 | 1.17 |
| High school: 45.2 IP, 15 ER, 40 H, 20 BB, 7-inning games | 45.667 | 2.30 | 1.31 |
| Same high school line on a 9-inning scale | 45.667 | 2.96 | 1.31 |
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.