The batting order or line-up is the designated order in which the players for a given team will bat. Before the game, each manager provides the head umpire with a list of the players who will be starting the game and the order in which they will bat - the starting line-up, as written on a line-up card. Batters are then required to cycle through that batting order for the rest of the game.
When the manager substitutes one player for another, such as using a pinch hitter, pinch runner, defensive substitute, or relief pitcher, the new player assumes the spot in the batting order occupied by the player he replaced. If the manager substitutes two or more players simultaneously on defense, he is allowed to swap their defensive positions. If the manager wants to change players' positions when he makes the substitution, he is required to tell the umpire; otherwise the umpire will assume that each player has moved into the same spot in the batting order as the player he replaced defensively.
A common use of multiple substitutions is the double switch. In the double switch, the manager replaces his pitcher and one other defensive player at the same time. The new pitcher comes in to the spot in the batting order previously held by the just-replaced non-pitcher, and the new non-pitcher comes in to the spot previously held by the pitcher. The double switch is usually used to avoid having the pitcher bat in the upcoming inning.
One exception to the rule regarding multiple substitutions is the designated hitter. The designated hitter's spot in the batting order is fixed; the manager may not use multiple substitutions to move the DH to a different spot in the order.
Batting Out of Order
Teams will sometimes bat in a different order from the one kept by the head umpire, either because the manager forgot to inform the umpire of a double switch or because he posted a different order in the dugout from the one he gave to the umpire. If a batter completes a turn at the plate having batted out of order, the opposing team may inform the umpire and have the batter who properly should have batted declared out, and any runner advancement due to the improper batter is nullified. If the batting team discovers its error before the end of the plate appearance, they may replace the incorrect batter with the correct one without penalty. If a batter hits out of turn and the other team does not object, his time at bat is legitimized as soon as the next pitch is thrown.
One point of confusion in the case of batting out of order is which batter is supposed to bat next. In either case, the legal next batter is the batter who follows the one who received official credit for the previous plate appearance. If the opposing team objects, the batter who should have batted receives official credit for the out, so the next batter is the batter who followed him. If the opposing team fails to object, then credit is given to the batter who batted out of turn, and the legal next batter is the batter following him in the batting order.
- Team 1 gives the umpire batting order A, B, C, D, E, F, G, H, I, but accidentally posts A, D, C, B, E, F, G, H, I in the dugout (the difference is that B and D have switched places). Batter A singles. Batter D bats and strikes out. Team 2 does not object because they're happy to take the strikeout. Batter C comes to bat and hits the second pitch for a home run. Team 2 objects, because Batter E should have followed Batter D. Batter E is declared out, the home run is nullified, and A is sent back to first base. Team 1 sends up Batter B, who they think is supposed to follow C. Batter B takes a strike before Team 1 realizes its mistake and sends up Batter F (who now must assume the one-strike count) to replace him. Batters B and C have lost their times at bat this time through the order (although C made a complete plate appearance, it was nullified by the appeal regarding the batting order).
Batting Order Construction
While there is no universal rule for deciding on a batting order, teams tend to cluster their best hitters at the beginning of the order and leave the worst ones at the end. There are also some rules of thumb about specific skills for different spots in the order:
- The first or leadoff hitter should be good at getting on base and preferably a good baserunner as well. He should be willing to watch many pitches so that his teammates get a better chance to see the opposing pitcher's stuff. It is usually a waste to put a power hitter in the leadoff spot, although there have been notable exceptions.
- In the traditional approach, the second hitter should be a good bat handler. He needs to be able to take pitches to give the leadoff man a chance to steal. He should also be able to make a sacrifice bunt or hit and run play. Another theory is that any player with a high on-base percentage should occupy the spot, no matter his other skills, in order to create RBI opportunities for the team's best sluggers who normally hit in the next two spots.
- The third hitter is supposed to be the best all-around hitter on the team. He should be able to hit for average and power, and ideally should be able to run the bases well.
- The fourth or cleanup hitter is supposed to be the best power hitter. His job is to drive in the top three hitters when they get on base.
- The fifth place hitter is usually another power hitter, but one who isn't quite as good as the cleanup hitter.
- The sixth place hitter is something like a second leadoff hitter. If the team has a second player with leadoff-type skills, he'll often bat 6th.
- The seventh place batter is normally a spot for a batter who lacks the skills that would put him higher in the order.
- The eighth place hitter's role depends on the league. In leagues that use the designated hitter, he is often viewed similarly to the seventh place hitter. In leagues in which the pitcher is required to bat, teams will often pitch around the eighth-place hitter, so it's desirable to have a patient hitter there. It used to be traditional to bat the catcher eighth because the catcher was often changed along with the pitcher.
- The ninth spot is traditionally reserved for the pitcher in non-DH leagues. In DH leagues, it is often seen as a second leadoff spot, so teams will pick a batter with leadoff-type skills. However, certain managers prefer to bat their pitcher eighth, in order to have a "second lead-off hitter" batting 9th, who will be on base more often when the line-up turns around.
Some other general rules of thumb include:
- Left and right handed batters should be mixed up in the order. If several left-handed batters hit in a row, the team is vulnerable to an effective LOOGY.
- It's similarly unwise to bat several slow batters in a row because they'll be vulnerable to the double play.
- A common belief is that the best hitter on the team needs to be "protected" by having a good hitter right behind him. Without this protection, the other team will give him an intentional walk or pitch around him any time he has a chance to do some real damage. The more general recommendation is that a team's best hitters should be grouped together in the batting order, rather than spread out, as this maximizes the chances of someone being on base when a good hitter comes to bat.
It's important to understand that these rules of thumb are just guidelines. Some managers ignore the conventional wisdom, or simply lack players with the skills typically seen as important at a particular spot in the lineup.
- Herman O. Krabbenhoft: Leadoff Batters of Major League Baseball: Complete Statistics 1900-2005, McFarland, Jefferson, NC, 2006.
- Sarah Langs: "The rare history of players batting Nos. 1-9", mlb.com, December 4, 2020. 
- Mark Pankin: "Batting Out-of-Turn Results in Great Confusion", in The Baseball Research Journal, SABR, Volume 42, Number 1 (Spring 2013), pp. 46-49.
- Tom Ruane: "Fun With Batting Orders", Retrosheet.org. 
- David W. Smith: "Effect of Batting Order (Not Lineup) on Scoring", in The Baseball Research Journal, SABR, Volume 35 (2007), pp. 84-89.
-  Article on the worst leadoff hitters in The Hardball Times.
-  Article on the worst no. 2 hitters in The Hardball Times.
-  Article on the worst no. 3 hitters in The Hardball Times.
-  Article on the worst cleanup hitters in The Hardball Times.
-  Article on the worst no. 5 hitters in The Hardball Times.
-  Article on the worst no. 6 hitters in The Hardball Times.
-  Article on the worst no. 7 hitters in The Hardball Times.
-  Article on the worst no. 8 hitters in The Hardball Times.
-  Article on the worst no. 9 hitters in The Hardball Times.