Batting average calculator

This batting average calculator divides hits by at-bats and also works out on-base percentage, slugging and OPS. For pitchers it calculates ERA and WHIP. A hitter with 120 hits in 400 at-bats bats .300.

Source: MLB, Official Baseball Rules 2026, Rule 9.02(a)(1) times at bat; Rule 9.21 Determining Percentage Records: (b) batting average, (c) slugging percentage, (e) earned-run average incl. Comment (9 1/3 innings, 3 earned runs = 2.89), (f) on-base percentage (read 10.10.2026). Updated: .

My ToolboxYour inputs are saved in this browser only.

Result

Result
AVG .300 · OBP .380 · SLG .485 · OPS .865
Calculation
StatCalculationResult
Batting average (AVG)120 ÷ 400.300
On-base percentage (OBP)(120 + 50 + 5) ÷ (400 + 50 + 5 + 5).380
Total bases (TB)120 + 25 + 2 × 2 + 3 × 15194
Slugging percentage (SLG)194 ÷ 400.485
OPS.380 + .485.865
Calculated with the formulas of Rule 9.21. Under Rule 9.02(a)(1) no time at bat is charged for a sacrifice bunt or fly, a walk, a hit-by-pitch or first base awarded on interference, obstruction or a shift restriction violation.

How it is calculated

Batting average = hits ÷ at-bats. That is how Rule 9.21(b) of the Official Baseball Rules defines it: divide the total number of safe hits (not the total bases on hits) by the total times at bat. 120 hits in 400 at-bats is .300.

Formulas from Rule 9.21 and the MLB glossary

Examples

At-batsHitsAVG
41.250
400120.300
550187.340

With 25 doubles, 2 triples, 15 home runs, 50 walks, 5 hit-by-pitches and 5 sacrifice flies, the same .300 hitter has 194 total bases, an OBP of .380 (175 ÷ 460), an SLG of .485 and an OPS of .865. For pitchers, the rule’s own example: 9 1/3 innings and 3 earned runs give an ERA of 2.89. With 8 hits and 2 walks in those innings, the WHIP is 1.07.

For 7-inning games the calculator can also multiply by 7 instead of 9 – a calculated variant, because Rule 9.21(e) itself uses 9. 3 earned runs in 7 innings are then 3.00, while the 9-inning formula gives 3.86.

Related: the average calculator and the online scoreboard.

Frequently asked questions

How do you calculate batting average?

Divide hits by at-bats: 120 ÷ 400 = .300. Walks, hit-by-pitches and sacrifice flies are not at-bats.

How is ERA calculated?

Earned runs × 9 ÷ innings pitched. Rule 9.21(e) gives the example 3 earned runs in 9 1/3 innings = 2.89.

What does 6.2 innings mean?

Six innings and two outs, that is 6 2/3 innings. Enter 6 full innings and 2 extra outs.

How is OPS calculated?

OPS is on-base percentage plus slugging percentage, for example .380 + .485 = .865.

How do I calculate ERA for 7 innings?

Multiply earned runs by 7 instead of 9 and divide by innings pitched: 3 earned runs in 7 innings give 3.00.

What is WHIP?

Walks plus hits divided by innings pitched; 10 walks and hits in 9 1/3 innings are 1.07.

Sources and legal basis

As of: · Editorial policy

Related tools