The novel follows Tom Sawyer, an imaginative and mischievous boy being raised by his Aunt Polly in the small Mississippi River town of St. Petersburg. Tom dodges school and chores, leads other boys in games drawn from adventure books, and falls in love at first sight with a newcomer, Becky Thatcher. The early chapters are comic and domestic: Tom escapes a Saturday of whitewashing by persuading other boys that the work is a rare privilege, and even gets them to pay him for the chance to do it.
Beneath the comedy, Twain is interested in how a boy's mind actually works. Tom trades, schemes, sulks, and shows off, and the book lingers on the superstitions, oaths, and elaborate pretendings that fill his world. His courtship of Becky runs through quarrels and reconciliations, and in one scene he takes a schoolroom whipping in her place, an early sign of the loyalty and pride that drive him.
The mood darkens when Tom and Huck Finn slip into the graveyard at midnight and witness Injun Joe murder a young doctor, then frame the harmless drunkard Muff Potter for the crime. The boys swear in blood to keep the secret, and Tom is tormented by fear and guilt as the innocent Potter is brought to trial. At the last moment Tom finds the courage to testify, naming Injun Joe, who escapes through a courtroom window and vanishes.
Other adventures follow. Believing themselves unappreciated, Tom and two friends run off to an island to be pirates and are presumed drowned, returning dramatically to attend their own funeral. Later, hunting for buried treasure in a haunted house, the boys overhear Injun Joe and an accomplice discover a real box of gold and carry it off to a hiding place, which draws Tom unknowingly back toward danger.
The threads converge at a cave. Lost for days in its dark passages during a picnic, Tom and Becky face starvation, and Tom glimpses Injun Joe hiding there before finding a way out into daylight. When the cave is later sealed, Injun Joe is trapped inside and dies, and the boys recover the hidden gold. Suddenly wealthy, Tom is celebrated, while Huck, taken in by the Widow Douglas, chafes against clean clothes and regular hours. The book ends as a chronicle of boyhood that deliberately stops before its characters become adults.