The story begins in 1815 in Digne, as the peasant Jean Valjean, just released from 19 years' imprisonment in the galleys—five for stealing bread for his starving sister and her family and fourteen more for numerous escape attempts—is turned away by innkeepers because his yellow passport marks him as a former convict. He sleeps on the street, angry and bitter.
Digne's benevolent Bishop Myriel gives him shelter. At night, Valjean runs off with Myriel's silverware. When the police capture Valjean, Myriel pretends that he has given the silverware to Valjean and presses him to take two silver candlesticks as well, as if he had forgotten to take them. The police accept his explanation and leave. Myriel tells Valjean that his life has been spared for God, and that he should use money from the silver candlesticks to make an honest man of himself.
Valjean broods over Myriel's words. When opportunity presents itself, purely out of habit, he steals a 40-sous coin from 12-year-old Petit Gervais and chases the boy away. He quickly repents and searches the city in panic for Gervais. At the same time, his theft is reported to the authorities. Valjean hides as they search for him, because if apprehended he will be returned to the galleys for life as a repeat offender.
Six years pass and Valjean, using the alias Monsieur Madeleine, has become a wealthy factory owner and is appointed mayor of a town identified only as M____-sur-M__ (i.e., Montreuil-sur-Mer). Walking down the street, he sees a man named Fauchelevent pinned under the wheels of a cart. When no one volunteers to lift the cart, even for pay, he decides to rescue Fauchelevent himself. He crawls underneath the cart, manages to lift it, and frees him. The town's police inspector, Inspector Javert, who was an adjutant guard at the Bagne of Toulon during Valjean's incarceration, becomes suspicious of the mayor after witnessing this remarkable feat of strength. He has known only one other man, a convict named Jean Valjean, who could accomplish it.
Years earlier in Paris, a grisette named Fantine was very much in love with Félix Tholomyès. His friends, Listolier, Fameuil, and Blachevelle were also paired with Fantine's friends Dahlia, Zéphine, and Favourite. The men abandon the women, treating their relationships as youthful amusements. Fantine must draw on her own resources to care for her and Tholomyès' daughter, Cosette. When Fantine arrives at Montfermeil, she leaves Cosette in the care of the Thénardiers, a corrupt innkeeper and his selfish, cruel wife.
Fantine is unaware that they are abusing her daughter and using her as forced labor for their inn, and continues to try to meet their growing, extortionate and fictitious demands. She is later fired from her job at Jean Valjean's factory, because of the discovery of her daughter, who was born out of wedlock. Meanwhile, the Thénardiers' monetary demands continue to grow. In desperation, Fantine sells her hair and two front teeth, and she resorts to prostitution to pay the Thénardiers. Fantine is slowly dying from an unspecified disease.
A dandy named Bamatabois harasses Fantine in the street, and she reacts by striking him. Javert arrests Fantine. She begs to be released so that she can provide for her daughter, but Javert sentences her to six months in prison. Valjean (Mayor Madeleine) intervenes and orders Javert to release her. Javert resists but Valjean prevails. Valjean, feeling responsible because his factory turned her away, promises Fantine that he will bring Cosette to her. He takes her to a hospital.
Javert comes to see Valjean again. Javert admits that after being forced to free Fantine, he reported him as Valjean to the French authorities. He tells Valjean he realizes he was wrong, because the authorities have identified someone else as the real Jean Valjean, have him in custody, and plan to try him the next day. Valjean is torn, but decides to reveal himself to save the innocent man, whose real name is Champmathieu. He travels to attend the trial and there reveals his true identity. Valjean returns to M____-sur-M__ to see Fantine, followed by Javert, who confronts him in her hospital room.