In a decayed, rainy city, veteran Detective Lt. Somerset (Morgan Freeman) teams up with rookie Detective Mills (Brad Pitt) form an unlikely team set to stop a serial killer, whose victims all relate to the seven deadly sins. At the beginning of the investigation, Somerset is seven days from retirement. Mills has recently moved to the city with his wife Tracy (Gwyneth Paltrow). The investigation begins with an overweight man sitting with his face in a bowl of spaghetti. While investigating, Somerset finds the word "gluttony" written in grease behind a refrigerator. Another victim shows up, this time a wealthy lawyer killed in his office. The word "greed" is written in blood across his floor. Somerset begins to regret joining this case, because he doesn't want his last case to go unsolved. He changes his mind after a dinner with Mills and Tracy, and the two detectives continue the investigation. The next victim is near death, barely kept alive by the killer for a year. The word "sloth" is written over his bed. Mills and Somerset begin to notice the pattern the killer has been using so far, and go to the library to check the records of books relating to the seven deadly sins. They track down an apartment, and are attacked by an unidentified gunman. Mills chases the gunman into an alley, where the gunman gets the upper hand on the detective. His gun is pointing at Mills' head, when he runs off. Mills and Somerset break into the apartment and find pictures, writings, and religious imagery that makes "John Doe" (Kevin Spacey) their prime suspect. John Doe takes two more victims (lust and pride), until he turns himself in to the police. John makes a deal to take Somerset and Mills to the two undiscovered bodies, and he will plead guilty. If they refuse, then he will plead insanity. Mills and Somerset agree to accompany John Doe to where the bodies are supposed to be located.
Once they arrive at the spot, a delivery truck comes down the road. Somerset goes to stop it while John talks to Mills. Somerset stops the truck and finds a box. Taking a risk, he opens it and is shocked. He runs to Mills yelling "John Doe has the upper hand!" It is revealed that Tracy's head is in the box, cut off by John. Mills, horrified and infuriated, contemplates shooting John. Somerset tries to stop him because it's all part of his plan. John Doe envied Mills' life and now he must die to complete his vision. Mills shoots John (wrath), and is taken to get help. Somerset leaves with a quote from Ernest Hemingway.