William Halloway and James Nightshade are thirteen year old boys living in Green Town, Illinois. They will turn fourteen within a week. A lightning-rod salesman comes into town and warns the boys that a storm is coming. He gives Jim a lightning rod to put up on his roof. The boys visit Charles Halloway, Will's father, at the library and take out some books. Charles Halloway feels old, although he is only fifty-four, and he is tormented by an urge to be young and run like the boys. Both Charles Halloway and the boys learn about the carnival that is to start the next day. Will's father sees a sign in a store window that advertises Cooger & Dark's Pandemonium Shadow Show, and Jim and Will find a similar handbill in the street. The boys are excited that a carnival has come so late in the year. Charles Halloway has a bad feeling about the carnival, and Will senses his father's fear. Jim fears nothing and wants only more adventure. The boys run out to watch the carnival arrive at three in the morning, and they run home after watching the tents get set up. Mr. Halloway is concerned because the carnival has arrived at a time when men are closest to death, locked in the depths of despair.

The boys go the next day to explore the carnival and they help their seventh grade teacher, Miss Foley, who panics inside the Mirror Maze. Later in the day Jim goes into the maze and Will has to pull him out. Jim insists on coming back that night, and Will agrees, but then they bump into the lightning-rod salesman's bag and they realize that they must stay to learn what has happened to the man. Finally, after searching all of the rides, they go up to a carousel that is supposedly broken. A huge man grabs Will and Jim and tells them that the merry-go-round is broken. Another man tells him to put them down, introduces himself as Mr. Dark and tells them the other man's name is Mr. Cooger. Mr. Dark is the Illustrated Man, covered in tattoos, and he pays attention only to Jim, who is enthralled by what he sees. Mr. Dark tells them to come back the next day and the boys run off but then hide and wait. What they see is unbelievable. Mr. Cooger rides backwards on the carousel (while the music plays backwards), and when he steps off of it his is twelve years old.

They follow Mr. Cooger to Miss Foley's house, where he pretends to be her nephew who got lost earlier at the carnival. Jim tries to meet up with Mr. Cooger because he wants to ride the carousel, but Will stops him and he takes off toward the carnival. When Will reaches the carnival Mr. Cooger is on the carousel, growing older, and Jim is about to join him. Will knocks the switch on the carousel and it flies out of control, spinning rapidly forward. Mr. Cooger ages over a hundred years before the carousel stops, and Jim and Will take off. They return with the police, but Mr. Cooger is nowhere to be found. Inside the tents he is set up as a new act, Mr. Electrico, a man they run electricity through. Mr. Dark tells the boys to come back to the carnival the next day. Will tries to keep his father out of the situation, promising him that he will tell all soon. The night the Dust Witch comes in her balloon to find Jim and Will, but Will outsmarts her and destroys her balloon.

The next day the boys see a young girl crying and realize after talking to her that it is Miss Foley. They go to her house but when they come back their path is blocked by a parade. The carnival is out searching the streets for them. They hide and the little girl is gone. Will's father sees them hiding in an iron grille in the sidewalk and the boys convince him to keep quiet because the Illustrated Man comes to talk to him. Will's father pretends not to know the two boys whose faces are tattooed on the man's hand, and then when the Witch comes and begins to sense the boys' presence he blows cigar smoke at her, choking her and forcing her to leave. Mr. Dark asks Charles Halloway for his name, and Will's father tells him where he works and who he is. Later that night Will and Jim meet Mr. Halloway at the library, where he has done research and found out some things about the carnival. He tells them that their best weapon is love, but they are not sure how to fight. Then Mr. Dark shows up and the boys hide. He finds them and then crushes Charles Halloway's hand when the man tries to fight him. The Dust Witch casts spells on the boys to make them easy to handle and goes to stop Mr. Halloway's heart. Just before he dies, Charles Halloway looks at the Witch and begins to laugh hysterically, and his laughter wounds her deeply and drives her away. He goes to the carnival to get the boys.

At the carnival Charles Halloway outsmarts Mr. Dark, finds his son, kills the Witch, and destroys the Mirror Maze in a matter of minutes, all through the use of laughter and happiness. Then he and Will search for Jim. Mr. Cooger turns to dust and blows away before he can be saved at the carousel, and Jim moves towards the merry-go-round. Jim starts to ride and Will tries to stop him. They both end up going for a ride before Will jumps off and rips Jim away from the machine. Jim falls into a stupor, close to death. A child comes begging them to help him, but Mr. Halloway recognizes the boy as Mr. Dark. He holds the boy tight and kills him with affection, because Mr. Dark cannot survive in such close contact with someone good. The carnival falls apart as Will tries to revive Jim. They save Jim by singing and dancing and laughing, for their happiness brings him back to life from the edge of death.