In 1944, the Germans have built a special Stalag, or prison camp, designed to house their most troublesome inmates, the ones who make repeated escape attempts. Arriving at the new camp, many begin immediately to asses its security and figure out how to get away.
One American prisoner, Capt. Hilts (Steve McQueen) casually tosses his ever-present baseball into a percieved blind spot between the guard towers in order to test the Germans, and stepping over the warning wire gets a few machine-gun bullets fired at his feet.
Others try different escape tactics; several hide themselves in trucks full of brush as they drive towards the gate, and two of the men even try inflitrating a group of Russian workers marching out of the camp. All are quickly found and rooted out, with Hilts being thrown into the "Cooler", a isolation cell at the far side of the camp. All this in the first 20 minutes after they arrive.
After the initial excitement, the POW's begin to make more cohesive plans. The ranking officer of the group, Capt. Ramsey (James Donald) has a meeting with the German Commandant, who assures him escape is impossible, and it would be in everyone's best interest if they would all accept their situation, settle down, and sit out the remainder of the war "as comfortably as possible". Ramsey must however remind the Commandant that it is the sworn duty of all the prisoners to create as much trouble for the Germans as they can, and politely leaves.
Between then, the POW's have considerable experience in tunneling, and have made many escape attempts. Sqdn. Leader Bartlet (Richard Attenborough) quickly organizes everyone into teams and get them all to work. Some, like Lt. "Tunnel King" Velinski (Charles Bronson) begin digging, while Lt. "Scrounger" Hendley (James Garner) begins to gather the materials needed to make everything work.
After a couple of weeks in the cooler, Hilts is released and meets with the others, who are working on plans to dig three tunnels under the fence. Hilts has his own plan to dig out, a idea that is so simple it just might work, and he intends to try it that night. Wishing him the best, the main team realizes that Hilts may not succeed, but he'll at least distract the Germans from the other attempts. Hilts starts under the fence that night, but the next morning he's back in the cooler again, bouncing his baseball off the wall.
Other prisoners are working on the main escape attempt. Lt. Blythe (Donald Pleasence) is the forger of the group, and works on fake I.D. papers, while the Aussie Sedgwick (James Coburn) creates amazing tools from scrap metal scavanged around the camp. Lt. Pitt (David McCallum) has figured out a way to get rid of all the dirt they're bringing up out of the tunnels, and everything seems to be moving forward.
Bartlet has made up his mind that this will be the greatest escape of the war, and plans to get every single POW out in one big night, all 250 men. Constant inspections by the suspicious Germans hinder their progress, but the tunnels grow a few feet longer every night, and the men get closer to their goal. Hilts, finally out of the cooler again, begins to brew a strange concoction from potatoes, and on the 4th of July surprises everyone with gallons secretly distilled alcohol.
A much-needed party breaks out as the POW's gather outside for a few drinks. Inside however, the guards have found a hidden hatch under a wood stove that leads to the main tunnel, and at the height of their celebration the men are suddenly crushed to learn that their greatest hope of escape is now gone. Bitterly resigned, Bartley tersely tells the men to continue quietly on tunnel #2.
Hilts has another attempt in mind and meets with Bartlet, who sees little chance for success, but asks for his help; if Hilts can get out of the camp, even for a few hours, they need all the information he can get on the local roads, the train station and schedules, etc. Hilts says he'll be far away by the time the others ever get their tunnel dug, but of course he's captured the next morning and returned to the cooler. Winking at Bartley as they pass, he's at least gotten the info Bartlet needed.
By the time Hilts is released again, the main group is nearly ready. Their cloths have been tailored to make them look like civilians, they have their fake I.D.'s and they know where to run, thanks to Hilts. That night, Hilts digs the last few feet up to the surface at the end of the tunnel and cautiously pokes his head out, but he finds they've miscalculated; they're 20 feet short of the woods, and now they must try to sneak across open ground without being seen. Timing the men between the passes of the guards, over 70 prisoners make it into the woods and escape before the Germans discover and stop the breakout.
The next morning, guards and police scour the countryside looking for the POW's. As the morning train pulls into the station, many of the men are waiting in their disguises, and they quietly get aboard. Others are making their getaway by boat, bicycle, and two even steal a small plane from a nearby airbase. Hilts is waiting in the countryside, and as a German soldier rides by on a motorcycle, he strings a wire across the road, causing the German to lose control and crash. Hilts quicky steals his uniform and rides off towards Switzerland.
As the day progresses, the prisoners are recaptured one by one, some easily, others after long chases. Only a few make it away, and by the end of the day more than 50 have been rounded up by the Gestapo.
As they ride back towards the camp in trucks, Bartlet, who'd led all his men in the escape, confesses that even though they've failed the affair has been exhilarating. "I've never been happier", he says during a rest stop in an open field. The prisoners turn at the sound of a machine gun bolt, and as they stand helpless, the Gestapo guards gun them all down in cold-blooded murder.
Hilts is speeding around the countryside evading the Germans, but eventually is cornered and in a desperate attempt, he makes a daring motorcycle jump over a barb-wired fence. He nearly makes it, but in the end he too is recaptured. Bruised, bloody, but unbowed, he marches defiantly back into the camp only to learn of the murder of most of the other escapees. Staggered at the news, he is hauled off to the cooler.
As the names of those murdered are read off in a memorial service, the Comandant of the Stalag is taken away in disgrace and replaced by another officer. Hilts is locked up in his usual room, and as the guard walks away, he hears the sound of a baseball being bounced, over and over, against the walls of the cell.