The Capital Subdivision is a railroad line owned and operated by CSX Transportation in the U.S. state of Maryland and the District of Columbia. The line runs from near Baltimore, Maryland southwest to Washington, D.C. along the former Baltimore and Ohio Rail Road (B&O) Washington Branch. The subdivision's Alexandria Extension provides a connection to Virginia and points south.
The northeast end of the line is at Halethorpe, Maryland, just north of the historic Thomas Viaduct, where it meets the Baltimore Terminal Subdivision and the Old Main Line Subdivision. Its southwest end is at the yard north of Union Station, at a junction with the Metropolitan Subdivision and Amtrak's Northeast Corridor.
Between Elkridge and Laurel, the Capital Subdivision's rail alignment forms the border between Howard and Anne Arundel counties, having been built before Howard County was created from western Anne Arundel County in 1844.
The Alexandria Extension runs south 7.2 miles (11.6 km) from a junction at Hyattsville, Maryland to the Anacostia Railroad Bridge and the RF&P Subdivision in Southeast D.C. This busy route is used by freight trains to Virginia. It runs past Benning Yard and interchanges with the Landover Subdivision.
In 1831 the Maryland General Assembly authorized the B&O to build a branch from their main line within 8 miles (13 km) of Baltimore, to Washington. As this line would take much business from the parallel turnpikes, especially the Washington and Baltimore Turnpike, the charter specifically allowed those companies to subscribe to the stock of the railroad. Construction began in July 1833, and the line opened on August 25, 1835, splitting from the B&O main line at Relay, roughly 7 miles (11 km) from Baltimore.:157
Notable structural features on the original line include the Thomas Viaduct, the first multi-span masonry railroad bridge in the United States, and the largest bridge in the country when it was completed in 1835; and the earliest example of an iron truss bridge designed by Wendel Bollman and installed at Savage.:361 
The first B&O passenger station (1835-1851) was located west of the Capitol, at 2nd Street and Pennsylvania Avenue NW. In 1851 the New Jersey Avenue Station was built at a point slightly north of the Capitol, on New Jersey Avenue NW, in the area now called Union Station Plaza. Trains reached that location via the current location of West Virginia Avenue, street-running trackage on I Street NE and Delaware Avenue, and private right-of-way just south of the current location of Louisiana Avenue. When the Washington Terminal Company opened the new Union Station in 1907, that alignment was changed to the current routing, partially using the former location of Delaware Avenue.
The Alexandria Extension, originally called the Alexandria Branch, was built in 1874 and ran 12.5 miles (20.1 km) to Shepherds Landing along the eastern shore of the Potomac River, to provide a connection to Virginia. The B&O had lost access to the Long Bridge across the river in 1870 due to political maneuvering by the Baltimore and Potomac Railroad (B&P)(controlled by the Pennsylvania Railroad (PRR)). In order to efficiently route its trains to points south of Washington, the B&O set up a car float operation at Shepherds Landing, which carried freight cars across the river to Alexandria, Virginia. The ferry operation was discontinued in 1906 when the B&O obtained trackage rights from PRR. The B&O built a connecting track from the Alexandria Extension to the B&P's Anacostia Railroad Bridge, which provided access to PRR tracks in southwest D.C. (now called the CSX RF&P Subdivision) and the Long Bridge.
During World War II, the B&O re-activated the Shepherds Landing crossing at the request of the U.S. Army. The Army had requested an additional Potomac River crossing for troop movements to supplement those on the Long Bridge, and the Corps of Engineers built a temporary bridge across the river in 1942. Both B&O and PRR trains traveled over the 3,360 foot (1,020 m) bridge. Train operations on the bridge ceased in 1945 at the end of the war, and the bridge was demolished in 1947.
For many years the junction at Hyattsville, called Alexandria Junction, was controlled by JD Tower. B&O built its first interlocking tower building at the site in 1894, and rebuilt the tower in 1912 and again in 1917. CSX closed this tower in 1992, and demolished it in 1994 after a fire.
The original track from the junction at Anacostia Bridge to Shepherds Landing became known as the Shepherd Branch. This spur served several industries, including Bolling Air Force Base and the Blue Plains Advanced Wastewater Treatment Plant. (Shown as "Shepherd Industrial Track" on the diagram.) The Blue Plains plant was the only customer on the branch when rail service ended in 2001.
The Chesapeake and Ohio Railway acquired control of the B&O in 1962, and the B&O and C&O both became a subsidiaries of the Chessie System in 1973. In 1980 the Chessie System merged with the Seaboard System to form CSX Corporation. In 1987 the CSX Corporation merged the B&O into the C&O, then, later that same year, merged the C&O into CSX Transportation (CSXT), which now owns the line.