Tom Canty and Prince Edward are born in London on the same day. Tom, however, is unwanted, and Edward has been long awaited. While the prince lies robed in silks, Tom grows up in the filth of Offal Court. As a small child, Tom is forced by his father to beg during the day and is beaten by him at night. Gathering a ragtag court of street urchins around him, Tom often pretends that he is a prince. Father Andrew, a priest who lives in Tom’s house, teaches Tom to read.
One day, hoping to see Prince Edward of England, Tom visits the royal precincts, but when he approaches too near, he is cuffed by a guard and ordered away. Edward, who has witnessed the incident, protects Tom and takes the young beggar into the palace. There, in the privacy of Edward’s chamber, Tom confesses his longing to be a prince. When the two boys exchange garments, they discover that they are identical in appearance. Before they can switch clothes again, Edward is mistaken for the beggar boy and thrown out of the palace. He wanders helplessly in the streets, mocked by people whom he approaches with pleas that they pay homage to him as their rightful prince.
In the palace, it is thought that the prince has gone mad because he can recall none of the royal matters that he is supposed to know. King Henry VIII issues an edict that no one should discuss the royal lapse of memory, and Edward’s half-sister, Princess Elizabeth (later Queen Elizabeth I); his cousin Lady Jane Grey; and his whipping boy, Sir Humphrey Marlowe, kindly try to aid the supposed prince, who by this time is too frightened to confess that he is Tom Canty, a beggar dressed in the prince’s clothing.
While he had been ill, King Henry VIII had given the great seal of the kingdom to Prince Edward for safekeeping. Henry now demands the return of his seal, but Tom reports that he does not know where it is.
The Prince of Wales is still wandering the streets as a homeless waif when King Henry dies. Edward is found by John Canty, Tom’s father, and brought to Offal Court, but during the wild celebration of the ascension to the throne of the prince of Wales, Edward escapes from his supposed father. Again tormented by crowds who laugh at his protests that he is the king of England, Edward is rescued by Miles Hendon, a disinherited knight and the son of a baronet. Thinking Edward is mad, Miles pities the little boy and pretends to pay him the homage due to a monarch.
Miles had loved a girl named Edith, who was coveted by Miles’s brother, Hugh. Hugh had gained his father’s confidence by trickery, and Miles had been turned from home. Edward declares that Miles has suffered unjustly and promises the adventurer any boon he might ask. Recalling the story of De Courcy, who, given a similar opportunity by King John, had requested that he and all of his descendants might be permitted to wear hats in the presence of the king of England, Miles wisely asks that he be permitted to sit in Edward’s presence, for the young king has been ordering Miles about like a personal servant.
Meanwhile, having had the role of king of England thrust upon him, Tom is slowly learning to conduct himself royally. Because his attendants thought him mad, he is able to be honest about his lack of training and his failure to recall events that would have been familiar to Edward. At the same time, his gradual improvement offers hope that his derangement is only temporary.
John Canty lures Edward from Miles’s protection and takes the boy to Southwark to join a pack of thieves there. Still vainly declaring himself king, Edward again becomes the center of ridicule. One of the thieves, Hugo, undertakes to teach Edward the tricks of his trade. Making his escape, Edward wanders to a farmhouse, where a kind woman, pitying the poor, insane beggar boy who declares himself king of England, feeds him. Edward wanders on to the hut of a hermit who accepts Edward’s claim to royalty. In turn, the hermit, who indeed is mad, reveals to Edward that he is an archangel. While Edward sleeps, the hermit broods over the wrongs done him by King Henry. Believing Edward to be the king, as he has claimed, the hermit plans to murder him. He manages to tie up the boy while he sleeps. John and Hugo, following the trail of the escaped waif, rescue him and force him to rejoin the band of rogues. Again he is compelled to aid Hugo in his dishonest trade. At last, Miles finds the boy and saves him.
Miles and Edward then proceed to Hendon Hall to claim his heritage and to claim Edith for a wife. When they arrive at their destination, they find that Miles’s father is dead and that Hugh, married to Edith, is now master of Hendon Hall. Only five of the old servants are still living, and all of them, in addition to Hugh and Edith, pretend not to recognize Miles. Denounced as a pretender, Miles is sentenced to the stocks, where the abuse showered upon him by the mob so enrages Edward that he protests loudly. When the guards decide to whip the boy, Miles offers to bear the flogging instead. Grateful to his friend, Edward dubs Miles an earl, which only makes the imprisoned man sorrow for the boy’s relapse into insanity. Upon Miles’s release from the stocks, the two set out for London, where they arrive on the day before the coronation of Tom Canty as King Edward VI.
In regal splendor, enjoying the adulation of his subjects, but recognized for who he really is by his mother, Tom rides through the streets of London toward Westminster Abbey. There, just as the crown is about to be set on his head, a voice rings out demanding that the ceremony cease, and the real king, clothed in rags, steps forth. As the guards move to seize the troublemaker, Tom, recognizing Edward, orders them to halt. The Lord Protector cuts through the confusion by asking the ragged king to locate the great seal that had been lost since King Henry’s death. Edward, after an initial mistake, manages to remember where he had placed the seal before leaving Tom the day he was expelled from the palace. Tom admits that he had innocently used the seal to crack nuts.
Miles, when brought before the rightful King Edward, exercises his privilege of sitting in the king’s presence. At first, he had doubted that the waif was really the king, but when Edward orders his outraged guards to permit that disrespectful act, Miles knows that his young friend had not been insane after all. Edward confirms Miles’s title of earl and strips Hugh of his titles and land. After Hugh dies, Miles marries Edith, who had refused to acknowledge Miles’s identity because Hugh had threatened to kill Miles.
Made Edward’s royal ward, Tom has Edward’s promise that he and his family would be honored for the rest of their lives. Edward rights many of the wrongs he had encountered during his adventures. John Canty, whom he had wanted to hang, is never heard from again.