Jemmy is a young boy serving as Whipping Boy to a particularly spiteful and badly behaved Prince whom everyone refers to as Prince Brat. He is with the prince the majority of the time, even learning how to read and write by paying attention to the lessons that the prince never attends to. When the prince decides to run away he demands that Jemmy accompanies him and will not be talked out of the plan. Although Jemmy initially want nothing to do with the scheme, he begins to formulate a plan of his own and realizes that this might be his opportunity to run away himself. As he is readying himself to make a break for it and begin life as a rat catcher the two boys are apprehended by a cutthroat who want to rob them.
Jemmy's heart sinks when Prince Brat backchats the highwaymen and tells them that he is the Prince, demanding that they now and show respect for their heir to the throne. Aseptically at first the men believe his claims when they realize what a beautiful and expensive saddle they have on their horse, so they take the boys back to their camp as hostages for whom they will demand a ransom. They want the Prince to write the ransom note but when they discover he cannot write, but that Jemmy can, they start to wonder if the boys have switched identities to confuse them. Jemmy goes along with this supposition, realizing it might be the best way of getting the Prince back to the palace. As he is writing the note, Jemmy pretends to be offended that they have not demanded much in exchange for his safe return and encourages them to ask for a wagon load of gold. Jemmy also scares them into sending the prince, whom they believe to be the whopping boy, to deliver the note to the King. As the plan seems to be working, Prince Brat sabotages it by refusing to go back to the castle. Jemmy then suggests they send his horse back to the castle with the message.
Jemmy devises an escape plan and the two boys make a run for it. They run as far as the wood where they hide in the hollow of a dead tree as a black bear appears and starts to move towards the highwaymen. As they run, Jemmy climbs back out of the tree but is disappointed that he has not manages to lose the prince yet. Jemmy dismisses himself from the prince's service and turns to leave, frustrated to realize that the prince is still following him. As they bicker they hear a female voice in the woods, realizing that she is looking for the bear they encountered earlier. They ask her how to get to the river but have to hide as they reach it as they spot the king's soldiers out searching for the wayward heir.
When the soldiers have passed by they come out from their hiding place and assist a coachman whose wheels are stuck in the mud. Jemmy requests a ride to the fair and the driver, who turns out to be the hot potato man going to the fair. Initially Jemmy takes the ride on his own but when he sees how lonesome and pathetic the prince looks behind him he has a change of heart and asks the hot potato man to stop and pick him up.
As their bad luck would have it the coach is held up by the same two highwayman they had just escaped from. The men start to whip the prince, believing him to be the whipping boy. Betsy, the young lady with the performing bear, sees them and calls out to them to stop, and when they refuse, she sets Petunia the bear after them. The boys travel to the fair with Betsy and enjoy hot potatoes and freshly-drawn milk. As they are beginning to enjoy themselves at the fair they see Cuttwater and Hold-Your-Nose Billy coming towards them so Jemmy leads the prince down into the sewers to hide. The ruffians follow them but are sent off in the wrong direction by a rat catcher they encounter. The men do not fall for this ploy and catch up with the boys again. Jemmy leads them into the tunnels where the biggest rats are and the men get bitten which enables the boys to escape back put into the sunshine.
Jemmy learns that there is a price on his head and is saddened when Prince Brat orders Betsy and Captaon Nips to take them back to the castle and turn Jemmy in. They don't want to but obey because they are obliged to. At the castle Jemmy waits whilst Betsy and the captain are given the reward that was offered for the prince's return. The King then tells Jemmy that Prince Brat credits him with his safe return; from now on he is under the pronce's protection and will not be whipped anymore. The boys are now fast friends and the prince has definitely caught his father's attention.
As for the highwaymen, they were last seen stowing away on a ship bound for a convict island.