The story begins with Tom Canty living with his abusive father and struggling with life as a pauper. He aspires for a better life, and he is taught to read and write by a kindly priest. Near the palace one day, he sees Prince Edward. In his excitement, he comes too close and is apprehended by the guards. Edward stops them from beating Tom and invites Tom to come with him to the palace. There they learn about each other and decide to temporarily switch places. Edward returns to Tom's home, taking with him the Great Seal of England. After being subjected to abuse from Tom's father, he leaves and meets up with a soldier named Miles Hendon, who protects him.
Meanwhile, King Henry has died, and Tom is struggling with court customs and manners. All those of the palace believe he has become ill and lost his memory. His judgements, however, are sound and fair.
For the first time in his life, Edward notices the inequality and brutality of England's judicial system, and he is shocked by the things he sees. He vows that when he is king, he will rule with mercy and fairness. He endangers himself by saying before a band of thieves that he is king and will soon right unjust laws. The thieves assume he is mad and hold a mock coronation.
Edward eventually makes it back to the palace and interrupts the coronations before Tom is crowned king. At first, shocked by the strong resemblance of the boys but confused by the ragged clothes Edward wears, they refuse to believe that he is the Prince. He produces the Great Seal of England, which he hid, and Tom and Edward switch back to their original roles. Edward is crowned king, Miles is rewarded by being given the rank of Earl, and Tom is given the privileged position of "King's Ward."