The Scarlet Letter opens with a long preamble about how the book came to be written. The nameless narrator was the surveyor of the customhouse in Salem, Massachusetts. In the customhouse’s attic, he discovered a number of documents, among them a manuscript that was bundled with a scarlet, gold-embroidered patch of cloth in the shape of an “A.” The manuscript, the work of a past surveyor, detailed events that occurred some two hundred years before the narrator’s time. When the narrator lost his customs post, he decided to write a fictional account of the events recorded in the manuscript. The Scarlet Letter is the final product.

The story begins in seventeenth-century Boston, then a Puritan settlement. A young woman, Hester Prynne, is led from the town prison with her infant daughter, Pearl, in her arms and the scarlet letter “A” on her breast. A man in the crowd tells an elderly onlooker that Hester is being punished for adultery. Hester’s husband, a scholar much older than she is, sent her ahead to America, but he never arrived in Boston. The consensus is that he has been lost at sea. While waiting for her husband, Hester has apparently had an affair, as she has given birth to a child. She will not reveal her lover’s identity, however, and the scarlet letter, along with her public shaming, is her punishment for her sin and her secrecy. On this day Hester is led to the town scaffold and harangued by the town fathers, but she again refuses to identify her child’s father.

The elderly onlooker is Hester’s missing husband, who is now practicing medicine and calling himself Roger Chillingworth. He settles in Boston, intent on revenge. He reveals his true identity to no one but Hester, whom he has sworn to secrecy. Several years pass. Hester supports herself by working as a seamstress, and Pearl grows into a willful, impish child. Shunned by the community, they live in a small cottage on the outskirts of Boston. Community officials attempt to take Pearl away from Hester, but, with the help of Arthur Dimmesdale, a young and eloquent minister, the mother and daughter manage to stay together. Dimmesdale, however, appears to be wasting away and suffers from mysterious heart trouble, seemingly caused by psychological distress. Chillingworth attaches himself to the ailing minister and eventually moves in with him so that he can provide his patient with round-the-clock care. Chillingworth also suspects that there may be a connection between the minister’s torments and Hester’s secret, and he begins to test Dimmesdale to see what he can learn. One afternoon, while the minister sleeps, Chillingworth discovers a mark on the man’s breast (the details of which are kept from the reader), which convinces him that his suspicions are correct.

Dimmesdale’s psychological anguish deepens, and he invents new tortures for himself. In the meantime, Hester’s charitable deeds and quiet humility have earned her a reprieve from the scorn of the community. One night, when Pearl is about seven years old, she and her mother are returning home from a visit to a deathbed when they encounter Dimmesdale atop the town scaffold, trying to punish himself for his sins. Hester and Pearl join him, and the three link hands. Dimmesdale refuses Pearl’s request that he acknowledge her publicly the next day, and a meteor marks a dull red “A” in the night sky. Hester can see that the minister’s condition is worsening, and she resolves to intervene. She goes to Chillingworth and asks him to stop adding to Dimmesdale’s self-torment. Chillingworth refuses.

Hester arranges an encounter with Dimmesdale in the forest because she is aware that Chillingworth has probably guessed that she plans to reveal his identity to Dimmesdale. The former lovers decide to flee to Europe, where they can live with Pearl as a family. They will take a ship sailing from Boston in four days. Both feel a sense of release, and Hester removes her scarlet letter and lets down her hair. Pearl, playing nearby, does not recognize her mother without the letter. The day before the ship is to sail, the townspeople gather for a holiday and Dimmesdale preaches his most eloquent sermon ever. Meanwhile, Hester has learned that Chillingworth knows of their plan and has booked passage on the same ship. Dimmesdale, leaving the church after his sermon, sees Hester and Pearl standing before the town scaffold. He impulsively mounts the scaffold with his lover and his daughter, and confesses publicly, exposing a scarlet letter seared into the flesh of his chest. He falls dead, as Pearl kisses him.

Frustrated in his revenge, Chillingworth dies a year later. Hester and Pearl leave Boston, and no one knows what has happened to them. Many years later, Hester returns alone, still wearing the scarlet letter, to live in her old cottage and resume her charitable work. She receives occasional letters from Pearl, who has married a European aristocrat and established a family of her own. When Hester dies, she is buried next to Dimmesdale. The two share a single tombstone, which bears a scarlet “A.”