In post-war Vienna, a city occupied by four Allied forces and sustained by a thriving black market, American writer Holly Martins arrives, penniless, at the invitation of his old friend Harry Lime, who had offered him a job. Holly goes to Harry's apartment and is told by the porter that Harry was run over by a car and killed. He rushes to the cemetery, where he finds Harry's funeral in progress. As he leaves the gravesite, Holly is approached by a British officer, Major Calloway, who offers him a ride and buys him a drink. When Calloway tells him that Harry was a notorious racketeer, Holly drunkenly vows to prove him wrong. Later, at his hotel, Holly is approached by Crabbin, the head of a cultural institute, who mistakes him for a prestigious novelist and offers to pay for his stay in Vienna if he will speak at one of their meetings. Holly soon receives a call from "Baron" Kurtz, who identifies himself as a friend of Harry and arranges to meet Holly at a café. Kurtz describes Harry's accident and mentions that Harry's Rumanian friend Popescu was also present when Harry died. Holly inquires about the beautiful woman he saw at the funeral, and Kurtz replies that she was Harry's girl friend, Anna Schmidt, an actress at the Josefstadt Theatre. Holly calls on Anna after a performance, and she tells him that Harry's personal physician, Dr. Winkel, happened to show up at the scene of the accident, and that the man behind the wheel of the car was actually Harry's driver. Anna expresses her suspicion that Harry's death was not accidental, and accompanies Holly to Harry's apartment to question the porter. Contrary to Kurtz's account, the porter says that Harry was killed at once, adding that an unidentified third man was present and helped carry the body. When Holly escorts Anna to her apartment, they find Calloway and members of the international police force searching her room. Calloway confiscates Anna's identification papers, claiming they were forged, takes her to the police station and questions her about Josef Harbin, an employee of a military hospital who recently disappeared. After Anna is released, she and Holly go to a nightclub, where they are joined by Kurtz and Popescu, and Holly relates what the porter told him about the third man. The next evening, Holly and Anna set out to talk to the porter again, but as they approach the building, the neighbors tell them that the porter has been murdered. When Holly returns to his hotel, he is promptly whisked away to Crabbin's cultural institute. The badly shaken Holly stumbles through his guest appearance at the literary salon, but when Popescu arrives with two men, he flees. Holly goes to see Calloway, who tells him about Vienna's black market for penicillin, explaining that racketeers often increase their profits by diluting the drug, which has disastrous medical effects. Calloway says that Harbin worked for Harry, stealing penicillin from laboratories, and shows Holly the evidence his men have collected implicating Harry and Kurtz. Holly is appalled by his friend's actions, and goes to Anna and tells her that he is returning to the United States, then admits his strong feelings for her. After leaving Anna's apartment, Holly notices a man standing in the shadows and dares him to reveal himself. When an irate neighbor opens a window, the light falls across the face of Harry Lime, who disappears before Holly can reach him. Holly summons Calloway, who retraces Harry's escape route and discovers an abandoned news kiosk leading underground to the main sewer. Calloway has Harry's coffin exhumed, and the body inside turns out to be Harbin's. Using Kurtz as an intermediary, Holly arranges a meeting with Harry at the amusement park ferris wheel. Harry smoothly dismisses Holly's moral outrage at the penicillin racket and warns his old friend to stop talking to the police. Undeterred, Harry offers to help the police capture Harry in exchange for safe passage out of Vienna for Anna, who is about to be arrested by the Russians. When Anna furiously rejects the deal, Holly wants to quit, but Calloway takes him to the children's hospital to see some of the brain-damaged young victims of Harry's racketeering. Heartsick over what he sees, Holly agrees to act as a decoy to capture Harry. After waiting for Harry for hours in a café, Holly is joined by Anna, who berates him for working for the police. When Harry arrives, Anna warns him, and he escapes into the sewer, with Holly and the police in pursuit. Harry shoots and kills a British soldier, Sgt. Paine, and Holly slips away and shoots Harry as he tries to crawl through a grate to the street above. After Harry's real funeral, Holly watches in despair as Anna silently walks away down a long, tree-lined avenue.