Soon-to-retire Detective Lieutenant William Somerset is partnered with short-tempered but idealistic Detective David Mills, who has recently moved to an unnamed large city with his wife Tracy.
Somerset and Mills investigate a set of murders inspired by the seven deadly sins: a morbidly obese man forced to eat until his stomach burst, representing gluttony, and a criminal defense attorney killed after being forced to cut a pound of flesh from himself, representing greed. Clues at the murder scenes lead them to a suspect's apartment, where they find a third victim, a drug dealer and child molester, strapped to a bed, emaciated and barely alive, representing sloth. The third victim is in critical condition and unable to respond to Somerset and Mills' questioning. Daily photographs of the victim, taken over a year, show the crimes were planned far in advance.
After forming a friendship with Somerset, Tracy confides to him that she is pregnant and has yet to tell Mills, as she is unhappy with the city and feels it is no place to raise a child. Somerset sympathizes, having had a similar situation with his ex-girlfriend many years earlier, and advises her to tell Mills only if she plans to keep the child.
The detectives use library records to identify a John Doe and track him to his apartment. Doe flees and Mills gives chase, during which Mills falls from a fire escape and injures his arm. Mills searches a truck before being struck in the head with a tire iron. While Mills is incapacitated, Doe walks up and holds him at gunpoint for a moment before escaping. The apartment contains hundreds of notebooks revealing Doe's psychopathy, as well as a clue to another murder. The detectives arrive too late to stop a man forced by Doe at gunpoint to kill a prostitute by raping her with a custom-made, bladed strap-on, representing lust. The following day, they attend the scene of a fifth victim, a model whose face has been mutilated by Doe; she was given the option to call for help and live disfigured or commit suicide by taking pills, and chose the latter option, representing pride.
As Somerset and Mills return to the police station, Doe unexpectedly turns himself in, covered in the blood of an unidentified victim. Doe offers to confess to his crimes, but only on the condition that he escort Somerset and Mills to a secret location where the victims representing envy and wrath are presumably buried, otherwise he will plead insanity. Somerset is wary, but Mills agrees. During the drive, Doe expresses his lack of remorse for his crimes, declaring that his victims deserved to die, and professes himself to be a martyr chosen by a higher power to shock the world out of its state of apathy. Doe also makes cryptic, threatening remarks towards Mills, who maintains his belief that Doe is simply insane.
Doe's directions lead the detectives to a remote deserted location. Minutes after their arrival, a delivery van approaches. Mills holds Doe at gunpoint while Somerset goes to intercept the driver, who says he was instructed to deliver a box to their coordinates. Somerset opens the box and, in a sudden panic, tells Mills to stay back. Doe reveals that he himself represents the sin of envy, as he envied Mills’ life with Tracy, and implies that the box contains Tracy’s severed head. He goads Mills, telling him that Tracy begged for her life and the life of her unborn child, and reacts with surprise and delight when he realizes Mills was unaware that Tracy was pregnant. Despite Somerset’s warnings, an enraged Mills fulfills his own role as wrath and shoots Doe fatally and repeatedly, completing Doe’s plan. Somerset and the police captain watch as the devastated Mills is taken away. When the captain asks where he'll be, Somerset says he will be around, implying that he will not retire. In a voiceover, he says: "Ernest Hemingway once wrote 'The world is a fine place and worth fighting for.' I agree with the second part."
Brad Pitt as Detective David Mills
Morgan Freeman as Detective Lieutenant William Somerset
Gwyneth Paltrow as Tracy Mills
Kevin Spacey as John Doe
R. Lee Ermey as Police Captain
Richard Roundtree as District Attorney Martin Talbot
Richard Schiff as Mark Swarr
Mark Boone Junior as greasy FBI Man
Michael Massee as Man in massage parlour booth
Leland Orser as Crazed Man in massage parlour
Julie Araskog as Mrs. Gould
John C. McGinley as California, SWAT team leader
Hawthorne James as library night guard George
Bob Mack as Gluttony Victim
Gene Borkan as Greed Victim
Michael Reid MacKay as Sloth Victim
Cat Mueller as Lust Victim
Heidi Schanz as Pride Victim
Reg E. Cathey as Dr. Santiago