Having returned from a second European tour—which formed the basis of A Tramp Abroad (1880)—Twain read extensively about English and French history. Initially intended as a play, the book was originally set in Victorian England before Twain decided to set it further back in time. He wrote The Prince and the Pauper having already started Adventures of Huckleberry Finn.
The "whipping-boy story", originally meant as a chapter to be part of The Prince and the Pauper, was published in the Hartford Bazar Budget of July 4, 1880, before Twain deleted it from the novel at the suggestion of William Dean Howells.
Ultimately, The Prince and the Pauper was published by subscription by James R. Osgood of Boston, with illustrations by Frank Thayer Merrill and John Harley.
The book bears a dedication to Twain's daughters, Susie and Clara Clemens, and is subtitled "A Tale For Young People of All Ages".