The Baltimore and Harrisburg Railway was a railroad that operated in Maryland and Pennsylvania in the 19th and early 20th centuries. The 59 miles (95 km) main line ran from Emory Grove, Maryland to Orrtanna, Pennsylvania, with a 6 miles (9.7 km) branch from Valley Junction, Pennsylvania (east of Hanover) to Hanover Junction, Pennsylvania; and later extensions to Highfield, Maryland and York, Pennsylvania.
The railroad was formed from a merger of the Hanover Junction, Hanover and Gettysburg Railroad, the Bachman Valley Railroad and the Baltimore and Hanover Railroad in 1886. It was acquired by the Western Maryland Railway in 1917.
The railroad was chartered by the states of Maryland and Pennsylvania in 1886. In 1889 the railroad constructed a 15-mile (24 km) western extension from Orrtanna to Highfield, Maryland, where it connected with the Western Maryland Railway. In 1893 it completed a 17-mile (27 km) eastern extension from Porters Sideling, Pennsylvania (east of Hanover) to York.
At its formation, the company was controlled by the Western Maryland Railway by means of a 99-year lease, and the Western Maryland bought the company in 1917. The original Hanover Branch Railroad portion of track between Hanover Junction and Valley Junction was abandoned and removed circa 1930.