Stalag 17 begins on “the longest night of the year” in 1944 in a Luftwaffe prisoner-of-war camp somewhere along the Danube River. The story is narrated by Clarence Harvey “Cookie” Cook. The camp holds Poles, Czechs, Russian women and, in the American compound, 640 sergeants from bomber crews, gunners, radiomen, and flight engineers.
Manfredi and Johnson try to escape through a tunnel, but are shot by waiting guards when they emerge outside the barbed wire fence. The other prisoners conclude that one of their own must have told the Germans. Suspicion falls on Sefton, an enterprising cynic who barters openly with the German guards for eggs, silk stockings, blankets and other luxuries. He also organizes mouse races and various other profitable ventures. Sefton tells the men it is foolish to try to escape.
The lives of the prisoners are depicted: they receive mail, eat terrible food, wash in the latrine sinks, and collectively do their best to keep sane and defy the camp’s commandant, Oberst [Colonel] von Scherbach. They use a clandestine radio, smuggled from barracks to barracks, to pick up the BBC and the war news. One German guard, Feldwebel [Staff Sergeant] Schulz, confiscates the radio in another success for the “stoolie.”
“Animal” Kuzawa is infatuated with movie star Betty Grable, and becomes depressed when he learns she has married bandleader Harry James. Harry “Sugar Lips” Shapiro gets seven letters at mail call and makes Animal think they are from women. When Kuzawa sees a finance company letterhead, Harry admits they repossessed his Plymouth.
Sefton bribes the guards to let him spend the day in the Russian women’s barracks. The other prisoners conclude that this is his reward for having informed the Germans about the radio. When he returns, he is accused of being a spy.
Then von Scherbach takes Lieutenant James Schuyler Dunbar, a temporary inmate, away. Dunbar admitted to the other prisoners that he had blown up a passing German ammunition train while he was being transported to the camp. Sefton resents Dunbar for coming from a wealthy Boston family. The men are convinced that Sefton betrayed Dunbar, so they beat him up and ostracize him. Sefton then focuses more effort on uncovering the identity of the real spy. During a fake air raid, he remains unnoticed in the evacuated barracks and overhears the barracks security chief, Price, talking with Schulz in German and divulging the means by which Dunbar destroyed the train (a matchbook with a lit cigarette tucked into the edge to create a time delay). Sefton considers what to do; if he exposes Price, the Germans will simply remove him and plant him in another camp, while killing him could expose the entire barracks to retaliatory execution.
On Christmas Day, the men find out that SS men are coming to take Dunbar to Berlin for his sabotage. They create a diversion, free Dunbar, and hide him in the Water Tower. Nobody but Hoffy, the compound chief, knows where he is. The Germans, despite extensive efforts, are unable to find Dunbar. After von Scherbach threatens to raze the camp if necessary, the men decide one of them must get Dunbar out. Price volunteers, but then Sefton accuses him of being a spy. Sefton asks him, “When was Pearl Harbor?” Price knows the date, but Sefton quickly asks what time he heard the news. Without thinking, Price answers 6 o’clock and that he was eating dinner — the correct time in Berlin, but not in Cleveland, Ohio, his claimed hometown. Sefton then reaches into Price’s jacket pocket and extracts the “mailbox” used to exchange messages with the Germans, a hollowed-out black chess queen.
Sefton decides to take Dunbar out himself because he likes the odds this time and the expected reward from Dunbar’s family. The men give Sefton enough time to get Dunbar out of the water tower above one of the latrines, then throw Price out into the yard with tin cans tied to his legs. The ruse works: Price is killed in a hail of bullets, creating a diversion that allows Sefton and Dunbar to cut through the barbed wire and escape. A pleased Cookie whistles “When Johnny Comes Marching Home” as things can be seen returning to normal in the barracks.