WWII Army Major Reisman (Lee Marvin) has a history of bucking authority, including that of his former commander Col. Breed (Robert Ryan). Now under the authority of General Worden (Ernest Borgnine), Reisman is asked to lead a commando unit. Their mission: a stealth attack on a posh vacation chateau for Wehrmacht officers in occupied France, in hopes of disrupting German command before an Allied invasion.
It's essentially a suicide mission, and the proposed soldiers are bizarre. After reviewing their qualifications, their crime history, and an interview, twelve military convicts sentenced to death or life prison terms are asked to volunteer in return for full pardons. The convicts include Wladislaw (Charles Bronson), a German-speaking former officer who attacked a superior rather than follow a stupid order, black activist Jefferson (Jim Brown), gangster Franko (John Cassavetes), psychopath Maggott (Telly Savalas), and mentally slow Pinkley (Donald Sutherland).
With the aid of Sergeant Bowren (Richard Jaeckel), the men are taken to a heavily guarded remote camp for training. Nonconformists by nature, Reisman must resort to harsh discipline and incentives to motivate the uncooperative group. When Reisman deprives them of warm water for shaving, Bowren labels them, "the Dirty Dozen". As time passes, they finally begin to learn how to work together as a group.
As a reward, Reisman brings in a group of local hookers for a party for the men, isolating the misogynist Maggott in the guard tower for safety. When Colonel Breed finds out about this breach of regulations, he demands that Reisman's unit "prove themselves". Arrangements are made for them to participate in a local war game. Major Max Armbruster (George Kennedy) is assigned to monitor them, and is impressed by their ingenuity in avoiding capture and "thinking outside the box" in order to achieve their objective.
Training for their mission commences in earnest. Rather than having complex instructions that the men might not remember, Reisman develops a chant for them all to memorize each part of the attack plant. "One: down to the road block, we've just begun; Two: the guards are through; Three: the Major's men are on a spree; Four: Major and Wladislaw go through the door; Five: Pinkley stays out in the drive; Six: the Major gives the rope a fix; Seven: Wladislaw throws the hook to heaven; Eight: Jiménez has got a date; Nine: the other guys go up the line; Ten: Sawyer and Gilpin are in the pen; Eleven: Posey guards points five and seven; Twelve: Wladislaw and the Major go down to delve; Thirteen: Franko goes up without being seen; Fourteen: Zero-hour, Jiménez cuts the cable, Franko cuts the phone; Fifteen: Franko goes in where the others have been; Sixteen: we all come out like it's Halloween." The group recites this constantly to drive it into their minds.
When they parachute into France, Jiminez (Trini López) dies on impact. The plan proceeds as planned ... until a lone woman brings out Maggot's inner demons. He tells her to scream, then stabs her, then starts shooting, alerting the Germans to the attack. Gilpin's (Ben Carruthers) leg gets trapped as the roof gives way, forcing him to sacrifice his life in order to explode the antenna tower. The Germans run to an underground bomb shelter, disrupting the original plan. Reisman and Wladislaw lock the victims inside and pour gasoline in the air vents, and Jefferson throws live grenades in afterwards.
Germans have been picking off the convicts one by one the entire time, and now only four are left. As Franko exclaims that they've made it, he is shot. Reisman, Wladislaw, and Sgt. Bowren escape with their lives.
Back in Allied territory, General Worden decrees that the dead convicts will be listed as soldiers who gave their lives honorably in the line of duty.