Captured Americans coping with life in a German POW camp in World War II are puzzled by the simplicity with which the Germans are able to stave off escape attempts, shooting those who try. Sefton (William Holden
) is a POW who has profitably wagered with his fellow American prisoners that these escapes would fail.
The POWs fear there may be an informer in their midst, but who is it? As it becomes clearer and clearer to his fellow inmates that Sefton has considerable contact with his German captors, his fellow POWs mistakenly conclude that he is the informer and they turn on him, including physically beating him and helping themselves to some of his belongings.
Sefton understands in full that to clear his name, he must determine the identity of the real informer, and he is, eventually, able to work out that Price (Peter Graves
), whose English is impeccable, is a German informant masquerading as an American POW. Written messages, Sefton discovers, are being smuggled by Price to the Germans through a hollow chess piece on the chessboard in the barracks, wth phony air raid drills staged to enable the Germans to retrieve these messages undetected.
Now realizing that Price has figured prominently in the death of the Americans that have attempted escape, Sefton plots revenge, and, after exposing Price's true identity to his fellow POWs, he maneuvers to force Price to make an unauthorized exit from the barracks. To the guards manning the tower, Price's exit looks like an American escape attempt, and they shoot him, much to the dismay of Stalag Commandant Von Scherbach (Otto Preminger
The diversion created by the shooting incident gives Sefton a chance to escape, and he takes with him a brave lieutenant (Don Taylor
) who has recently been captured. Because of the measures of success against the Germans he had gained prior to his capture, the lieutenant is a marked man, but he and Sefton are successful in their escape attempt.
The elimination of the German informer and the first successful escape by American POWs lift the spirits of the other POWs.
A few days before Christmas, 1944, at the German prisoner-of-war camp, Stalag 17, two American POWs, Manfredi and Johnson, inmates of Barracks 4, are preparing an escape. The story's narrator, Cookie, one of the prisoners, suggests that there may be a traitor among the men of Barracks 4.
The men have secretly been digging a tunnel from their latrine to a point just beyond the barbed-wire fence that marks the perimeter of the camp. After going over their plan to sneak into Switzerland, Manfredi and Johnson get out of the barracks through a trap door hidden under the wood-burning stove and sneak into the latrine. They crawl through the tunnel and begin digging to the surface beyond the barbed wire fence.
Inside the barracks, the men speculate as to how long it will take their comrades to emerge beyond the fence. They begin to predict that the escapees will make it all the way when one of them, a shrewd man named Sefton, wagers two packs of cigarettes that the men won't even make it out of the nearby forest. The other men, most of whom dislike Sefton, wager against him.
Outside, Manfredi and Johnson dig to the surface and are about leave when they are spotted by a small German squad outside the fence, who open fire, killing them both. Inside the barracks, the remaining prisoners, including Sefton, are disheartened, knowing their buddies could not possibly have escaped. The hot-headed Duke demands an explanation from the barracks' security officer, Price. Price says he doesn't have an answer. Meanwhile, Sefton and Cookie quietly gather up the cigarettes that Sefton has won in the bet and store them in a footlocker Sefton keeps under his bed.
The next morning the entire camp is awakened for roll call. Barracks 4 is overseen by Sergeant Schultz, a jolly man whom the men have absolutely no trust for. In the camp's muster grounds, the men are addressed by the camp commandant, Oberst von Scherbach. Scherbach tells the men that his guards successfully prevented the escape from night before and that no man has ever escaped from his camp alive. He also has the corpses of Manfredi and Johnson lying in the mud and uncovered for all the men to see. The Barracks 4 chief, Hoffy, protests the treatment of the bodies and demands they have a proper burial. Von Scherbach agrees to do so. Von Scherbach goes on, saying that being caught outside the barracks after lights out means summary execution. Also, the stove in Barracks 4 will be removed so it cannot be used to camouflage the trap door the men cut in the floor.
Von Scherbach also announces that each barracks will be given a small Christmas tree and that all the prisoners will go through delousing. One of the prisoners, the shellshocked Joey, begins to play his ocarina, which is gently taken away by another prisoner, Stanislaus "Animal" Kazawa. While the commandant talks and uses a mocking tone, Animal throws the ocarina at the water in front of the commandant, splashing his highly polished boots with mud. The Commandant demands the guilty man step forward. Animal does and is followed moments later by several other men. Eventually, the entire prisoner population steps forward, covering for Animal. The Commandant, temporarily flustered, cancels the Christmas trees and tells the men they'll be deloused with cold water from the camp's fire hoses. The men are dismissed.
After the men have the opportunity to clean up in their latrines, and following a small incident where Animal is nearly shot for crossing the barbed-wire of the camp while lusting after Russian female prisoners, the men go back to their barracks for breakfast. Sefton fries himself an egg in front of the other prisoners and when questioned about how he paid for it, he tells them that he bartered for it using the cigarettes he'd won the night before. The other men are quite angry that Sefton would use cigarettes he'd gotten as a result of the deaths of their comrades, however, Sefton counters, saying that many other prisoners trade with the Germans and that life in the camp is such that thievery is common. One of the other prisoners, Duke, who has a short temper, tells Sefton that collusion with the Germans could get him hurt or killed and small fight breaks out. Hoffy promptly breaks it up and Sefton, claiming he has indigestion, gives the fried egg to Joey. Price, the barracks security officer, asks Sefton how he could be so sure that Manfredi and Johnson wouldn't make it to freedom. Sefton says he didn't know for sure but he "liked the odds" of the situation. Sefton also angrily tells his comrades that they're wasting their time and risking their lives unnecessarily by trying to escape. Sefton plans to ride out the war as a prisoner and stay alive.
The barracks of the camp share a ham radio that they keep hidden and use to listen to the BBC and other communications about the war. The radio is smuggled throughout the compound by Marko and his partner, Steve, who is on crutches having lost a leg in combat. They use his empty pantleg to hide various items, including the radio. When the radio is brought to Hoffy and Barracks 4, Marko tells them they can have it only for two days; the traitor in their barracks is known to the rest of the camp and the other barracks chiefs fear the radio will be discovered. The men set up the radio immediately, using a few yards of chicken wire as the antenna, which doubles as their volleyball net. One of the prisoners, Blondie, is a radio expert and begins to report about military actions in Europe; the news he picks up is about the famous Battle of the Bulge. Just then, Schultz arrives to seize the barracks stove and the radio is cleverly hidden in a pail of water. Hoffy and Duke try to grill Schultz about the barracks spy but Schultz refuses to tell them anything. Schultz also notices that a signal from the spy has been left for him; a loop has been tied in the cord for one of the bare light bulbs hanging from the rafters. After he barks orders for the men to leave, he goes to the chess board and takes the black queen. Pulling off the crown, he sees a small note rolled up and hidden inside. He exchanges the queen for an identical piece, pulls the loop out of the cord and walks out.
While the men uncover the escape tunnel they dug, they notice a horse-drawn cart going by with the coffins of Manfredi and Johnson. The men all remove their hats in respect. Cookie narrates for a while about Sefton himself who, despite the poor conditions of the camp, has built a substantial entrepreneurship for himself based mostly on the trading of cigarettes. Sefton has several successful businesses at his disposal including distilling schnapps from potato peels, horse races (he uses mice that run around a small track), and a telescope that the men use to peek into the delousing shack in the Russian compound where female prisoners are disinfected. Hoffy, Price and Duke are not pleased with Sefton's ventures, fearing that the Germans will find out and punish them more harshly than ever.
A new prisoner arrives; Lieutenant James Dunbar, who is being housed at 17 until the Germans ship him to the officers camp. Dunbar is greeted warmheartedly by the rest of the barracks. However, there is instant friction between him and Sefton. Sefton tells everyone that Dunbar is from a wealthy family and should be pampered during his stay. Dunbar lets the first few comments go but tells Sefton that he can resent his family's wealth but he should tread cautiously. Sefton tells Dunbar that his family fortune won't protect him in the camp. Sefton leaves the barracks, to an unknown destination.
The rest of the men ask Dunbar about how he was captured & brought to the camp. He was shot down on a bombardment mission and had been on his feet for three days without any sleep. He'd have been brought to Stalag 17 earlier but there was a major delay coming out of Frankfurt: a German munitions train was destroyed just outside the city and snarled much of the Reichsbahn transport for miles around. The sergeant that accompanied Dunbar, Bagradian, tells everyone that it was Dunbar himself that blew up the train. Dunbar is modest about the incident but tells everyone that he'd rigged a simple time bomb and tossed it aboard the train as it was leaving the station.
Schultz shows up unexpectedly and confiscates the radio, playing coy for a bit before revealing it's hiding place in the bucket. After he leaves, the men turn on Cookie, demanding to know where Sefton has been for the past few hours. With Hoffy's permission, Animal breaks into Sefton's footlocker & discovers a wealth of contraband that Sefton's been hoarding. Duke suddenly appears and tells them that he knows where Sefton disappeared to: he's been over at the Russian women's barracks partying with them. In a fury, Hoffy smashes Sefton's prized telescope.
When Sefton returns, he finds the men staring angrily at him and that his footlockers have been broken into. Hoffy and the rest of the men suggest that he's the German spy they've been unable to identify. The Commandant suddenly makes an appearance and arrests Dunbar for suspicion of sabotaging the train that was destroyed near Frankfurt. Dunbar is taken into custody and the men become angrier with Sefton, immediately suspecting him. They turn on him and he is brutally beaten.
The next morning the men are rousted out by Schultz. Sefton is unable to get out of bed and Schultz notices that he's been severely beaten. Sefton tries to bribe Schultz into revealing the identity of the traitor but is rebuffed. When the other prisoners walk in on them, they're belief in Sefton as the traitor is reinforced. Hoffy tells Sefton that he tried to get Sefton transferred to another barracks but couldn't. Sefton tells everyone that he'll find out who the traitor is.
On Christmas Eve the Geneva agent inspects the camp and brings Red Cross supplies for the men. A mistaken shipment leaves the men with a large supply of ping-pong balls. That night the men celebrate with a small tree they decorate with their dog tags. The solemnity of the evening is ruined when the camp lights go out & Schultz tells them all to evacuate and take refuge in the trenches used in case of bombings. Schultz waits until everyone leaves and begins talking to Price, who is the traitor. He shows Schultz how Dunbar sabotaged the train using nothing more than a book of matches and a lit cigarette. After they leave, Sefton steps out from a hiding spot, having heard the whole conversation.
On Christmas Day the men throw a party in their barracks with music and much of the liquor and wine that Sefton had been hoarding. Sefton talks to a suspicious Cookie about the traitor in their midst. Sefton talks about the potential consequences of revealing the traitor to the others & what punishment they'd face if they killed the man outright. Sefton suggests that a well-constructed plan to rid themselves of the traitor and appear blameless is needed.
Hoffy shows up and announces that the SS has arrived to take Dunbar into custody -- his method for destroying the ammo train has been uncovered. Hoffy tells the men that they've come up with a plan to rescue Dunbar from the SS. All the men from the other barracks will disperse outside and help with a diversion. Sefton seizes the opportunity to demand that he stay in the barracks & be guarded by someone they trust -- Sefton suggests Price.
Outside, the men have Steve drop a smudge pot crafted from ground ping-pong balls from his empty pantleg onto the ground near the SS agents car. When the cover from it is thick enough, a small group of the men rush the SS guards and grab Dunbar, hiding him. The commandant is furious and runs checks of every man against their records. The barracks are searched and the prisoners are forced to stand in the appelplatz for six straight hours, however Dunbar is never found. It is later revealed that Dunbar is hiding out in one of the water towers above one of the latrines.
That night Hoffy calls a meeting where they'll draw the name of the man who will get Dunbar out of the water tower and out of the camp through the barbed wire. When the name is drawn, Price takes the tag and says he'll go. He figures that his work as barracks security chief has been less than adequate and he'd like to make it up to the men. Another trap door is cut in the floor and as he prepares to leave, Sefton steps forward and announces another wager that Dunbar will never make it out of the camp. The men are instantly furious with him but he slowly begins to reveal Price as the traitor. Price slips up during interrogation, proving that he'd left the United States and had gone back to Germany when the war broke out. He tries to escape through the trap door but is easily caught and subdued. Sefton then tells everyone that he'll be the man to get Dunbar out -- he likes the odds because now they can use Price as a decoy. They'll throw him out the door with cans tied to his leg and he'll be fired upon by the Germans in the guard towers.
Sefton slips down through the trapdoor, bidding everyone farewell and sneaks over to the latrine. He gets a freezing Dunbar down from the water tank and waits for the signal from his comrades. When Price is thrown out into the appelplatz he draws fire from all the towers, despite his cries for help in German. As he desperately tries to approach the commandant's offices, he's gunned down. At the edge of the camp, Sefton cuts through the wire fence and he and Dunbar escape into the woods. In the appelplatz, the commandant and Schultz first smile at the corpse lying the mud but are quickly chagrined to find that it's not Dunbar, but Price. In the barracks, the men reflect on how well Sefton's plan worked. The Animal suggests that Sefton merely wanted to steal their wirecutters. Cookie happily begins whistling the theme of the Army Air Force.