Harry Callahan, Inspector, SFPD, had foiled the Scorpio Killer, but had thrown his badge into a river in shame at the cowardice of the city. The city, however, has overlooked this incident in tacitly acknowledging being wrong in its handling of Scorpio, and Harry is reinstated. He thus continues to carry a trusty Smith & Wesson .44 Magnum revolver and continues to be a terror to perps in San Francisco.
But he may have some unwanted competition, for labor racketeer and local mobster Carmine Ricca (Richard Devon) drives away from court after being acquitted for the killing of a labor union leader on a technicality. An unseen SFPD motorcycle cop stops Ricca's limo for a traffic violation. Suddenly, the patrolman pulls his service revolver - a .357 Magnum Colt Python, shoots all four men in the car, then rides away.
Inspector 'Dirty' Harry Callahan (Clint Eastwood) and his partner Earlington 'Early' Smith (Felton Perry) visit the crime scene, but are asked to leave by Harry's newest adversary on the force, the hot-tempered Lt. Neil Briggs, who had Harry "loaned" from Homicide to Stakeout because he despises his methods. The loathing is mutual; Harry detests Lt. Briggs because of Briggs' hands-off, bleeding-heart law enforcement methods.
Harry and Early leave and find lunch at an airport snack shop run by Bill McKenzie, a former buddy of Harry's from the force. Early, a comparatively wet-behind-the-ears youngster on the force, is grossed out when McKenzie talks about the Ricca killing and a case he worked on involving a gruesome axe murder, all the while Harry chows down on his burger as though nothing is untoward.
But a code signal for trouble comes, and Harry notices a group of concerned airport officials gathering around a small cul-de-sac. Harry investigates and finds that airport security is sweating out the hijacking of a jetliner; Harry flashes his badge and learns the hijackers want an overseas pilot, so Harry volunteers.
Harry gets aboard the plane and begins taxiing for takeoff, but when the copilot asks if he knows how to fly, he replies that he doesn't... which shocks the gunmen enough for Harry to disarm one and kill the other, and gives him opportunity to show up Lt. Briggs when he arrives at the scene. The dislike between Callahan and Briggs escalates, with Callahan mocking Briggs with the words "A man's got to know his limitations".
Later he arrives at a target range near Oakland and encounters an old friend, traffic officer Charlie McCoy (Mitchell Ryan). McCoy has recently left his wife Carol, though it is clear he still holds her close to his heart, and is bitter over how his life has changed. Harry, concerned, suggests Charlie retire, but Charlie vows never to do so and instead "go out fighting."
In the target range Harry encounters four rookie traffic cops - Philip Sweet (Tim Matheson), John Davis (David Soul), Donald "Red" Astrachan (Kip Niven), and Michael Grimes (Robert Urich), who practice incessantly and are inseparable buddies from their days as Army Rangers. Harry chats with them for a few minutes and even lets Phil Sweet try his .44; he is impressed by Sweet's dexterity with the heavy revolver and with the four young policemen overall.
The next day a uniformed officer sneaks to the estate of a known gangster who is hosting a swimming party. The cop throws a satchel charge into the pool and machine-guns all the partygoers, then sneaks away with over 30 people dead and Lt. Briggs appearing on television at the sight vowing such crimes will be stopped. Harry is watching the newscast at the house of Carol McCoy, and she is glad that the ordeal of her divorce is now over; she then asks Harry why he's never hit on her, but her seduction is interrupted by the play of her rambunctious children, then by a phone call to Harry from Earlington Smith, who is part of a stakeout at a general store where possible robbery suspects have arrived. Harry thus is forced to cut short his dinner date with Carol and drive to the back entrance of the store, where through a two-way mirror he and a uniformed officer monitor as Early and two checkout associates attend to customers before a suspect at the magazine rack leaves and then returns with three "salty-looking dudes" who promptly produce shotguns and pistols. The group's leader slugs the store's eldest associate, orders him to find the store safe, and then orders Early to his knees - a fatal mistake for it gives Harry the opening to blast the punk through the mirror and a gun battle erupts where Early shoots another robber while a third gets away by car and a fourth is shot dead by Harry. After the incident Harry and Early return to headquarters to finish the ensuing paperwork and Early encounters the four rookie cops, whom Early knows from their days at the police academy.
Later that night, a brutal cocaine-sniffing pimp (Albert Popwell) kills one of his girls, and is stopped the next morning and shot dead by the unseen vigilante cop. Harry returns home that night where a new neighbor, a young woman named Sunny, greets him; a long-time admirer of his heroism, Sunny offers Harry her own gratitude by asking to bed him. But they are interrupted when Lt. Briggs calls Harry to the city morgue to view the bodies of victims of the vigilante, all of them known criminals. Harry is reassigned to Homicide by his and Briggs' superior, Captain Avery, but a clue is difficult to come by - there are no witnesses to the murders though uniformed patrolmen keep finding the bodies, and ballistics checks of the slugs reveal uselessly generic information about the weapons used.
The next day - after Harry and Sunny consummate her reward of gratitude - Harry and Early examine a bullet that proves to be a .357 Magnum round, and Harry begins to suspect that the killer of these criminals is someone they'd never suspect; he thus begins to clash with Briggs when Briggs suspects harborside racketeer Frank Palancio, who had worked with Ricca in the past, may be behind the murders.
Harry and Early tail Palancio and harass him as he is driven around the city. But elsewhere, the vigilante cop reaches the top of a penthouse and guns down Palancio associate Lou Guzman, who is being monitored by Harry's friend Frank DiGeorgio and his partner from an office building a block away. As the killer makes his way to the basement, he runs into traffic cop Charlie McCoy. McCoy seems to recognize the killer cop and thinks he is just another fellow officer... until the killer shoots McCoy, then upon seeing DiGeorgio tells them of McCoy's shooting, then keeps a crowd of bystanders back. The killer cop removes his helmet... revealing himself as John Davis.
Lt. Briggs chews out Harry for harassing Palancio before revealing McCoy's death. Harry and Davis see Charlie's widow and her kids off for the funeral flight back east, and Harry thanks Davis for showing his support. But Harry harbors suspicions about Davis; when they stumble into a robbery attempt at a bowling alley they subdue the robbers before Davis furiously dresses down bystanders for letting such crimes take place.
Later, Davis and Harry compete in a police shooting contest, and that night Harry finds and examines a bullet from Davis' gun, and it matches a bullet from Charlie McCoy's body. But Harry is reluctant to reveal all he knows when he shows Lt. Briggs a bullet under a forensic microscope, as he now trusts no one.
His mistrust proves warranted when a police raid hits Palancio's harborside offices. Harry has asked for John Davis and Phil Sweet to back him up, but the thugs (who had received an anonymous phone call from an unseen peson that hitmen dressed as cops would attack them in minutes) open fire, killing Sweet, and a gun battle ensues that leaves Palancio and his associates dead and Harry injured. When Briggs and Captain Avery try to blame Harry for the debacle, Harry fights back by noting Palancio's men fired first, indicating they were tipped off. Briggs refuses to believe it, vows to ruin Callahan's career, and has Harry hand over the bullet he showed earlier.
But the bullet is a fake, as Harry still has the one he found earlier. He now reveals all to Early Smith as he gives him the bullet to give to Briggs if anything happens to Harry. Harry, however, is confronted by the three surviving vigilante cops in the garage of his apartment who make him an offer to join their organization of killing criminals. Harry responds: "I'm afraid you've misjudged me." The three vigilante cops then leave.
The next day, Harry Callahan discovers and defuses a bomb in his mailbox apparently left by the vigilantes in case he refused their offer, but a second bomb kills Early. Briggs arrives and asks Callahan to drive to police headquarters with the bomb. But in the car Briggs draws his .357 Magnum Smith & Wesson Model 19 snubnose revolver and forces the inspector to disarm. Briggs reveals himself as the leader of the death squad, cites the traditions of frontier justice and summary executions, and says, "You're a great cop, Harry... but you'd rather stick with the system." Callahan responds, "I hate the goddamn system! But until someone comes along with some changes that make sense, I'll stick with it." Briggs then instructs Harry to get off at the next exit, and as Harry looks in the rear-view mirror he sees a motorcycle cop following. Instantly Harry knows he's been set up.
Harry overpowers Briggs and knocks him unconscious, then dumps Briggs out of the car at a shipyard. He then kills the pursuing Grimes by hitting him head-on with his car. He runs onto an old aircraft carrier as the remaining two vigilante cops arrive. The unarmed Harry evades his pursuers and kills Astrachan by beating him to death in one of the abandoned ship's hallways, then rides his motorcycle with Davis in pursuit. After a series of daring jumps on the carrier, the two cyclists run out of deck space; Harry is able to stop, but Davis is killed when he flies off the carrier deck and into the water. Harry looks down at Davis' body floating in the water and contemptuously says, 'Briggs was right - you guys don't have enough experience'. As Harry stumbles back to his damaged car, Briggs appears again, his .38 snubnose aimed squarely at Harry. The crooked Lieutenant menaces the inspector and threatens to prosecute Harry for killing fellow cops. Harry stealthily activates the timer on the mail bomb as Briggs gets into the car and drives off. The bomb explodes before Briggs gets 100 feet away, killing the corrupt Lieutenant. The final scene of the movie is a close-up of Dirty Harry Callahan's face as he again says the movie's famous line: "A man's got to know his limitations", before he walks away.