He was tutored by Samuel Hoar, a prominent lawyer and politician in the state of Massachusetts. When he was 13 years old, he entered Phillips Exeter Academy in Exeter, New Hampshire. His roommate was John Adams Dix, later the United States Secretary of the Treasury, a U.S. senator, and 24th governor of New York. He entered Harvard College in 1811, where his classmates included some of the most prominent Americans of the next half-century: historian Jared Sparks; jurist Theophilus Parsons; cleric and politician John G. Palfrey; Unitarian minister Convers Francis; businessman John Amory Lowell; and historian William H. Prescott. He was a member of the Porcellian Club. While in college during the War of 1812, he witnessed the famous battle between and . He dined with "Chesapeake"s captain, James Lawrence, the night before the battle. He graduated from Harvard in 1815.