11-year-old Charlie Bucket lives in poverty in a small house with his parents and four grandparents. His grandparents share the only bed in the house, located in the only bedroom. Charlie and his parents sleep on mattresses on the floor. One day, Grandpa Joe tells him about the legendary and eccentric chocolatier Willy Wonka and all the wonderful candies he made until the other candymakers sent in spies to steal his secret recipes, which led him to close the factory to outsiders. The next day, the newspaper announces that Wonka is reopening the factory and has invited five children to come on a tour, after they find a Golden Ticket in a Wonka Bar. Each ticket find is a media sensation and each finder becomes a celebrity. The first four golden tickets are found by the gluttonous Augustus Gloop, the spoiled and petulant Veruca Salt, the chewing gum-addicted Violet Beauregarde, and the television-obsessed Mike Teavee.
One day, Charlie sees a ten-shilling note (dollar bill in the US version) buried in the snow. He buys a Wonka Bar and finds the fifth and final golden ticket. The ticket says he can bring one or two family members with him and Charlie's parents decide to allow Grandpa Joe to go with him.
Wonka takes the kids and their parents go inside where they meet the Oompa-Loompas, a race of small people who help him operate the factory since he rescued them from poverty and fear in their home country of Loompaland. The other kids are ejected from the tour in comical, mysterious and painful ways, befitting their various greedy characters and personalities. Augustus gets sucked up a pipe after falling into the Chocolate River in the Chocolate Room, Violet inflates into a giant blueberry after sampling an experimental three-course chewing gum meal of tomato soup, roast beef and blueberry pie in the Inventing Room, Veruca is thrown down the garbage chute in the Nut Room after she tries stealing a nut-testing squirrel and the other squirrels consider her a "bad nut", and Mike gets shrunk after he tries to be the first person to be sent by television in the Television Room's Television Chocolate technology. During each elimination, the Oompa-Loompas sing a morality song about them. With only Charlie remaining in the end, Wonka congratulates him for "winning" the factory and, after explaining his true age and the reason behind his Golden Tickets, names Charlie as his successor. They ride the Great Glass Elevator to Charlie's house while the other four children go home (Augustus squeezed thin, Violet all purple in the face, Veruca covered in garbage, and Mike stretched out to ten feet tall). Afterwards, Wonka invites Charlie's family to come live with him in the factory.