In 1878, the Foxton and Wanganui Railway was opened. The southernmost portion between Foxton and Longburn became the now-closed Foxton Branch, the section from Longburn through Palmerston North to Marton part of the North Island Main Trunk Railway, the section from Marton to Aramoho part of the Marton - New Plymouth Line, and the 5 km from Aramoho to central Wanganui, opened on 21 January 1878, became the Wanganui Branch. This line was intended to link the ports of Wanganui and Foxton with the Manawatu hinterland and form part of a trunk route from Wellington to Taranaki. However the line's terminus at Taupo Quay was roughly 6 km from Whanganui's port at Castecliff. This led to the formation of the "Wanganui Heads Railway Company" to provide a direct rail link to the port. The WHRC was floated in early 1882, and on 4 October 1882 the WHRC issued notice of its proposal to build the line under the District Railways Act of 1877. In July 1884 the WHRC called for tenders to construct the railway. The first sod was turned on 4 August 1884 at a public ceremony attended by approximately 400 people. Construction took a little over a year, and the line opened on 31 October 1885.
Operation
For over 70 years from its opening, the Castlecliff Railway was privately owned and operated. The WHRC was reorganised in April 1889 and renamed the Castlecliff Railway Company. In 1953, the Wanganui Harbour Board began pressuring the New Zealand Railways Department to acquire the line, and it did so on 1 February 1956. Since then the line has been part of New Zealand's national rail network. In about 1987 the final stretch of the Wanganui Branch alongside the Whanganui River was closed, and that branch diverted to make an end-on junction with the Castlecliff Branch. As a result, the Wanganui Branch/Castlecliff Branch junction was moved to the west, nearer Castlecliff.
Passenger services
In its early years, the line provided the primary means of transport between Wanganui and Castlecliff. Saddle tanksteam locomotives provided the motive power and passenger traffic was sufficient to justify six trains each way daily. Extra services were operated on weekends and public holidays to cater for the crowds that travelled to the beach at Castlecliff. In 1912 a tramway opened from central Wanganui to Castlecliff and entered into competition with the CRC. Previously passengers from Aramoho and other locations beyond walking distance of the CRC's Wanganui terminus had been able to purchase combined train and tram tickets for trips to Castlecliff, but now that it had its own line the tramway ceased this practice. The CRC pursued a number of measures to boost patronage, such as carrying prams and bicycles free. It also considered more drastic steps such as electrifying the line or purchasing a battery-electric railcar like the Railways Department's Edison railcar. However, competition from the tramways became too strong and passenger services were withdrawn in April 1932, the line remaining open for goods only. The only passenger services over the line since then have been excursions operated by enthusiast societies such as SteamRail Wanganui.
Freight services
The primary reason for the existence of the Castlecliff Branch was freight. It served the Port of Wanganui and numerous industrial sidings. A chemical works was established in Aramoho in 1924 and the railway was used to carry Nauruphosphate from the port. In June 1939 the Port Bowen ran aground on Castlecliff's beach and the railway was used to salvage it. A temporary line of approximately 3 km length was built from the CRC's terminus onto the beach to the vessel, which was dismantled and railed away. Steam locomotives worked freight services on the Castlecliff Branch into the 1960s, including members of the WW class. The line was dieselised in the 1960s, and in its last active years DSC classshunting locomotives worked the line. When they were removed from Wanganui, services ceased. On 5 September 2006 the operator of the New Zealand network, Toll Rail, closed the line to all traffic and a sleeper was placed across the start of the line to prohibit its use. The line was not formally closed as this required written permission from the appropriate government minister. The track remained in place and the line was mothballed following this announcement. Expressions of interest in a rail link from industrial businesses in the Castlecliff area prompted KiwiRail to investigate the possibility of reopening the line and the line was subsequently upgraded and reopened in 2010. In October 2010 it was announced the line was to reopen, as the terminus of a new inland port for Port Taranaki, serving the Open Country diary factory in Castlecliff. The line was subsequently upgraded and reopened in 2011.