The opening credits are played over a shot of a Smith & Wesson Model 29 revolver against a red background. When the credits finish playing, Harry Callahan's voice tells the audience, "This the .44 Magnum, the most powerful handgun in the world. And it could blow your head clean off. Do you feel lucky?" The hand turns the revolver and fires at the camera.
Labor racketeer and local mobster Carmine Ricca (Richard Devon) drives away from court after being acquitted on a technicality for the killing of a labor union leader and his family, much to the outrage of a mob of protesters outside the courthouse. A SFPD motorcycle cop with a photo on his dresser sees this on a TV broadcast and puts on his helmet and gear, then leaves his house.
Ricca, his attorney Weinstein, a bodyguard, and his driver James "Gino" Cantina drive a limo south on I-280 towards Potrero Hill. A motorcycle policeman catches up to the car and gestures for the driver to pull over. The driver pulls off onto a side street at the next exit, and comes to a stop. The cop walks up to the car and asks the driver for his license, telling him that he illegally crossed a double-white line. At Ricca's attorney's urging, the driver reluctantly hands over his license. The cop goes back to his bike, supposedly to write down information in his ticket book. After a few minutes, he returns and asks the driver for his vehicle registration. The driver asks to get his license back. In response, the cop suddenly whips his revolver out and shoots the limo driver in the side of the face. He then shoots the bodyguard in the passenger's seat as he tries to draw a pistol. He then puts two bullets each into Ricca and his attorney in the backseat. With all four men dead, the cop holsters his smoking revolver, walks back to his motorcycle and rides away.
Inspector 'Dirty' Harry Callahan (Clint Eastwood) and his partner Earlington 'Early' Smith (Felton Perry) drive by 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 Briggs because of Briggs's hands-off, bleeding-heart law enforcement methods - Riggs proudly boasts that he's never unholstered his gun once in all his years of police work, which leads the unimpressed Harry to mock Briggs with the words, "A man's got to know his limitations."
Harry and Early leave the scene and head to San Francisco International Airport to take lunch at a 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 makes a suggestion.
Dressed as a pilot, Harry gets aboard the plane and begins taxiing towards the runway for takeoff, but when the copilot asks if he knows how to fly, he admits that he never had a lesson... which shocks the gunmen in the cockpit long 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; when the surprised Briggs arrives at the now-freed aircraft Harry mockingly asks him, "What are you doing here, Lieutenant?" and leaves while the lieutenant seethes at being shown up.
Later Harry 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, the mystery motorcycle cop drives out to Tiburon, and the hillside estate of a known gangster who is hosting a swimming party. After parking his bike, he walks up the hill, creeping through the bushes, equipped with a satchel charge and an M76 sub-machine gun. He tosses the satchel charge into the pool to get the attention of the party-goers, who stare up at him, at which point he opens fire - gunning down everyone in attendance. As the bodies lie dead around or even in the pool, the officer walks back to his motorcycle and rides away. Briggs appears later on a broadcast condemning the violence.
Harry is watching the newscast at Carol McCoy's house, 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 Early, 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 Cost Plus World Market on Taylor Street, where through a two-way mirror in the manager's office, he and a uniformed officer monitor as Early and two checkout associates attend to customers. A man who is at the magazine rack leaves and then returns with three salty-looking dudes who promptly conjure shotguns and pistols. The group's leader punches 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 shoot him through the mirror. A gun battle erupts. Early shoots one of the robbers out front, the driver gets away, and the last man is shot dead by Harry. After the robbery is stopped, Harry and Early return to headquarters to finish the ensuing paperwork and they pass the four rookie cops, whom Early knows from their days at the police academy.
Later that night, we see a prostitute cut in line at the Fairmont Hotel downtown to get a taxicab. When she is about to climb out of the cab at her destination, the pimp (Albert Popwell) she is coming to see suddenly appears out of nowhere and roughly shoves her back into the cab and orders the driver to take off. He finds that she has been holding money from him and warns her that she just had her last chance. Angered, he attacks her and attempts to rape her. The cab driver, seeing the struggle, stops the cab and runs off to call the police. Inside the cab, the pimp pours an entire bottle of drain cleaner into the girl's mouth. As she writhes and convulses, the pimp takes his hat and the emptied bottle with him as he leaves, and we see the prostitute's arm fall out, limp, and dead.
The next morning, the pimp is driving across the Golden Gate Bridge when the vigilante motorcycle cop catches up to him and signals for him to pull over. The pimp takes the first exit, makes a left turn through the underpass, and stops on the service road underneath the north approach to the bridge. The pimp, as an extra precaution, hides a revolver under his crotch between his pant legs. The motorcycle cop dismounts his bike and walks up to the car, and claims to have caught the pimp speeding. He asks the pimp for his license and vehicle registration, and the pimp pulls out his wallet, flipping it to show his license, as well as a wad of $100 bills. He fails to notice the cop slowly raising his revolver. The pimp's eyes suddenly widen with horror just as the cop shoots him in the side of the neck. As the pimp writhes in the seat, the cop empties the rest of his bullets into his chest. The cop then re-holsters his revolver, walks back to his motorcycle, and rides off as the pimp bleeds to death.
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, which include the freshly deceased pimp. Harry is reassigned to Homicide by his and Briggs's 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 bullets reveal uselessly generic information about the weapons used.
The next day, Harry and Early examine a bullet recovered from the pimp's body that proves to be a .357 Magnum round. Harry and Early also examine the pimp's car at the crime lab, learning from the ballistics expert that the killer emptied an entire magazine into the pimp from point-blank range. When he notices that the pimp was holding out his driver's license and a $100 bill like he was trying to bribe a traffic cop, 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 harbor side 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 in Pacific Heights, puts a silencer on his revolver, and guns down drug kingpin Lou Guzman and three of his associates (who are being monitored by Harry's friend Frank DiGiorgio and his partner from an office building a block away) with a suppressed Colt Python. As the killer makes his way to the basement, he runs into Charlie McCoy, exiting the utility room. McCoy seems to recognize the killer cop and thinks he is just another fellow officer... until the killer cop raises his revolver and shoots McCoy in the chest. McCoy falls, his helmet falling off, at which point the mystery cop shoots him again in the head, then leaves. Upon seeing DiGiorgio, the cop tells them of McCoy's shooting, then holds back bystander. The killer cop removes his helmet... revealing himself to be 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. To prove his suspicions right, Harry borrows Davis's revolver and deliberately misses one target. He recovers it and matches it to the bullets 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 Davis and Sweet to back him up. Palancio and his men are having lunch in the office when they receive an anonymous phone call from an unseen person warning them that they will be attacked in two minutes by hit men disguised as cops. When Sweet knocks on the door, Palancio blasts him from behind the door with a shotgun, and a gun battle ensues. Harry takes out one thug wielding a sub-machine gun before backup arrives. After backup arrives, Davis manages to take out two thugs in the main office single-handedly. As Palancio attempts to flee, Harry clings onto the hood of his car, distracting Palancio, who dies when he takes a wrong turn and is skewered on a crane.
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.
Harry 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 Grimes following them. 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 beats Astrachan to death in one of the abandoned ship's hallways, then takes 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 unable to stop in time, and rides straight off the carrier deck and into the water, where he drowns. Harry looks down at Davis's 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 has driven 100 feet, killing the corrupt Lieutenant. The final scene of the movie is a close-up of Harry's face as he again says the movie's famous tagline: "A man's got to know his limitations", before he walks away.