The Malmesbury branch was a six and a half mile long single track branch railway line in Wiltshire, England; it ran from Dauntsey railway station on the Great Western Main Line to Malmesbury. Promoted locally, it opened with considerable assistance from the Great Western Railway in 1877, and it was standard gauge. There was one intermediate station, Somerford.
In 1933 the connection to the main line network was altered to join at Little Somerford on the Badminton Line, and the original section to Dauntsey was closed.
The line closed to passengers in 1951, and completely in 1962.
When the Great Western Railway (GWR) opened its first main line from London to Bristol, the ancient Borough of Malmesbury was not on the route, and Chippenham station, ten miles away became the railhead for coach services from the town. A number of railway schemes were put forward in the 1840s, and many of them would have formed a north-south route through Malmesbury, but it was not until 1864 that a viable scheme received Parliamentary approval. This was the Wilts and Gloucestershire Railway (W&GR), which received the Royal Assent on 25 July 1864.
The W&GR was to run from Stroud via Nailsworth and Malmesbury to Christian Malford; ostensibly connecting two GWR routes. However the Midland Railway was actively promoting its line to Nailsworth, and the W&GR would give them access into GWR territory, something the GWR would wish to resist at all costs. The W&GR proposed building with mixed gauge track, to enable Midland Railway standard gauge (sometimes referred to as narrow gauge) trains as well as GWR broad gauge trains to run. If the W&GR intended to work with both companies, it seems to have alienated both of them, but unabashed, the Company cut the first sod on 1 July 1865 at Malmesbury, amid much celebration. At the half-yearly meeting of the Company in February 1866 the secretary was obliged to report that construction work had been suspended due to the "unexpected" refusal of the GWR to come to a working agreement; this was required by the authorising Act. The Board of Trade appointed an arbitrator, who ruled against the granting of running powers to the Midland.
This was a bitter blow, and the Company found itself unable to proceed. It is not clear why it could not continue as an ally of the GWR alone, but it suspended all expenditure, and attempts to revive the scheme proved futile. The Company applied for a Warrant of Abandonment and it ceased to exist on 17 March 1871; all the Parliamentary and other expenses had achieved nothing.