Twain initially conceived of the work as a sequel to The Adventures of Tom Sawyer that would follow Huckleberry Finn through adulthood. Beginning with a few pages he had removed from the earlier novel, Twain began work on a manuscript he originally titled Huckleberry Finn's Autobiography. Twain worked on the manuscript off and on for the next several years, ultimately abandoning his original plan of following Huck's development into adulthood. He appeared to have lost interest in the manuscript while it was in progress, and set it aside for several years. After making a trip down the Hudson River, Twain returned to his work on the novel. Upon completion, the novel's title closely paralleled its predecessor's: Adventures of Huckleberry Finn (Tom Sawyer's Comrade).
Mark Twain composed the story in pen on notepaper between 1876 and 1883. Paul Needham, who supervised the authentication of the manuscript for Sotheby's books and manuscripts department in New York in 1991, stated, "What you see is [Clemens'] attempt to move away from pure literary writing to dialect writing". For example, Twain revised the opening line of Huck Finn three times. He initially wrote, "You will not know about me", which he changed to, "You do not know about me", before settling on the final version, "You don't know about me, without you have read a book by the name of 'The Adventures of Tom Sawyer'; but that ain't no matter." The revisions also show how Twain reworked his material to strengthen the characters of Huck and Jim, as well as his sensitivity to the then-current debate over literacy and voting.
A later version was the first typewritten manuscript delivered to a printer.
Demand for the book spread outside of the United States. Adventures of Huckleberry Finn was eventually published on December 10, 1884, in Canada and the United Kingdom, and on February 18, 1885, in the United States. The illustration on page 283 became a point of issue after an engraver, whose identity was never discovered, made a last-minute addition to the printing plate of Kemble's picture of old Silas Phelps, which drew attention to Phelps' groin. Thirty thousand copies of the book had been printed before the obscenity was discovered. A new plate was made to correct the illustration and repair the existing copies.
In 1885, the Buffalo Public Library's curator, James Fraser Gluck, approached Twain to donate the manuscript to the library. Twain did so. Later it was believed that half of the pages had been misplaced by the printer. In 1991, the missing first half turned up in a steamer trunk owned by descendants of Gluck's. The library successfully claimed possession and, in 1994, opened the Mark Twain Room to showcase the treasure.
In relation to the literary climate at the time of the book's publication in 1885, Henry Nash Smith describes the importance of Mark Twain's already established reputation as a "professional humorist", having already published over a dozen other works. Smith suggests that while the "dismantling of the decadent Romanticism of the later nineteenth century was a necessary operation," Adventures of Huckleberry Finn illustrated "previously inaccessible resources of imaginative power, but also made vernacular language, with its new sources of pleasure and new energy, available for American prose and poetry in the twentieth century."