Valjean's character is loosely based on the life of Eugène François Vidocq, an ex-convict who became a successful businessman widely noted for his social engagement and philanthropy. Vidocq helped Hugo with his research for Claude Gueux and Le Dernier jour d'un condamné (The Last Day of a Condemned Man). In 1828, Vidocq, already pardoned, saved one of the workers in his paper factory by lifting a heavy cart on his shoulders as Valjean does. Hugo's description of Valjean rescuing a sailor on the Orion drew almost word for word on a friend's letter describing such an incident. Hugo used Bienvenu de Miollis (1753–1843), the Bishop of Digne during the time in which Valjean encounters Myriel, as the model for Myriel.
In 1841, Hugo saved a prostitute from arrest for assault. He used a short part of his dialogue with the police when recounting Valjean's rescue of Fantine in the novel. On 22 February 1846, when he had begun work on the novel, Hugo witnessed the arrest of a bread thief while a Duchess and her child watched the scene pitilessly from their coach. He spent several vacations in Montreuil-sur-Mer, which became the model for the town he calls M____-sur-M__. During the 1832 revolt, Hugo walked the streets of Paris, saw the barricades blocking his way at points, and had to take shelter from gunfire. He participated more directly in the 1848 Paris insurrection, helping to smash barricades and suppress both the popular revolt and its monarchist allies.