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

    Frequently Asked Questions

    Why is OBP more important than batting average?

    OBP captures all ways a batter reaches base. Not making outs is the most valuable offensive skill, and walks contribute to scoring just like hits.

    What is the difference between OBP and AVG?

    Batting average only counts hits divided by at-bats. OBP includes walks and HBP in the numerator, and adds walks, HBP, and sac flies to the denominator.

    What is a good OBP?

    League average is around .320-.340. An OBP above .370 is very good, and above .400 is elite. The all-time record for a season is .609 by Barry Bonds.

    Learn More

    Guide

    Understanding Batting Average - A Complete Guide to Baseball's Key Stat

    Learn how batting average is calculated, what makes a good average, and how it compares to modern baseball statistics like OBP and OPS.

    Ready to run the numbers?

    Open On-Base Percentage Calculator