Eight years have passed and Valjean, having broken his parole and changed his name to Monsieur Madeleine, has risen to become both a factory owner and Mayor. One of his workers, Fantine, has a secret illegitimate child. When the other women discover this, they demand her dismissal. The foreman, whose advances she has rejected, throws her out. Desperate for money to pay for medicines for her daughter, Fantine sells her locket, her hair, and then joins the whores in selling herself. Utterly degraded by her new trade, she gets into a fight with a prospective customer and is about to be taken to prison by Javert when "The Mayor" arrives and demands she be taken to a hospital instead. The Mayor then rescues a man pinned down by a runaway cart. Javert is reminded of the abnormal strength of convict 24601 Jean Valjean, a parole-breaker whom he has been tracking for years, but who, he says, has just been recaptured. Valjean, unable to see an innocent man go to prison in his place, confesses to the court that he is prisoner 24601. At the hospital, Valjean promises the dying Fantine to find and look after her daughter Cosette. Javert arrives to arrest him, but Valjean escapes.
Young Cosette has been lodged for five years with the Thenardiers who run an inn, horribly abusing the little girl whom they use as a skivvy while indulging their own daughter, Eponine. Valjean finds Cosette fetching water in the dark. He pays the Thernardiers to let him take Cosette away and takes her to Paris. But Javert is still on his tail...
Nine years later there is a great unrest in the city because of the likely demise of the popular leader General Lamarque, the only man left in the Government who shows any feeling for the poor. The urchin Gavroche is in his element mixing with the whores and beggars of the capital. Among the street gangs is one led by Thernardier and his wife, which sets upon Jean Valjean and Cosette. They are rescued by Javert, who does not recognize Valjean until after he has made good his escape. The Thernardiers' daughter Eponine, who is secretly in love with the student Marius, reluctantly agrees to help him find Cosette, with whom he has fallen in love. At a political meeting in a small cafe, a group of idealistic students prepare for the revolution they are sure will erupt on the death of General Lamarque. When Gavroche brings the news of the General's death, the students, led by Enjolras, stream out into the streets to whip up popular support. Only Marius is distracted by thoughts of the mysterious Cosette. Cosette is consumed by thoughts of Marius, with whom she has fallen in love. Valjean realizes that his "daughter" is changing very quickly but refuses to tell her anything of her past. In spite of her own feelings for Marius, Eponine sadly brings him to Cosette and then prevents an attempt by her father's gang to rob Valjean's house. Valjean, convinced it was Javert who was lurking outside his house, tells Cosette they must prepare to flee the country. On the eve of the revolution the students and Javert see the situation from their different viewpoints; Cosette and Marius part in despair of ever meeting again; Eponine mourns the loss of Marius; and Valjean looks forward to the security of exile. The Thernardiers, meanwhile, dream of rich pickings underground from the chaos to come.
The barricade is built and the revolutionaries defy an army warning that they must give up or die. Gavroche exposes Javert as a police spy. In trying to return to the barricade Eponine is shot and killed. Valjean arrives at the barricades in search of Marius. He is given the chance to kill Javert, but instead lets him go.
The students settle down for a night on the barricade and, in the quiet of the night, Valjean prays to God to save Marius from the onslaught which is to come. The next day, with ammunition running low, Gavroche runs out to collect more and is shot. The rebels are all killed, including their leader, Enjolras. Valjean escapes into the sewers with the unconscious Marius. After meeting Thernardier, who is robbing the corpses of the rebels, he emerges into the light only to meet Javert once more. He pleads for time to deliver the young man to a hospital. Javert decides to let him go and, his unbending principles of justice having been shattered by Valjean's own mercy, he kills himself by throwing himself into the swollen River Seine. A number of Parisian women come to terms with the failed insurrection and its victims. Unaware of the identity of his rescuer, Marius recovers in Cosette's care.
He and Cosette go to Valjean, where Cosette learns for the first time of her own history before the old man dies, joining the spirits of Fantine, Eponine and all those who died on the barricades.