Red, the narrator, recounts how he planned and carried out his wife’s murder by disabling her brakes, which accidentally killed a neighbor and child as well and earned him a life sentence at Shawshank Prison. Red also remembers the arrival of an inmate named Andy Dufresne, whose tenure at Shawshank affected the lives of everyone at the prison. Andy was sent to Shawshank for life in 1947 for the cold-blooded murder of his wife, Linda, and her lover, tennis pro Glenn Quentin. Despite the damning evidence placing him at the scene of the crime on the night of the murders, Andy has always maintained his innocence, which Red eventually comes to believe in as well.

Andy has some initial difficulty adjusting to prison life, especially because many of the other prisoners think he’s a snob. A gang of men known as the Sisters frequently attack and rape him in the laundry room while the guards look the other way. Andy fights the Sisters, even though it always lands him in the infirmary and sometimes solitary confinement. Despite these hardships, however, Andy never complains or loses his confidence.

Soon after arriving at Shawshank, Andy approaches Red and asks him to procure a rock hammer because he’s interested in rock collecting and carving. After a while, he also pays Red to smuggle in some polishing cloths and then, rather nervously, a large poster of pinup Rita Hayworth. Red fulfills Andy’s requests.

After a few years, Red and Andy both find themselves on a work crew, tarring the roof of the prison’s license plate factory. Andy overhears Byron Hadley, a prison guard, complaining to the other guards about the taxes he’ll have to pay on the $35,000 he just inherited from his long-lost brother. Andy offers Hadley some financial advice by telling him to give the money to his wife as a one-time tax-free gift. Andy even offers to fill out the paperwork for Hadley in exchange for giving three beers to each prisoner on the work crew. After some initial hesitation and suspicion, Hadley agrees. The deal wins Andy the respect of everyone involved and makes him a mythic hero in the eyes of the prisoners. Andy also becomes a valuable financial resource to those who run the prison. As a result, the guards and the warden protect Andy from the Sisters, make him the prison librarian, and don’t assign other inmates to his cell. Andy relishes his new position and works hard during the next two decades to significantly expand the library.

Andy’s financial responsibilities start with filing the guards’ tax returns, but they soon expand to laundering money for the various prison wardens, including Bible-thumping Samuel Norton. Andy has no moral objection to hiding the money that Norton receives from construction companies, but he doesn’t realize that doing so also hurts his chances of ever leaving Shawshank.

A new inmate named Tommy Williams arrives at Shawshank and tells Andy that he served time in another prison with Elwood Blatch, a man who privately admitted to killing tennis pro Glenn Quentin. When Andy asks Norton to request a retrial, Norton dismisses Andy’s claims and puts him in solitary confinement for more than a month on the “grain and drain” diet of bread and water. Norton, meanwhile, transfers Tommy Williams to another prison out of fear that Andy would expose his money laundering operation if paroled. After another aborted attempt to reason with the warden and another stint in solitary, Andy drops the issue and becomes more brooding and introspective.

Eventually Andy emerges from his lengthy depression and tells Red one day that he had a friend set up a false identity for him. Under the false identity, the friend invested $14,000 of Andy’s money, which has since become more than $370,000. Andy, however, can’t touch the money, saved under his alternate identity, because he would risk exposing himself and losing everything. The documents and lucrative bonds are kept in a safe-deposit box at a local bank, the key to which has been stashed under a black volcanic rock wedged into a stone wall in the countryside near the prison. Andy dreams of escaping, assuming the new identity, and becoming the proprietor of a small hotel in Mexico. Andy also imagines Red going with him.

Red thinks nothing of this until years later when the prison guards find Andy’s cell empty one morning. The guards search the prison but find nothing, until an extremely frustrated Norton rips the pinup poster from the wall to reveal a gaping hole in the thick concrete. The hole leads to the sewage drainpipe, which empties into the marshes surrounding Shawshank. Red figures that Andy slowly and systematically used the rock hammer and polishing cloths every night for nearly twenty years to carve through the wall. After completing his hole, Red also figures that it took Andy roughly eight years to muster the courage to actually try to escape.

A search of the marshes and nearby towns reveals nothing, however, and Norton has a nervous breakdown and resigns. Red never hears anything from Andy but receives a blank postcard from a border town in Texas some months later. The story of Andy’s escape spreads throughout the prison and gives him an even greater mythic status. He becomes the symbol of hope for many prisoners, not only as someone who successfully escaped, but also as a man who never let prison crush his spirit.

Red adds a postscript to his story about a year later, writing from a hotel in Portland, Maine, after being released from Shawshank. The transition to life on the outside has been tough, and Red thinks of Andy when he feels the urge to commit a petty crime or violate the terms of his parole so that he’ll be put back in prison. Now working as a bag boy at a supermarket, Red uses his days off to explore the countryside, partly because he likes the freedom and the space but also because he’s looking for the volcanic rock where Andy hid the key to the safe-deposit box.

Red walks the rural hayfields in search of the stone wall Andy had described years earlier, and after several weeks of searching, he finally finds the rock. Underneath, Red discovers a letter addressed to him from Peter Stevens, Andy’s pseudonym. The letter invites Red to join Andy in Mexico and includes a gift of $1,000. Red concludes the postscript with renewed hope for the future as he decides to abandon his job, violate his parole, and make his way to Mexico to find Andy.