structural:reformatting, quality:correction, stylistic:tone, linguistic:paraphrasing
Early life and education

Melville was born in New York City, on August 1, 1819, the third of eight children to Allan Melvill (1782–1832) and Maria (Gansevoort) Melvill (1791–1872), who were of Scottish and Dutch descent. His seven siblings, who played important roles in his career and emotional life, were Gansevoort (1815–1846), Helen Maria (1817–1888), Augusta (1821–1876), Allan (1823–1872), Catherine (1825–1905), Frances Priscilla (1827–1885), and Thomas (1830–1884), who eventually became a governor of Sailors' Snug Harbor. Part of a well-established and colorful Boston family, Allan Melvill spent considerable time away from New York City, travelling regularly to Europe as a commission merchant and an importer of French dry goods.

Both of Melville's grandfathers played significant roles in the American Revolutionary War, and Melville later expressed satisfaction in his "double revolutionary descent". Major Thomas Melvill (1751–1832) participated in the Boston Tea Party, and Melville's maternal grandfather, General Peter Gansevoort (1749–1812), commanded the defense of Fort Stanwix in New York in 1777.

At the turn of the 19th century, Major Melvill did not send his son Allan (Herman's father) to college, but instead sent him to France, where he spent two years in Paris and learned to speak French fluently. In 1814, Allan, who subscribed to his father's Unitarianism, married Maria Gansevoort, who was committed to her family's more strict and biblically oriented Dutch Reformed version of the Calvinist creed. The Gansevoorts' severe Protestantism ensured that Maria was well versed in the Bible, in English as well as in Dutch, the language that the Gansevoorts spoke at home.

On August 19, almost three weeks after his birth, Melville was baptized at home by a minister of the South Reformed Dutch Church. During the 1820s, Melville lived a privileged and opulent life in a household supported by three or more servants at a time. Every four years, the family moved to more spacious and elegant quarters, finally settling on Broadway in 1828. Allan Melvill lived beyond his means, on large sums that he borrowed from his father and from his wife's widowed mother. Although his wife's opinion of his financial conduct is unknown, biographer Hershel Parker says that Maria "thought her mother's money was infinite and that she was entitled to much of her portion" while her children were young. How well the parents managed to hide the truth from their children is "impossible to know", according to biographer Andrew Delbanco.

In 1830, the Gansevoorts ended their financial support of the Melvilles, at which point Allan's lack of financial responsibility had left him in debt to both the Melvill and Gansevoort families for a sum exceeding $20,000 (equivalent to $572,000 in 2023). But Melville biographer Newton Arvin writes that the relative happiness and comfort of Melville's early childhood depended less on Allan's wealth or on his profligate spending, as on the "exceptionally tender and affectionate spirit in all the family relationships, especially in the immediate circle". Arvin describes Allan as "a man of real sensibility and a particularly warm and loving father," while Maria was "warmly maternal, simple, robust, and affectionately devoted to her husband and her brood".

Melville's education began when he was six. In 1824, the Melvills moved to a newly built house at 33 Bleecker Street in Manhattan. In 1825, Herman and his brother Gansevoort enrolled in New York Male High School. In 1826, the year that Herman contracted scarlet fever, Allan Melvill described him as "very backwards in speech & somewhat slow in comprehension" at first, but his development increased its pace and Allan was surprised "that Herman proved the best Speaker in the introductory Department". In 1829, both Gansevoort and Herman transferred to Columbia Grammar and Preparatory School, and Herman enrolled in the English Department on September 28. "Herman I think is making more progress than formerly," Allan wrote in May 1830 to Major Melvill, "and without being a bright Scholar, he maintains a respectable standing, and would proceed further, if he could only be induced to study more—being a most amiable and innocent child, I cannot find it in my heart to coerce him".

Emotionally unstable and behind on paying the rent for the house on Broadway, Herman's father tried to recover by moving his family to Albany, New York, in 1830 and going into the fur business. Herman attended The Albany Academy from October 1830 to October 1831, where he took the standard preparatory course, including reading and spelling, penmanship, arithmetic, English grammar, geography, natural history, universal, Greek, Roman, and English history, classical biography, and Jewish antiquities. In early August 1831, Herman marched in the Albany city government procession of the year's "finest scholars" and was presented with a copy of The London Carcanet, a collection of poems and prose, inscribed to him as "first best in ciphering books". As Melville scholar Merton Sealts observed,

The ubiquitous classical references in Melville's published writings suggest that his study of ancient history, biography, and literature during his school days left a lasting impression on both his thought and his art, as did his almost encyclopedic knowledge of both the Old and the New Testaments.

In October 1831, Melville left the Academy. While the precise reason is not known definitively, Parker speculates it was for financial reasons, since "even the tiny tuition fee seemed too much to pay".

In December 1831, Allan Melvill returned from New York City by steamboat, but he had to travel the last 70 miles in an open carriage for two days and two nights in subfreezing temperatures. In early January, he began to show "signs of delirium", and he grew worse until his wife felt that his suffering deprived him of his intellect. On January 28, 1832, he died, two months prior to reaching his 50th birthday. Since Herman was no longer attending school, he likely witnessed his father's medical and mental deterioration. Twenty years later, Melville described a similar death in Pierre.