On-Base Percentage Calculator Formula

Understand the math behind the on-base percentage calculator. Each variable explained with a worked example.

Formulas Used

On-Base Percentage

obp = round((hits + walks + hbp) / plate_apps * 1000) / 1000

Times on Base

times_on_base = hits + walks + hbp

Plate Appearances

plate_appearances = plate_apps

Batting Average

batting_avg = round(hits / at_bats * 1000) / 1000

Variables

VariableDescriptionDefault
hitsHits75
walksWalks (BB)30
hbpHit by Pitch3
at_batsAt Bats250
sac_fliesSacrifice Flies4
plate_appsDerived value= at_bats + walks + hbp + sac_fliescalculated

How It Works

How On-Base Percentage Is Calculated

Formula

OBP = (Hits + Walks + HBP) / (At Bats + Walks + HBP + Sac Flies)

OBP measures how often a batter reaches base. It is considered more valuable than batting average because it accounts for walks and hit-by-pitches.

Benchmarks

  • .300: Below average
  • .340: League average
  • .370+: Very good
  • .400+: Elite
  • Worked Example

    75 hits, 30 walks, 3 HBP, 250 at-bats, 4 sacrifice flies.

    hits = 75walks = 30hbp = 3at_bats = 250sac_flies = 4
    1. 01Times on base = 75 + 30 + 3 = 108
    2. 02Plate appearances = 250 + 30 + 3 + 4 = 287
    3. 03OBP = 108 / 287 = 0.376

    Ready to run the numbers?

    Open On-Base Percentage Calculator