Prince Horace can be spoiled and, craving attention from his father, he frequently misbehaves—to the point he is nicknamed "Prince Brat." Since he is a prince, no one may raise a hand against him. Therefore, his family provides him with a whipping boy, Jemmy, an orphaned boy who will be punished in the prince's stead. Though he has learned to read, write and do mathematics while living inthe castle, Jemmy is beaten several times a day and longs for the freedom he had on the streets. When the prince decides to run away on a whim he demands that Jemmy act as his servant during his journey.
While on the run, the boys are picked up by two notorious highwaymen, Hold-Your-Nose Billy and Cutwater, who hatch a scheme to ransom the prince. Jemmy talks them into believing that he is the prince, and sets into motion a plan of escape. The prince misunderstands Jemmy's intentions and betrays him. Even so, the boys escape. They come across a girl searching for her lost dancing bear and she directs them to the river where they find a kind man with a wagon full of potatoes. The boys help the man get his wagon from the mud, and in return the potato man gives the boys, the girl, and the bear a lift to the fair, but they are soon intercepted by the highwaymen. Still believing Jemmy is the prince, and believing it to be a crime worse than murder to beat the prince, they beat Horace instead.
The dancing bear scares the highwaymen away, and everyone arrives at the fair. The girl earns a few coins with her bear, the potato man boils the potatoes and sells them and the boys head down to the sewer to catch some rats. On their way, they hear some people talking about the missing prince. One woman makes a remark about how much worse things will be when the prince becomes king. The prince's feelings are hurt very deeply, but he does not show his emotions. When the boys learn that the king has posted a reward for the whipping boy, they go into the sewers where they see the highwaymen. They trick the highwaymen into the most dangerous sewer, where rats attack them, the prince decides that he wants to finally go home.
When they return to the potato man, Horace reveals himself as a prince and suggests that the potato man collect the reward for the whipping boy. When the prince explains the entire escapade to the king, Jemmy is pardoned, and the two boys live in the palace as the best of friends. The highwaymen eventually escape the sewers but make the mistake of stowing away on a convict ship heading to a prison island.