Charlie Bucket is a young boy living in a tiny wooden house at the edge of a big city with his parents and four grandparents: Mr. Bucket, Mrs. Bucket, Grandpa Joe, Grandma Josephine, Grandpa George, and Grandma Georgina. The family is very poor, living only on what Mr. Bucket makes screwing toothpaste caps on at a toothpaste factory. They are constantly hungry, which is especially hard for Charlie, since they live down the street from an enormous chocolate factory and he loves chocolate more than anything else.
Every night, Charlie listens to Grandpa Joe tell stories about Mr. Willy Wonka, the owner of the chocolate factory and the greatest chocolate maker the world has ever seen. Nobody has ever seen the inside of this peculiar factory, and nobody knows what kind sort of people works there.
One day, the newspaper reveals that Mr. Wonka has decided to open up his factory to a lucky few. He has hidden five Golden Tickets inside his chocolate bars and shipped them all over the world, and the five children who find the Golden Tickets will be invited to tour his factory and will receive a lifetime supply of chocolate. Charlie wants to find a ticket so badly, but he only receives a Wonka bar once a year on his birthday, so he believes he does not stand a chance.
The first four Golden Tickets are found by four naughty children. Augustus Gloop is a large boy who is constantly eating, Veruca Salt a spoiled girl constantly asking her parents to buy her things, Violet Beauregarde a compulsive gum-chewer, and Mike Teavee a child who wastes his life away in front of the television. Their parents indulge them and do nothing to stop their terrible behavior. Charlie reads about them and grows hopeless, wishing he were in their position.
Two weeks later, Charlie finds a dollar lying in the street and excitedly uses it to buy two Wonka Bars. He does it because he is hungry, since Mr. Bucket lost his job at the toothpaste factory and has not been bringing much money home for food, not because he wants to find a Golden Ticket—however, he unwraps the second bar to reveal the telltale shimmer of gold. He has found the fifth Golden Ticket!
The following day is the factory visit; Charlie chooses to bring Grandpa Joe with him, since it will mean the most to the old man out of everyone in the family. The other four children have all brought their parents. Mr. Wonka comes out of the factory to greet them, and Charlie is amazed at the sight of him. He takes them into the factory to begin the tour.
They start with the Chocolate Room, an enormous room containing a valley of edible grass and plants and a chocolate river. Churning up the river is a chocolate waterfall. In this room, the visitors see the factory workers for the first time. They are tiny people called Oompa-Loompas, who Wonka smuggled from their dangerous home Loompaland in order to work in the factory.
Augustus Gloop begins to grab fistfuls of chocolate from the river, and does not stop when Mr. Wonka asks him to. Suddenly he leans too far and falls in, getting sucked up one of the tubes that carries the chocolate away. A pair of Oompa-Loompas escort Mr. and Mrs. Gloop up to the Fudge Room to retrieve him, and then the Oompa-Loompas sing a song to teach a lesson about the dangers of being a glutton like Augustus.
The group takes a pink candy Viking boat down the chocolate river to the Inventing Room, where Wonka shows them his new invention: chewing gum that tastes like a full, three-course meal. Because it is gum, Violet Beauregarde insists on trying it, despite Wonka's warning that he has not gotten it quite right yet. When she gets to the dessert, blueberry pie and ice cream, her skin begins to turn blue and she blows up like a blueberry. The Oompa-Loompas roll her away to be squeezed, and sing a song that speaks against chewing gum all day long.
Next is the Nut Room, where hundreds of real squirrels work to shell walnuts from their shells. Veruca decides she wants a trained squirrel like this, and goes to grab one—the squirrels retaliate before she can, pinning her down and tapping her on the head to see whether she is a bad nut. They find that she is, and carry her over to the garbage chute as they would any bad nut. They push her parents in as well, and the Oompa-Loompas' next song is about parents who spoil their children.
Charlie and Mike Teavee are the last ones left. Wonka takes them in a special glass elevator that can move sideways as well as up and down, and they head to the Television Chocolate room, where Wonka takes giant bars of chocolate and sends them by television so that they can be taken from the television screen on the other side. Mike decides that he will be the first person ever to be sent by television, and before Wonka can stop him he flips the switch to send himself, becoming tiny on the other side. The Oompa-Loompas take Mike and his parents to the taffy puller so Mike can be stretched out to normal size, and sing a song that recommends giving your children books instead of letting them watch television.
Now Charlie is the only one left, and Wonka says that means he has won the grand prize. Wonka originally started the Golden Ticket contest so that he could find an heir, since he has no family and he is getting old. His favorite child at the end of the day would inherit the factory, and that child is Charlie. Elated, Charlie goes with Mr. Wonka and Grandpa Joe to fetch the rest of his family to live in the factory full-time and help run it until Charlie is old enough to do it himself.