Intrigued by a magician's performance and the wonders he draws from his hat, a young boy named Mark remains behind as the theater empties. Alone, he picks up the magician's hat, which is on stage. The hat suddenly begins to grow larger. Unable to hold it any longer, Mark places it on the floor, where it grows to an enormous size. In an attempt to look inside, Mark climbs on the brim and loses his balance. He falls in and reappears in Lidsville, the Land of Living Hats. Mark is captured and imprisoned by the evil magician, Whoo Doo, who believes he is a spy for the good hats.
In his cell Mark meets Weenie, a genie who is also a prisoner and Whoo Doo's slave because he possesses her magic ring. Offering to help her escape from Whoo Doo, and promising to take her back to America with him, Mark convinces Weenie to use her power to set him free. Spotting the magic ring on the table, Mark grabs it and now, in control of Weenie, commands her to take him to safety.
Instantly they are transported to the village of good hats. Gaining the assistance of the good hats, Mark and Weenie struggle to find the secret of the way back to his world. They are opposed by Whoo Doo, who seeks to regain his prisoner, his genie, and the magic ring.