On-Base Percentage Calculator (OBP) — Sacrifice Flies Handled Correctly
On-base percentage from hits, walks, hit-by-pitches, at-bats and sacrifice flies under Rule 9.21(f), with plate appearances and batting average for comparison.
On-Base Percentage Calculator
Background.
A sacrifice fly that brings a runner home from third leaves the hitter's batting average untouched and lowers his on-base percentage. A sacrifice bunt that moves a runner up to second touches neither. Both quirks come straight from the rulebook, and they are where most home-made OBP calculations go wrong.
Official Baseball Rule 9.21(f) defines on-base percentage in one sentence: the sum of hits, bases on balls and times hit by pitch, divided by the sum of at-bats, bases on balls, times hit by pitch and sacrifice flies. The top counts the ways a hitter reached base by his own doing. The bottom counts the plate appearances charged to him, which includes the sacrifice fly, because the batter made an out, but leaves out the sacrifice bunt, which MLB's glossary describes as usually a manager's strategic choice rather than the hitter's. The Comment to the same rule adds a third exclusion: when a batter is awarded first base for catcher's interference, obstruction or a shift-restriction violation, the plate appearance is ignored altogether.
That makes the OBP denominator smaller than plate appearances, and the difference can reach the third decimal. Aaron Judge's 2024 line in MLB's own statistics feed has 322 times on base against a denominator of 703, for .458. His plate appearances were 704, because one catcher's interference award counts there; dividing by 704 gives .457.
The statistic matters because of outs. A team has 27 of them in a nine-inning game, and a hitter who avoids making one has done the most basic job a batter has, whether by single, walk or a pitch in the ribs. Batting average ignores walks entirely, so two hitters with identical averages can reach base at very different rates. Alongside on-base percentage you get batting average and the gap between them, plus times on base, the denominator and plate appearances, so you can see exactly where each number comes from.
What is on-base percentage calculator?
On-base percentage (OBP), also called on-base average, is the fraction of a batter's countable plate appearances in which he reached base by a hit, a walk or being hit by a pitch: (H + BB + HBP) ÷ (AB + BB + HBP + SF). It is written like batting average, as a three-decimal figure with the leading zero dropped, so .458 means 45.8%. Reaching on an error, a fielder's choice or a dropped third strike does not count, because in each case the batter did not earn the base; MLB's glossary lists all three exclusions. Branch Rickey and the statistician Allan Roth devised the measure in the 1940s and 1950s, and it became an official statistic in 1984. Because it records only whether the batter reached, not how far, it is paired with slugging percentage, and the two added together make OPS.
How to use this calculator.
- Copy hits and official at-bats from a box score or season line. At-bats already exclude walks, hit-by-pitches, sacrifices and interference awards, so do not subtract them yourself.
- Enter walks with intentional walks included. The rule draws no distinction, and standard walk totals already count intentional walks.
- Enter hit-by-pitches; each one adds one to the top of the fraction and one to the bottom, exactly as a walk does.
- Enter sacrifice flies, which go into the denominator only, and sacrifice bunts (often listed as SH), which go into neither term. A combined "sacrifices" column cannot be used as it stands; the two have to be split.
- Enter times awarded first base on catcher's interference or obstruction. They leave OBP unchanged but add to plate appearances, which is why that output can differ from the OBP denominator.
- Read OBP, then the batting average and the gap between them, which shows how much of the hitter's on-base rate comes from walks and hit-by-pitches.
The formula.
OBP = (H + BB + HBP) ÷ (AB + BB + HBP + SF). The numerator, times on base, has three terms. The denominator starts from at-bats, which Rule 9.02(a)(1) already strips of walks, hit-by-pitches, sacrifices and interference awards, then adds the walks and hit-by-pitches back so that every time on base is also counted as an opportunity, and adds sacrifice flies as opportunities that ended without the batter reaching.
Plate appearances, as Rule 9.22(a) defines them, are AB + BB + HBP + SF + SH + interference awards. So plate appearances minus the OBP denominator is exactly the number of sacrifice bunts plus interference awards. For a power hitter who never bunts that difference is usually zero or one; for a light-hitting infielder in a bunt-heavy era it could run into double figures.
Each input's effect follows from where it sits. Walks and hit-by-pitches appear in both terms, so each one pulls OBP towards 1.000. A hit adds one to the top while its at-bat adds one to the bottom, so it too pulls OBP upward. Sacrifice flies sit underneath only and always pull it down, as do outs of every kind, including times a batter reached on an error or a fielder's choice, since those are recorded as at-bats without a hit. Sacrifice bunts and interference awards sit in neither term. Late in a season single plate appearances still register in the third decimal: at Judge's 2024 totals, one more walk would lift his OBP from .4580 to 323 ÷ 704 = .4588, and one more out would drop it to 322 ÷ 704 = .4574.
Batting average is H ÷ AB, and the gap, OBP − AVG, isolates the contribution of free passes less the small drag of sacrifice flies. Every count must be a whole number, at-bats must be at least one so that batting average exists, and hits cannot exceed at-bats.
A worked example.
Aaron Judge's 2024 season, as MLB's statistics feed records it: 559 at-bats, 180 hits, 133 walks, 9 hit-by-pitches, 2 sacrifice flies, no sacrifice bunts and one award of first base on catcher's interference. Times on base are 180 + 133 + 9 = 322. The Rule 9.21(f) denominator is 559 + 133 + 9 + 2 = 703. Dividing, 322 ÷ 703 = 0.4580, which prints as .458, the figure MLB publishes. Plate appearances are 703 + 0 + 1 = 704, because the interference award counts there even though the rule's Comment excludes it from OBP; 322 ÷ 704 would have given 0.4574, or .457. His batting average was 180 ÷ 559 = 0.3220, so the gap between the two rates is 0.4580 − 0.3220 = 0.1360, or 136 points. Almost all of it comes from his 142 walks and hit-by-pitches, which batting average does not register at all.
Frequently asked questions.
Does a sacrifice fly count against on-base percentage?
Do sacrifice bunts lower on-base percentage?
Why is the OBP denominator smaller than plate appearances?
Does reaching base on an error count as getting on base?
Are intentional walks included in OBP?
What is a good on-base percentage?
Why do analysts rate OBP above batting average?
How many plate appearances does a player need to qualify for the on-base title?
Can on-base percentage be lower than batting average?
How far back can on-base percentage be calculated?
References& sources.
- [1]Office of the Commissioner of Baseball (2025). Official Baseball Rules, 2025 Edition, Rule 9.21(f) and Comment: "On-base percentage (or on-base average), divide the sum of hits, bases on balls and times hit by pitch by the sum of at-bats, bases on balls, times hit by pitch and sacrifice flies", and "For the purpose of computing on-base percentage, ignore instances of a batter being awarded first base on interference, obstruction, or shift restriction violation." This is the definition implemented here.
- [2]Office of the Commissioner of Baseball (2025). Official Baseball Rules, Rule 9.22(a): "Total appearances at the plate shall include official times at bat, plus bases on balls, times hit by pitcher, sacrifice hits, sacrifice flies and times awarded first base because of interference, obstruction, or shift restriction violation", together with the 3.1-per-scheduled-game qualifying standard. Source of the plate-appearance output and of the demonstration that PA is not the OBP denominator.
- [3]Major League Baseball. Official MLB Glossary, "On-base Percentage (OBP)": times on base "include hits, walks and hit-by-pitches, but do not include errors, times reached on a fielder's choice or a dropped third strike", the note that sacrifice bunts are removed from the equation entirely as a manager's choice, and the history — invented by Branch Rickey and Allan Roth in the 1940s–50s, official only from 1984.
- [4]Major League Baseball. Official MLB Glossary, "Sacrifice Fly (SF)": "A sacrifice fly does not count as an at-bat and therefore does not count against a player's batting average… However, sacrifice flies count against a player's on-base percentage", and the note that the sacrifice fly became an official rule in 1954.
- [5]Major League Baseball. Official MLB Glossary, "Plate Appearance (PA)" and "At-bat (AB)": plate appearance is every completed turn batting; at-bats are the denominator for batting average and slugging percentage; total plate appearances rather than at-bats determine who qualifies for the rate-statistic leaderboards.
- [6]MLB Stats API (statsapi.mlb.com), season hitting statistics for player 592450 (Aaron Judge), 2024: 559 at-bats, 180 hits, 133 walks, 9 hit-by-pitch, 2 sacrifice flies, 1 catcher's interference, 704 plate appearances, published obp ".458". Source of the worked example. The same endpoint for players 677951 and 660271 supplies two independent checks of this calculator.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 6 cited below
- Method
- OBP = (H + BB + HBP) ⁄ (AB + BB + HBP + SF)
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled