Kind of Lost Kind of Lost · OR Tools · MLB Lineup Optimizer · Support

MLB Lineup Optimizer with Batting-Order Stacks

Upload tonight’s DraftKings, FanDuel or Yahoo salaries file; the tool fills in batting orders and probable pitchers, then builds a varied set of hitter-stack lineups you can upload straight back. Free tool by kindoflost.

1 · Site & player pool

📥 Drop the salaries CSV here, or browse
DK: DKSalaries.csv · FD: the players-list CSV
📈 Drop a projections file here, or browse
Columns: an id column + a projection column. Matched by player ID.

What is this MLB DFS lineup optimizer?

A free MLB DFS optimizer for DraftKings, FanDuel and Yahoo, with no account, no paywall and no teaser limit. Baseball scoring arrives in bunches — one rally pays three or four hitters from the same batting order at once — so the tool uses a constraint-programming solver to build a set of hitter-stack lineups, each one strong and all of them different, because in big tournaments one good lineup is easy — twenty different good ones is the hard part.

How it works

  1. Export the salaries/player file from your DFS site and upload it above.
  2. In step 2, drop the bats you don’t want, lock or cap anyone, and edit projections.
  3. Set the rules — team stacking (including consecutive batting-order stacks), max hitters per team, and how different each lineup must be from the others.
  4. Generate, then download a CSV of cap-legal lineups that your site takes as a bulk upload.

A worked example

On DraftKings classic MLB you fill ten slots — two pitchers, C, 1B, 2B, 3B, SS, and three outfielders — under a $50,000 salary cap. Mathematically that is a knapsack problem with position slots: the ten players with the most projected points that still fit the cap. Add a 4-hitter stack from one team in consecutive batting-order spots, cap any single player's exposure across your lineup set, and require every pair of lineups to differ — the optimizer handles all of it as hard constraints, not suggestions.

Common questions

Is it really free? Yes. It is a live demo of the optimization work I have done for over twenty years, so there is nothing to buy and no account to make.

Which DFS sites work? DraftKings, FanDuel and Yahoo MLB classic contests: upload that site’s salary export and the download comes back in its own upload format.

Can it do Showdown / single-game contests? No, only classic full slates for now. A DraftKings Showdown (Captain Mode) file is recognised, and the tool asks for the salaries file from a Classic contest instead.

Where do the projections come from? If you don’t upload any, each player gets the number in your salary file — DraftKings’ AvgPointsPerGame, FanDuel’s and Yahoo’s FPPG. That is his season-average fantasy score, not a projection for tonight: it ignores the opposing pitcher, the ballpark and where he bats, and in April it may rest on a few games. Load a projections CSV or type over any number in the list to replace it. The solver’s part is getting the most out of the numbers you believe in.

How do I use the Vegas lines (implied runs)? Load your file, then press Load Vegas lines in step 2 (MLB lines post on game day). Each team gets an Impl number — the runs Vegas expects it to score, worked out by splitting the game total with the moneyline. Treat it as an estimate rather than a posted team total. Sort by Impl to rank the offenses, then open step 3 → Tier 2 → Vegas rules. Only stack teams implied ≥ keeps your stacks on the offenses Vegas likes (pick a number that leaves the handful of teams you would stack anyway), and No pitcher facing an offense implied ≥ keeps your pitchers away from the lineups Vegas expects to score most. Leave a box empty to switch that rule off, which is the default. Neither rule touches the blue checkboxes, games without a posted line are never filtered, and a threshold that leaves nothing to build gets you a message rather than an empty result.

What does Update injury list do? It matches your slate against ESPN’s MLB injury report. Anyone listed out, on the injured list or suspended is unticked (tick him back if you know better); Day-To-Day, Questionable and Doubtful only add a badge. A hitter who already appears in a posted batting order, or a probable starting pitcher, stays ticked with a ⚠ badge — a lineup card posted this afternoon is newer information than an injury note. The On/Off by status buttons above the list flip a whole status group at once.

What does Check late news do? Use it after building, from the top of step 4. It asks ESPN’s injury report who in your lineups has been ruled out since you built them, lists those players with how many lineups each one is in, highlights those lineups and suggests a replacement. Nothing is rebuilt or re-exported; you make the swap on the site yourself.

What are saved setups? A way to keep your rules from one slate to the next. In the Saved setups box at the top of step 3, name the current settings and press Save current settings; Load brings them back on any later slate. Kept: everything in the Rules card — preset, lineup count, primary and secondary stacks, exposure and cooldowns — plus the pitcher split mode (Even / By win % / Underdog; typed weights come back as Even). Not kept: tonight’s pool, your locks and exclusions, typed projections and the pitchers ticked under “Build around”, since those belong to one slate. Vegas thresholds are kept only while Vegas lines are loaded. Any rule a setup doesn’t mention returns to its page default when you load it, so an old setup can’t leave a newer rule switched on. Everything stays in this browser — nothing is uploaded — so another browser or device starts with none. Up to 20 are kept; reusing a name overwrites.

Get an email when we ship updates to the MLB optimizer. Low volume, unsubscribe anytime.

Questions people actually ask

The baseball vocabulary is the hard part, not the optimizer. Click any question.

What do primary stack, secondary stack and “consecutive batters” mean?
The primary stack is the number of hitters a lineup must take from one team (4 by default). The secondary stack is a minimum number of hitters from a second team; 0 means off, and it only takes effect at 2 or more. Hitters in a stack score together because they bat back to back, and must be consecutive batters forces that literally: the stack must sit in adjacent batting-order spots (for example 3-4-5-6). That needs the Order column filled for the teams you stack; a team without enough in-a-row batters just won’t be chosen as the stack.
Do I have to enter batting orders and starting pitchers myself?
No. When the pool loads, the tool looks up posted lineups and probable pitchers from the MLB Stats API and fills the Order column; Refresh batting order & starting pitchers re-checks it. A team that has not posted a lineup yet has no order. If the lookup fails nothing breaks: type Order in by hand, or leave DraftKings’ own Starting column as it is.
What does “Starting pitchers only” do?
It uses the site’s own probable-pitcher flag to drop relievers, who are priced and projected on season averages but may never take the mound. It applies only to games where the file confirms both starters, so an early download isn’t stripped of its pitchers. Untick it to allow every pitcher.
What does “Only batters with a confirmed order” do?
It drops any hitter with no batting order — unconfirmed, or on the bench today. It matters most for GPP, where a stack’s whole edge is the order correlation. It never empties the pool: if too few hitters have a number yet (nobody’s lineup is out), it is skipped until they do. The GPP preset turns it on, Cash leaves it off.
What do “No hitters vs my pitcher” and “Rotate pitchers” do?
No hitters vs my pitcher keeps a lineup from rostering hitters against its own pitcher. Rotate pitchers requires at least one pitcher to change versus the previous lineup (not all of them); for a tighter pitcher spread use player exposure % or the cooldown. The GPP preset turns rotation on, Cash leaves it off.
What does “Min salary used” do?
A floor on salary spent: every lineup must use at least this many dollars of the cap, and 0 switches it off. Cash fills in 95% of the cap; GPP leaves it at 0, so a tournament lineup may leave salary unspent.
What does “Build around pitchers” do?
It splits the batch between the pitchers you tick, each one fixed for his share of the lineups. The player cooldown, exposure caps, pitcher rotation, the Vegas pitcher rule and the shared-player limit don’t count him, so his group isn’t cut short. The other pitcher slot (DraftKings and Yahoo have two) is still chosen by the solver and obeys every rule. Split the lineups Even, By win % or Underdog, or type your own weights; counts always add up to your lineup count.
Why did I ask for 150 lineups and get fewer?
Nearly always the time limit, not your rules. Every lineup must differ from all the earlier ones, so each solve has more to check than the last and the late lineups are the slow ones. The note under Generate says which limit you hit. If the solve budget ran out, ask for a count nearer to what you got, or press Keep going to N: it keeps the lineups you have and forces the new ones to differ from them — something a fresh run can’t do, since it never saw them. Loosening the diversity settings won’t help; each solve gets slower. If the note says no lineup is left that satisfies every rule, your rules are the limit rather than the clock: the message names what to loosen, and Relax one rule and continue relaxes one setting at a time.
Why does the GPP preset change the stack-team exposure on a small slate?
Each lineup needs a stack team (the page counts two when a secondary stack is set), and no team may anchor more than the cap’s share of lineups, so the teams on the slate have to add up to 100%. GPP starts at 35%; on a short slate the page lifts it until every lineup can find its stack teams. A number you type yourself is left alone.
Cash vs GPP presets: what changes?
Cash: no forced team stack, at least 4 teams in the lineup, at most 3 players from one team, starting pitchers only, no hitters against your pitcher, a minimum salary of 95% of the cap, and almost no diversity between lineups (1 unique player, 100% exposure, no cooldowns, no pitcher rotation). GPP: a forced 4-hitter stack, at least 2 teams, the site’s own limit per team, starting pitchers only, no hitters against your pitcher, confirmed batting order only, pitcher rotation on, 2 unique players, 40% player exposure, stack-team exposure 35%, cooldowns of 1, and no minimum salary. Everything stays editable afterward.

Who built this

I'm Mario — an operations research analyst with 20+ years in optimization and supply chain (Cargill, Cessna Aircraft, Textron Aviation). Daily fantasy lineup building is a knapsack problem in a costume: the same constrained-optimization math I used for scheduling and routing, just with a salary cap instead of a truck. This MLB DFS tool runs a real optimization solver (Google OR-Tools CP-SAT) end to end, not a heuristic or a spreadsheet formula. More about me and the other free tools →