Batting Average Calculator

Direct answer

A baseball batting average (BA) is hits divided by at-bats: BA = H ÷ AB. For the default line of 45 hits in 150 at-bats, BA = 45 ÷ 150 = .300 — that is 3 hits per 10 at-bats. The same line gives an on-base percentage (OBP) of .383, a slugging percentage (SLG) of .487 (73 total bases ÷ 150 at-bats) and an OPS of .870. Enter your own numbers below and the tool computes BA, OBP, SLG, total bases and OPS for you.

Batting Average Calculator










Batting average formula: 45 hits divided by 150 at-bats equals .300
Figure 1. Batting average — BA = 45 ÷ 150 = .300, or 3 hits per 10 at-bats — averagecalculatoronline.com

Inputs

FieldDefault
Hits (H)45
At-bats (AB)150
Walks / bases on balls (BB)20
Hit by pitch (HBP)2
Sacrifice flies (SF)3
Singles (1B)30
Doubles (2B)8
Triples (3B)1
Home runs (HR)6

Outputs

OutputFormulaDefault result
Batting average (BA)H ÷ AB.300
On-base percentage (OBP)(H + BB + HBP) ÷ (AB + BB + HBP + SF).383
Slugging percentage (SLG)Total bases ÷ AB.487
Total bases1B + 2×2B + 3×3B + 4×HR73
OPSOBP + SLG.870

Defaults on load: 45 H / 150 AB, BB 20, HBP 2, SF 3, 1B 30, 2B 8, 3B 1, HR 6 → BA .300, OBP .383, SLG .487, total bases 73, OPS .870. The tool must show these results before the visitor types anything, and must recalculate on every input change. At-bats greater than 0 are required; with 0 at-bats the tool shows a message instead of a number. If the hit breakdown (1B + 2B + 3B + HR) does not equal hits, the tool shows a warning but still calculates from the hits total.

How it works

  1. Batting average (BA). Divide hits by at-bats. BA = H ÷ AB. For 45 hits in 150 at-bats: 45 ÷ 150 = .300. A batting average is written with a leading dot and three decimals (.300, not 0.300 or 30%). A .300 average means 3 hits per 10 at-bats.
  2. On-base percentage (OBP). OBP counts every time the batter reaches base safely, not just hits. OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF). For the default line: (45 + 20 + 2) ÷ (150 + 20 + 2 + 3) = 67 ÷ 175 = .383. Walks and hit-by-pitch count here even though they do not count as at-bats, and sacrifice flies are added to the denominator.
  3. Total bases. Each kind of hit is worth the number of bases it earns: a single is 1 base, a double is 2, a triple is 3 and a home run is 4. Total bases = 1B + 2×2B + 3×3B + 4×HR. For the default line: 30 + 16 + 3 + 24 = 73.
  4. Slugging percentage (SLG). Divide total bases by at-bats. SLG = Total bases ÷ AB. For the default line: 73 ÷ 150 = .487. Slugging rewards extra-base hits: a home run adds four times as much as a single.
  5. OPS. Add on-base percentage and slugging together. OPS = OBP + SLG. For the default line: .383 + .487 = .870. OPS is a single number that combines reaching base with hitting for power.
On-base percentage: 45 hits plus 20 walks plus 2 hit by pitch divided by 175 equals .383
Figure 2. On-base percentage — OBP = (45 + 20 + 2) ÷ (150 + 20 + 2 + 3) = 67 ÷ 175 = .383 — averagecalculatoronline.com

What counts as an at-bat — and what does not

Plate appearance outcomeCounts as an at-bat (AB)?Counts in OBP?
Hit (single, double, triple, home run)YesYes (numerator and denominator)
Out in playYesYes (denominator only)
StrikeoutYesYes (denominator only)
Walk (BB)NoYes (numerator and denominator)
Hit by pitch (HBP)NoYes (numerator and denominator)
Sacrifice fly (SF)NoYes (denominator only)
Sacrifice buntNoNo

This is why OBP is almost always higher than BA for the same player: walks and hit-by-pitch raise the numerator of OBP, and sacrifice flies only add to its denominator.

Total bases at a glance (default line)

Hit typeCountBases eachTotal bases
Singles (1B)30130
Doubles (2B)8216
Triples (3B)133
Home runs (HR)6424
Total45—73

The hit breakdown adds to 45, which matches the hits total — that is the check the tool runs. If your breakdown does not add up to your hits, one of the four numbers is wrong.

Slugging percentage: 73 total bases divided by 150 at-bats equals .487
Figure 3. Slugging — total bases 30 + 16 + 3 + 24 = 73, SLG = 73 ÷ 150 = .487 — averagecalculatoronline.com

Baseball batting average vs cricket average

Baseball batting averageCricket average
FormulaHits ÷ At-batsRuns ÷ Times dismissed
Default example45 ÷ 150 = .300Different sport, different numbers
Written asDecimal with leading dot (.300)Runs per dismissal (e.g. 45.00)
WalksNot at-bats; counted in OBPNo equivalent — not-out innings excluded from dismissals

These are different sports with different formulas. Do not mix them: a baseball .300 is not a cricket average, and a cricket average is not a batting average.

Baseball batting average versus cricket average: different sports, different formulas
Figure 4. Baseball BA .300 (hits divided by at-bats) vs cricket average (runs divided by dismissals) — different sports, do not mix them — averagecalculatoronline.com

Worked examples (all recomputed in Python)

Example 1 — The default line: 45 hits in 150 at-bats

  • BA: 45 ÷ 150 = .300
  • OBP: (45 + 20 + 2) ÷ (150 + 20 + 2 + 3) = 67 ÷ 175 = .383
  • Total bases: 30 + 16 + 3 + 24 = 73
  • SLG: 73 ÷ 150 = .487
  • OPS: .383 + .487 = .870

Example 2 — 60 hits in 200 at-bats

Inputs: H 60, AB 200, BB 25, HBP 1, SF 2, 1B 40, 2B 12, 3B 2, HR 6.

  • BA: 60 ÷ 200 = .300 — the same average as Example 1, from a longer line
  • OBP: (60 + 25 + 1) ÷ (200 + 25 + 1 + 2) = 86 ÷ 228 = .377
  • Total bases: 40 + 24 + 6 + 24 = 94
  • SLG: 94 ÷ 200 = .470
  • OPS: .377 + .470 = .847
  • Hit breakdown check: 40 + 12 + 2 + 6 = 60, which matches hits

Example 3 — All singles, no walks: 30 hits in 100 at-bats

Inputs: H 30, AB 100, BB 0, HBP 0, SF 0, 1B 30, 2B 0, 3B 0, HR 0.

  • BA: 30 ÷ 100 = .300
  • OBP: (30 + 0 + 0) ÷ (100 + 0 + 0 + 0) = 30 ÷ 100 = .300 — with no walks, hit-by-pitch or sacrifice flies, OBP equals BA
  • Total bases: 30 + 0 + 0 + 0 = 30
  • SLG: 30 ÷ 100 = .300 — with all singles, slugging equals batting average too
  • OPS: .300 + .300 = .600

This shows the pattern clearly: extra-base hits are the only thing that pushes SLG above BA, and walks are the main thing that pushes OBP above BA.

Example 4 — A full season line: 180 hits in 550 at-bats

Inputs: H 180, AB 550, BB 70, HBP 5, SF 8, 1B 120, 2B 35, 3B 5, HR 20.

  • BA: 180 ÷ 550 = .327
  • OBP: (180 + 70 + 5) ÷ (550 + 70 + 5 + 8) = 255 ÷ 633 = .403
  • Total bases: 120 + 70 + 15 + 80 = 285
  • SLG: 285 ÷ 550 = .518
  • OPS: .403 + .518 = .921
  • Hit breakdown check: 120 + 35 + 5 + 20 = 180, which matches hits

Benchmark note

150 hits in 500 at-bats = .300. A .300 average means 3 hits per 10 at-bats. To find how many hits you need for a target average, multiply the target by your at-bats: for a .300 average over 500 at-bats you need 0.300 × 500 = 150 hits.

Tips and mistakes

  • Do not count walks as at-bats. A walk is not an at-bat, so it does not change BA — but it does raise OBP, because walks are in the OBP numerator and denominator. Counting walks as at-bats understates the batting average.
  • Do not count sacrifice flies as at-bats either. A sacrifice fly is excluded from at-bats for BA, but it is added to the OBP denominator, so it slightly lowers OBP. A sacrifice bunt counts as neither an at-bat nor an OBP event.
  • Check that the hit breakdown adds up to hits. Singles + doubles + triples + home runs must equal total hits (30 + 8 + 1 + 6 = 45 here). If it does not, the total bases — and therefore SLG — are wrong even though BA still looks right.
  • Do not confuse BA with OBP. BA only counts hits; OBP also counts walks and hit-by-pitch. For the default line BA is .300 but OBP is .383 — reporting one as the other is a different stat.
  • Do not confuse baseball average with cricket average. Baseball BA is hits divided by at-bats; cricket average is runs divided by dismissals. They are different sports, different formulas and different scales.
  • Keep three decimals and the leading dot. Batting average is written .300, not 0.3, 30% or .3. The three decimals matter: .300 and .299 are different averages.
  • At-bats must be greater than 0. With 0 at-bats there is no batting average to calculate — the tool says so instead of showing a broken number.

Frequently asked questions

How do you calculate batting average?

Divide hits by at-bats: BA = H ÷ AB. For 45 hits in 150 at-bats, BA = 45 ÷ 150 = .300. A .300 average means 3 hits per 10 at-bats.

What is on-base percentage (OBP) and how is it different from batting average?

On-base percentage measures how often a batter reaches base safely, including walks and hit-by-pitch: OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF). Batting average only counts hits divided by at-bats. For the default line, BA is .300 but OBP is .383, because the 20 walks and 2 hit-by-pitch count in OBP but not in BA.

How do you calculate slugging percentage (SLG)?

First work out total bases: singles count 1, doubles 2, triples 3 and home runs 4. Then divide total bases by at-bats: SLG = Total bases ÷ AB. For the default line, total bases are 30 + 16 + 3 + 24 = 73, so SLG = 73 ÷ 150 = .487.

What is OPS?

OPS is on-base percentage plus slugging percentage: OPS = OBP + SLG. It combines reaching base with hitting for power in a single number. For the default line, OPS = .383 + .487 = .870.

Do walks count as at-bats?

No. A walk (BB) is not an at-bat, so it does not change batting average. Walks do count in on-base percentage, in both the numerator and the denominator. Hit by pitch works the same way, while a sacrifice fly is not an at-bat but is added to the OBP denominator.

What is the difference between baseball batting average and cricket average?

They are different sports with different formulas. Baseball batting average is hits divided by at-bats — for example, 45 ÷ 150 = .300. Cricket average is runs divided by times dismissed, and it is written as runs per dismissal, not as a decimal like .300. Do not mix the two.

Disclaimer

The figures on this page are standard baseball statistics computed from the numbers you enter. They describe the line you entered only — they do not predict future performance, and they are not professional coaching, scouting or betting advice. Check your league’s official scoring rules before reporting a statistic: for example, sacrifice bunts do not count as at-bats in the standard formula.

Related calculators

Last updated: November 7, 2026.