The first segment of the Main line was opened in 1864, with the construction of the line from Colombo to Ambepussa, 54 km (34 mi) to the east.
 This was the first rail line in the country.
 The first train ran on 27 December 1864.
The line was officially opened for traffic on 2 October 1865.
The main reason for building a railway system in Sri Lanka (Ceylon) was to transport tea and coffee from the hill country to Colombo.

The Main Line was extended in stages with service to Kandy beginning in 1867, to Nawalapitiya in 1874, to Nanu Oya in 1885, to Bandarawela in 1894, and to Badulla in 1924.

Till 1953, the Main line operated with steam locomotives.
 In the 1950s, service was enhanced with diesel locomotives, under the leadership of B. D. Rampala.
Various types of diesel locomotives were added to the service.

In 2011, ExpoRail and Rajadhani Express began operating a premium section on trains on the Main Line.
 These services were launched to improve rail transport's appeal to the public.
 Sri Lanka Railways also began importing new diesel-multiple units to replace the aging rolling stock previously used on the line.
 Built by China's  CSR Corporation Limited, the new S12 trainsets are designed to work on the steep gradients of the hill country.
 The commuter rail portion of the line, within the Colombo metropolitan area, is planned to be electrified, though no ground work has started.
The first segment of the Main line was opened in 1864, with the construction of the line from Colombo to Ambepussa, 54 km (34 mi) to the east.  This was the first rail line in the country.  The first train ran on 27 December 1864. The line was officially opened for traffic on 2 October 1865. The main reason for building a railway system in Sri Lanka (Ceylon) was to transport tea and coffee from the hill country to Colombo.
The Main Line was extended in stages with service to Kandy beginning in 1867, to Nawalapitiya in 1874, to Nanu Oya in 1885, to Bandarawela in 1894, and to Badulla in 1924.
Till 1953, the Main line operated with steam locomotives.  In the 1950s, service was enhanced with diesel locomotives, under the leadership of B. D. Rampala. Various types of diesel locomotives were added to the service.
In 2011, ExpoRail and Rajadhani Express began operating a premium section on trains on the Main Line.  These services were launched to improve rail transport's appeal to the public.  Sri Lanka Railways also began importing new diesel-multiple units to replace the aging rolling stock previously used on the line.  Built by China's  CSR Corporation Limited, the new S12 trainsets are designed to work on the steep gradients of the hill country.  The commuter rail portion of the line, within the Colombo metropolitan area, is planned to be electrified, though no ground work has started.
Main Line (Sri Lanka)