In futuristic London, Alex DeLarge is the leader of his "droogs," Georgie, Dim, and Pete. One night, after getting intoxicated on "milk plus" (milk laced with drugs), they engage in an evening of "ultra-violence," including beating an elderly vagrant and fighting a rival gang led by Billyboy. After stealing a car, they drive to the country home of writer F. Alexander, where they beat Mr. Alexander to the point of crippling him for life. Alex then rapes his wife while singing "Singin' in the Rain."
The next day, while truant from school, Alex is approached by his probation officer Mr. P. R. Deltoid, who is aware of Alex's activities and cautions him. Afterward, Alex visits a record store where he picks up two girls. He takes them back home and has sex with them.
That night, his droogs express discontent with Alex's petty crimes, demanding more equality and more high-yield thefts. Alex reasserts his leadership by attacking them. Later Alex invades the mansion of a wealthy "cat-lady," while his droogs remain at the front door. Alex bludgeons the woman with a phallic statue. After hearing police sirens, Alex tries to run away, but Dim smashes a pint bottle of milk across his face, leaving him stunned. Alex is captured by the police. A gloating Deltoid spits in his face after he informs him that the woman died in the hospital, making him a murderer. Alex is sentenced to 14 years in prison.
Two years into his sentence, the Minister of the Interior arrives at the prison looking for test subjects for the Ludovico technique, an experimental aversion therapy for rehabilitating criminals within two weeks. Alex readily volunteers with the hope of early release. The process involves drugging the subject, strapping him to a chair, propping his eyelids open, and forcing him to watch images of violence. Alex becomes nauseated due to the drugs. He realizes that one of the films' soundtracks is by his favourite composer, Ludwig van Beethoven, and that the Ludovico technique will make him sick when he hears the music he loves. He begs the doctors to end the treatment, but they ignore his pleas.
After two weeks of the Ludovico technique, the Minister of the Interior puts on a demonstration to prove that Alex is "cured". He is shown to be incapable of fighting back against an actor who insults and attacks him, and becomes violently ill at the sight of a topless woman. The prison chaplain protests at the results, feeling that Alex has been robbed of his God-given freewill: "He ceases to be a wrongdoer. He ceases also to be a creature capable of moral choice." The prison governor asserts that they are not interested in the higher ethics but only with "cutting down crime and relieving the ghastly congestion in our prisons."
Alex is released and finds that his possessions have been confiscated by the police to help make restitution to his victims, and that his parents have rented out his room. Homeless, Alex encounters the elderly vagrant from before, who attacks him with several other friends. Alex is saved by two policemen who turn out to be Dim and Georgie. They drag Alex to the countryside, where they beat and nearly drown him. A dazed Alex wanders the countryside before coming to the home of the writer Mr. Alexander, who is now paralyzed. Alex collapses on the doorstep, then wakes up to find himself being cared for by Alexander and his manservant, Julian. Mr. Alexander, who does not recognize Alex as his attacker, has read about his treatment in the newspapers. Seeing Alex as a political weapon to attack the government, Mr. Alexander prepares to introduce Alex to his colleagues, but then he hears Alex singing "Singin' in the Rain" in the bath, and identifies Alex as the attacker who crippled him and raped his wife. With his colleagues' help, Alexander drugs Alex and places him in a locked upstairs bedroom. Alex wakes up to hear Beethoven's Ninth Symphony playing loudly through the floor below. Experiencing excruciating pain, he tries to commit suicide by jumping out the window and is knocked unconscious by the fall.
Alex wakes up in a hospital with broken bones. While being given a series of psychological tests, Alex finds that he no longer has an aversion to violence or sex. The Minister of the Interior arrives and apologizes to Alex. He offers to take care of Alex and get him a job in return for cooperation with his election campaign and PR counter-offensive. As a sign of goodwill, the Minister brings in a stereo system playing Beethoven's Ninth. Alex then contemplates violence and vivid thoughts of himself having sex in the snow with a woman in front of an approving crowd: "I was cured, all right!"