The Mansfield and Framingham Railroad was a railroad in Massachusetts. It was incorporated in 1862 as the Foxborough Branch Railroad to provide a rail connection from Mansfield through Foxborough to Walpole. However, the name of the company was changed in 1867 to Mansfield and Framingham Railroad with a new charter allowing it to connect to the Boston, Clinton and Fitchburg Railroad line at Framingham.
The 22.1 mile line was completed on May 1, 1870. On January 1, 1873 it was leased to the Boston, Clinton and Fitchburg Railroad for fifty years, before merging with that railroad on June 1, 1875.
On June 1, 1876, the line became part of the Boston, Clinton, Fitchburg and New Bedford Railroad with the merger of the Boston, Clinton and Fitchburg Railroad with the New Bedford Railroad, forming an overall network of 126.2 miles of track.
In 1879, the Boston, Clinton, Fitchburg and New Bedford Railroad was leased to the Old Colony Railroad for 999 years, before being consolidated with the Old Colony in 1883.
In 1893, it became part of the New York, New Haven and Hartford Railroad as part of the lease of the entire Old Colony Railroad network.
Passenger service ceased in 1933. However, the line has remained an important freight route. In New Haven Railroad days and beyond, the line allowed eastbound freight to reach the Boston & Albany mainline at Framingham, bypassing Boston. All freight traffic that terminates in Southeastern Massachusetts and Cape Cod traverses the former Mansfield & Framingham, now CSX's Framingham Secondary (subdivision). It remains very popular with local railfans.