In an unnamed American city, soon-to-be-retiring detective William Somerset (Freeman) is partnered with short-tempered but idealistic David Mills (Pitt), who recently transferred to the department, moving to the city with his wife Tracy (Paltrow). Mills introduces Somerset to Tracy, after which Somerset becomes her confidant. Tracy is unhappy with the city and feels it is no place to raise a child. She discloses to Somerset that she is pregnant and has yet to inform her husband. Somerset sympathizes with her, having a similar situation with his ex-girlfriend many years earlier, and advises her to tell Mills only if she plans on keeping the child.
Somerset and Mills investigate a pair of murders. The first victim is an obese man forced to eat until his stomach ruptured. The second was a wealthy defense attorney who died from both fatal bloodletting and the removal of a pound of flesh. At each crime scene, the murderer leaves behind clues for the detectives, including a single word: gluttony at the obese man's home and greed at the attorney's office. Somerset recognizes them as part of the seven deadly sins and realizes the murders are related. Other clues lead them to a possible perpetrator's apartment. There, they find another victim, a known drug dealer and child molester, strapped to a bed, barely alive and emaciated, with a series of pictures indicating he had been tied to the bed for an entire year. The word sloth is scrawled on the wall. The photos also indicate the killer has been planning these deaths for some time.
Somerset and Mills identify a man named John Doe (Spacey), who has checked out several library books on the deadly sins. Doe flees when they go to his apartment, and Mills gives chase. Doe eventually corners Mills and holds him at gunpoint, but after a few moments, turns and escapes. At Doe's apartment, they find hundreds of handwritten journals showing Doe's apparent psychopathy, and clues leading to a fourth victim. They arrive too late to prevent the death of the victim, a prostitute killed by an unwilling man forced by Doe to wear a bladed S&M phallic device on his genitals and to rape and kill her while severely traumatizing him. They find lust written on the door. They are alerted to their next victim, an attractive young woman, presumably a model, whose face has been mutilated by Doe; she was given the option to call for help and be disfigured, or to commit suicide by taking pills. She chooses suicide. The word pride is written on her wall.
Shortly after, as Somerset and Mills return to the police station, they are approached by a man covered in blood, surrendering himself. Mills recognizes him as Doe and arrests him. They discover Doe has been removing the skin on his fingers to avoid leaving behind prints; the blood on him is from a yet-to-be-identified victim. Doe, through his lawyer, advises there are two more victims and offers to take the detectives to them and confess to all the murders, but only under very specific terms, or he will otherwise plead insanity. Somerset is wary, but Mills agrees.
The two detectives, following Doe's directions, drive him to a remote desert location. Within minutes, a delivery van approaches them. Mills holds Doe at gunpoint while Somerset goes to intercept the driver, who had been instructed to bring a box to them. As Somerset recovers the box and sends the driver away, Doe begins telling Mills about how jealous he is of Mills' life and marriage to Tracy, antagonizing Mills. Somerset opens the box, and in horror, tells Mills to stay back and not listen to Doe. Doe continues to taunt Mills as Mills frantically asks what is in the box. Doe reveals that he was so jealous of Mills, he killed Tracy, her death being a result of his envy, and that her head is in the box. Doe tries to goad Mills into vengeance, to become wrath and shoot him. Somerset desperately tries to convince Mills not to shoot Doe, but then Doe reveals that Tracy was pregnant. The revelation is too much for Mills and he shoots Doe, six times. Doe's death completes the seven sins. Police converge and take a devastated Mills away. The police captain reassures Somerset that Mills will be taken care of. When asked by the Police Captain where he will be, Somerset hints that he will not retire.
Output: What has Doe been doing so that he doesn't leave behind fingerprints?