Hartranft raised a three-year regiment, the 51st Pennsylvania Infantry, and became its colonel. They first served on the North Carolina coast in the Burnside Expedition. Hartranft led them in battle at Roanoke Island and New Bern. In July 1862, Hartranft's men proceeded to Newport News, Virginia, to become part of Burnside's IX Corps, with whom they fought in the Second Battle of Bull Run and at South Mountain. They also fought at the Battle of Antietam, where Hartranft led the famous charge across Burnside's Bridge, suffering 120 casualties. They also participated in the Battle of Fredericksburg. The 51st Pennsylvania was transferred to the Western Theater, where Hartranft saw action at the battles of Vicksburg, Campbell's Station, and Knoxville; in the latter two actions, he served as commander of the 2nd Division of the IX Corps while still a colonel.