Jemmy, who once made a meager living catching rats in the sewers, is now living in the king’s castle as the whipping boy for Prince Horace, commonly known to the citizens of the kingdom as Prince Brat. Whenever the young prince misbehaves or fails his lessons, Jemmy is punished in his place, for it is illegal to spank the heir to the throne.
When the prince decides to run away, he demands that Jemmy accompany him, so the two boys with nothing in common run away together. Once in the woods, Jemmy and Prince Brat are captured by two scoundrels, Hold-Your-Nose Billy and Cutwater. The scoundrels plot to use Jemmy, whom they assume is royalty because he can write, as a hostage to obtain ransom money and jewels from the king.
When the two boys finally escape from the scoundrels’ hut (after Prince Brat has double-crossed Jemmy), they find themselves lost in the forest. With the help of Captain Nips, seller of hot potatoes, and Petunia, the dancing bear, the boys finally escape from danger and find their way back to the city.
Back in the city, Prince Brat begins to appreciate Jemmy’s abilities, courage, and friendship, and when the two eventually return to the castle, the prince has resolved to be a true friend to Jemmy and quit his spoiled, selfish ways.