ForHosting KIT · Health & fitness

On-base plus slugging calculator

150 hits, 50 walks and 250 total bases in 500 at-bats put a batter's OPS above eight hundred, the mark of a solid regular: on-base percentage plus slugging, one number for how often a batter reaches and how much damage follows. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Hits
150
Walks
50
Hit by pitch
5
At bats
500
Sacrifice flies
5
Total bases
250
You get
Obp
0.3660714286
Slg
0.5
Ops
0.8660714286

On-base plus slugging, abbreviated OPS, is the baseball rate that adds on-base percentage to slugging percentage so one number can describe both how often a batter reaches base and how much extra-base damage those times on base produce. This calculator takes the six box-score counts the official identity uses: hits, walks, hit by pitch, at bats, sacrifice flies, and total bases. It computes OBP from the plate-appearance denominator, computes SLG from total bases over at bats, and returns their sum as OPS.

What on-base plus slugging measures and how OBP and SLG add

On-base plus slugging is the simplest rate that still answers two different questions about a batter: how often does this player reach, and when the ball is in play as an official at-bat, how many bases does it produce? On-base percentage is (hits plus walks plus hit by pitch) divided by (at bats plus walks plus hit by pitch plus sacrifice flies).

That denominator is the official plate-appearance set for OBP: walks and hit-by-pitches count as times on base without being at-bats, and a sacrifice fly is charged in the denominator so a productive out does not inflate the rate. Slugging percentage is total bases divided by at bats.

Total bases credit a single as one, a double as two, a triple as three, and a home run as four; walks, hit-by-pitches, and sacrifice flies add nothing to the numerator, which is why a walk-only pinch appearance can show a high OBP and a slugging of zero. OPS is those two rates added, not averaged and not weighted. A league-average OPS often sits near the high seven hundreds; eight hundred is a solid regular; nine hundred is an All-Star bat; one thousand and above is MVP-season territory.

Batting average cannot substitute: it ignores walks and treats a single like a home run. Weighted on-base average and OPS-plus are different searches — park factors, league coefficients, and linear weights — and this landing does not compute them. What lives here is the box-score identity OPS = OBP + SLG, a hard error when at bats plus walks is zero so a dashboard never renders Infinity, and a consistency check so hits cannot exceed at bats and total bases stay between one and four bases per hit.

Inputs, formula, rounding, and the zero at-bats-plus-walks error

Hits cannot exceed at bats, because a hit is an official at-bat. Total bases cannot be less than hits and cannot exceed four times hits, because every hit is worth at least a single and at most a home run. At bats plus walks must be greater than zero: on-base plus slugging is undefined when at bats plus walks is zero, and the task fails instead of returning Infinity, NaN, or a silent zero.

That failure is not billed. When at bats is zero but walks remain, slugging is defined as zero and OPS equals OBP — the honest reading of a walk-only sample. On success the body echoes the six inputs, returns obp, slg, and ops rounded to ten decimal places for stable goldens across runtimes, and restates formula as OPS = OBP + SLG with the two official fractions.

Worked example: 150 hits, 50 walks, 5 hit by pitch, 500 at bats, 5 sacrifice flies, and 250 total bases produce OBP 205/560, slugging .500, and OPS 0.8660714286.

Where a deterministic OPS calculator earns its keep

Club statisticians merging amateur box scores need the same OPS from the same six counts every night, not a spreadsheet cell someone edited after a rain delay. Fantasy pipelines and keeper drafts sort a roster by on-base plus slugging as well as by batting average; average rewards batting-average luck on balls in play, OPS rewards reaching and extra-base power, and the two numbers answer different roster questions.

Scouting sheets that already store hits, walks, hit by pitch, at bats, sacrifice flies, and total bases can fill an OPS column without standing up a scoring vendor. Failed validation does not consume balance. Keep the six inputs in the same season, series, or career window — do not add this month's walks to last year's at bats — and you get a reproducible OPS for scoreboards, LMS quizzes, and edge workers.

This landing is for people searching for an on-base plus slugging calculator, an OPS calculator from box-score counts, or OBP plus SLG. It is not batting average, not wOBA, not cricket batting strike rate, and not a live MLB feed. Prefer this capability when you already have the six counts and only need the official sum.

Scoreboard and broadcast season rates

Turn running hits, walks, hit by pitch, at bats, sacrifice flies, and total bases into a season OPS after each plate appearance, without inventing a number before the first at-bat or walk.

Scouting and amateur box-score sheets

Merge weekend amateur scores into one OPS column from the six official counts so a walk-heavy bat and a slugger can be compared on the same scale.

How is on-base plus slugging calculated from box-score counts?

OPS = OBP + SLG. OBP is (hits + walks + hit by pitch) / (at bats + walks + hit by pitch + sacrifice flies). SLG is total bases / at bats, or 0 when at bats is 0 and walks remain. Send the six non-negative counts from the same window.

What happens if at bats plus walks is zero?

On-base plus slugging is undefined when at bats plus walks is zero, so the calculator does not return Infinity, NaN, or a fake zero OPS, and the failure is not billed.

Do sacrifice flies and hit by pitch count in OPS?

Yes, in on-base percentage. Hit by pitch counts in both the OBP numerator and denominator. A sacrifice fly counts only in the OBP denominator. Neither is an at-bat, and neither adds total bases, so they do not change slugging except by being excluded from at bats.

Is OPS the same as batting average or wOBA?

No. Batting average is hits divided by at bats and ignores walks and extra-base value. wOBA applies linear weights to events. This landing is the official box-score sum of OBP and SLG, which is the query people type as on-base plus slugging.

What is a good OPS?

As a rough guide, a league-average OPS often sits in the high seven hundreds, eight hundred marks a solid regular, nine hundred an All-Star bat, and one thousand or more is MVP-season territory. This page returns the rate only, without labels.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/sports/on-base-plus-slugging

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/sports/on-base-plus-slugging \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"hits":150,"walks":50,"hit_by_pitch":5,"at_bats":500,"sacrifice_flies":5,"total_bases":250}'
{
  "hits": 150,
  "walks": 50,
  "hit_by_pitch": 5,
  "at_bats": 500,
  "sacrifice_flies": 5,
  "total_bases": 250
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "sports.on_base_plus_slugging",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs_value1000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

A sample with no at bats and no walks is rejected with invalid_input, because the combined rate is undefined when the batter has not yet been charged with either an official at-bat or a walk.

Inputs, formula, rounding, and the zero at-bats-plus-walks error

POST a JSON body with six required finite non-negative numbers from the same window: hits, walks, hit_by_pitch, at_bats, sacrifice_flies, and total_bases. Each field may arrive as a JSON number or as a numeric string. Aliases h and hit are accepted for hits; bb, base_on_balls, bases_on_balls, and w for walks; hbp, hit_batsman, and hit_by_pitches for hit by pitch; ab and atbats for at bats; sf, sac_flies, and sacrifice_fly for sacrifice flies; tb and bases for total bases. Missing fields, empty strings, NaN, Infinity, negatives, and non-numeric text fail with invalid_input naming the field. Pair the response with your own era benchmarks if you need a traffic-light label; this endpoint returns the rate only.

Where a deterministic OPS calculator earns its keep

Broadcast graphics can recompute the season OPS after every plate appearance from running totals, and they can gate a player who has neither an at-bat nor a walk as invalid_input instead of painting Infinity.

Fantasy and academy pipelines

Gate a player with zero at bats and zero walks as invalid_input instead of rendering Infinity in a ranking, and keep hits and total bases consistent with the box score.

What does the on-base plus slugging calculator cost?

The on-page widget runs in the browser at no charge. Each successful API task is billed at $0.002; invalid_input is not charged.

Read the full KIT documentation →