The story revolves around a destitute young boy named Charlie Bucket born to a penniless, starving family. He resides with both his paternal and maternal grandparents, who are bedridden. Along with Charlie's mother and father, they dwell in a dilapidated, tiny house. Charlie is fascinated by the universally-celebrated chocolate factory located in his hometown owned by famous chocolatier Willy Wonka. His Grandpa Joe often tells him stories about Wonka and his mysterious chocolate factory, how it had been shuttered for years, and how it inexplicably re-opened and resumed candy production without any evidence of employees.
Soon after, an article in the newspaper reveals that Willy Wonka has hidden a Golden Ticket in five chocolate bars being distributed to anonymous locations worldwide, and that the discovery of a Golden Ticket would grant the owner with passage into Willy Wonka's factory and a lifetime supply of confectionery. Charlie longs for chocolate to satisfy his hunger and to find a Golden Ticket himself, but his chances are slim (his father has recently lost his job, leaving the family all but destitute) and word on the discovery of the tickets keeps appearing in various news articles read by the Bucket family, each one going to self-centred, bratty children: an obese, gluttonous boy named Augustus Gloop, a spoiled brat named Veruca Salt, a record-breaking gum chewer named Violet Beauregarde, and Mike Teavee, an aspiring gangster who is unhealthily obsessed with television. Eventually, Charlie finds a ticket of his own.
The children, once at the factory, are taken to the Chocolate Room, where they are introduced to Oompa Loompas, from Loompaland, who have been helping Wonka operate the factory. While there, Augustus falls into the chocolate river and is sucked up by a pipe and eliminated from the tour. They are soon taken to the Inventing Room, where Violet chews a piece of experimental gum, and blows up into a blueberry; she is the second child removed from the tour. After an exhausting jog down a series of corridors, Wonka allows his guests to rest outside of the Nut Room, but refuses them entry. Veruca, seeing squirrels inside, demands one from Wonka, but when she is refused, she invades the Nut Room, where the squirrels attack her, judge her a bad nut and throw her down the garbage chute. Likewise with her Father, who goes in to rescue her. The remaining visitors travel via the Great Glass Elevator to the Television Room, where Mike accidentally shrinks himself to a few inches tall using a teleporter Wonka invented, and is the last to be eliminated from the tour.
Charlie, being the last child left, wins the prize - the factory itself. Wonka had distributed the Golden Tickets to find an heir, and Charlie was the only one who passed the test. Together they go to Charlie's house in the glass elevator and take the whole family back to the chocolate factory to live out the rest of their lives.