A railway roundhouse is a building with a circular or semicircular shape used by railways for servicing and storing locomotives. Traditionally, though not always the case today, these buildings surrounded or were adjacent to a turntable.
Early steam locomotives normally traveled forwards only. Although reverse operations capabilities were soon built into locomotive mechanisms, the controls were normally optimized for forward travel, and the locomotives often could not operate as well in reverse. Some passenger cars, such as observation cars, were also designed as late as the 1960s for operations in a particular direction. Turntables allowed locomotives or other rolling stock to be turned around for the return journey, and roundhouses, designed to radiate around the turntables, were built to service and store these locomotives.
Most modern diesel and electric locomotives can run equally well in either direction, and many are push-pull trains with control cabs at each end. In addition, railroads often use multiple locomotives to pull trains, and even with locomotives that have distinct front and rear ends, the engines at opposing ends of a locomotive "consist" (a group of locomotives coupled together and controlled as a single unit) can be aligned so they face opposite directions. With such a setup, trains needing to reverse direction can use a technique known as a "run around," in which the engines are uncoupled from the train, pull around it on an adjacent track or siding, and reattach at the other end. The engineer changes operating ends from the original locomotive to the one on the opposite end of the locomotive consist.
Railroad terminals also use features such as balloon loops and wyes (Commonwealth: triangle) to reverse the orientation of railroad equipment. Because of the advent of these practices, modern roundhouses are frequently not round and are simply large buildings used for servicing locomotives. Like much other railroad terminology, however, the structure has retained its traditional name. The alternative term engine-house encompasses both semi-circular and rectangular structures and broadly describes all buildings intended for storage and servicing of locomotives. Shops or workshops are buildings containing hoists and heavy machinery capable of major repairs beyond routine servicing. Some roundhouses include shop facilities internally or in adjoining buildings.
Since the great dieselisation era of the 1940s and 1950s, many roundhouses have been demolished or put to other uses, but a few still stand and remain in use on the railroads. Early roundhouses were too small for later locomotives. The unusual shape of the buildings can make them difficult to adapt to new uses, but can also be aesthetically appealing.
Roundhouses were originally constructed to service steam locomotives. In North America, regular daily serving began with a hostler moving an engine to an ash pit to remove the detritus of burned wood or coal. The locomotive's tender would be refilled with fuel, water, and sand, and the engine would be placed above an inspection pit so that workers could inspect it for any maintenance needs, like wear on its brake shoes and wheels. The engine's many moving parts would also be thoroughly lubricated, although this meant that engines typically required frequent cleanings to remove old lubricating fluid along with dirt and anything else that stuck.
At larger 24-hour North American roundhouses, steam locomotives would often be turned around and made ready for service within a few hours of arrival. However, locomotives with major issues or in need of semi-regular maintenance required additional time. Larger roundhouses were adequately staffed with boilermakers, blacksmiths, and pipefitters so that this work could be accomplished on-site; only the most extensive work, such as major unexpected repairs or scheduled major maintenance, required the transport of locomotives to specialized backshops.
The location of the first-ever roundhouse is thought to be Birmingham. England, built in 1837.
Valley Heights roundhouse, 75 kilometres (47 mi) west of Sydney, New South Wales, is the oldest surviving roundhouse in Australia, and has been preserved as a railway museum.
The London Roundhouse Project London, Ontario, Canada, is an extensive renovation of the Michigan Central Railroad steam locomotive repair shop which was built in 1887. It is to become the new home of Ellipsis Digital and Engine SevenFour, a pair of emerging technology companies.
The Canadian National Railways roundhouse at the Turcot Yard in Montreal, built in 1906, was the largest ever built in Canada. Its demolition in 1962 to make way for the Turcot Interchange illustrated a profound change in transportation habits across North America.
The Steam Whistle Brewing brewery in Toronto, Ontario is located in the building known as the John Street Roundhouse, a former Canadian Pacific Railway steam locomotive repair facility.
The Canadian Pacific 374 steam engine is on display at the former CPR Drake Street Roundhouse in Vancouver, now the Roundhouse Community Centre. VIA Architecture was the architecture firm responsible for designing the station.
The Esquimalt and Nanaimo Railway Roundhouse in Victoria, British Columbia
Roundhouses were a significant feature of Japanese railways. Many smaller roundhouses are still in use today as fully operational buildings on a few private and third-sector railways.
One Japanese roundhouse that remains intact is at the Kyoto Railway Museum. The museum comprises a number of structures classified by the Japanese Government as 'Important Cultural Properties'. One of these structures is the museum roundhouse, as it is the oldest reinforced-concrete car shed extant in Japan.
The museum roundhouse in Wolsztyn, in western Poland, continues to supply steam locomotives for regular national rail services (as of 2011).
Probably the first railway roundhouse, designed by Robert Stephenson, was built in 1837 in Birmingham, at Curzon Street station. Its central turntable, inspection pits, and an exterior wall were uncovered in March 2020 during work to build HS2.
Another was built in 1839 at Derby, England by the North Midland Railway. A guidebook of the time says:
The engine-house is a polygon of sixteen sides, and 190 feet (58 m) in diameter, lighted from a dome-shaped roof, of the height of 50 feet (15.2 m). It contains 16 lines of rails, radiating from a single turn-table in the centre: the engines, on their arrival, are taken in there, placed upon the turn-table, and wheeled into any stall that may be vacant. Each of the 16 stalls will hold two, or perhaps more, engines. 
This roundhouse narrowly escaped demolition when the works closed down, and was classified as a listed building. It was restored in 2010, being converted into a brand new site for Derby College, with a new addition called the 'Stephenson Building' including the other survival of demolition - the original Midland Counties Railway workshop. The new site was opened in September 2009. Tours can be arranged through Derby Tourist Information Centre.
In Leeds, Thomas Grainger designed the roundhouse near Armley Gyratory that was opened in 1847, with accommodation for 20 trains from the Leeds & Thirsk Railway. It was operational until 1904.
The Fenton, Murray and Jackson building in Leeds (1831–1843), a private workshop, may previously have been laid out in a radial pattern like a roundhouse.
The Roundhouse, Chalk Farm, London was built in 1847, but was too small for its function within 20 years (it is now an arts centre and concert venue).
Barrow Hill Engine Shed, which is home to a number of preserved locomotives is still in use.
It is estimated that there were about 3,000 roundhouse sites in the United States, although at least three times that number were built between 1840 and 1950, since many were torn down and rebuilt as locomotives became increasingly larger.  Although the United Kingdom was home to the earliest roundhouse (1837), the US was not far behind, with several being built around 1840 for the earliest railroads. It is likely that the first in the US was built by the Baltimore and Ohio at Mt. Clare (Baltimore), although this cannot be confirmed because early records have been lost. Early roundhouses, especially those built in cold climates, were fully enclosed with the turntable under cover as well as the stalls. Once locomotives became too large to fit in these structures, they were torn down and replaced with "donut" shaped structures that surrounded an open turntable. Although some roundhouses used by Class 1 railroads were built as a full-circle with as many as 52 stalls, the vast majority were only part of a circle with 12 or fewer stalls.
Nearly every locomotive terminal in the country was anchored by a roundhouse, especially if a railroad owned more than a few locomotives. The largest concentration of roundhouses was in Chicago, with over 75 in and around the metropolitan region during the early 1900s.  Other cities where multiple railroads terminated or were major division points also had over 20 roundhouses, such as Boston, Cleveland, St. Louis, Sioux City, Indianapolis, and Cincinnati.
The largest "as-built" roundhouse ever constructed is believed to have been the Boston and Maine's East Sommerville roundhouse outside of Boston (today the site of the Boston Engine Terminal). It was built with stalls 112 feet (34.1 m) long, 90 of open space between the roundhouse and the turntable, and a 110-foot (33.5 m) turntable, giving it a diameter of 525 feet (160 m). However, several roundhouses were enlarged over time that eventually became larger than the one in Boston. For example, the Union Pacific roundhouse in Cheyenne, Wyoming was lengthened in 1930 to accommodate the new 4-8-8-4 "Big Boy" articulated locomotives being delivered. After the expansion it was 560 feet (170 m) in diameter and constituted a near full-circle.  A portion of this roundhouse still stands and is used by Union Pacific to store heritage rolling stock.
The vast majority of roundhouses were torn down beginning in the 1950s as railroads converted motive power from steam to electric-diesel, which needed far less maintenance. Some were converted to service diesel engines, while others were used as storage or sold to other parties. Several dozen roundhouses stand today in active use by modern railroads and museums, although the majority of those still standing have been abandoned. An average of two per year are demolished or otherwise destroyed. 
The only roundhouse still in use as a locomotive servicing facility by the same railroad that constructed it is the Long Island engine house in Queens, New York. The largest surviving roundhouse by interior square footage is owned and operated by the North Carolina Transportation Museum in Spencer, North Carolina. It was built by the Southern Railway in 1924 and contains 37 stalls.
The B&O Railroad Museum complex in Baltimore, Maryland contains the restored railcar maintenance roundhouse of the Baltimore and Ohio Railroad. Built in 1884, it is said to be the world's largest 22-sided building.
The roundhouse in Aurora, Illinois, constructed in 1856, was purchased and restored by NFL football player Walter Payton. After Payton's death, the roundhouse was occupied by a micro-brewery and renamed Two Brothers Roundhouse, with a plaque mounted in Payton's honor. It is believed that this roundhouse is the oldest of its kind still standing in the United States. 
The vast majority of roundhouses built in the US and Canada no longer exist, lie in ruins, or have been repurposed; however, a small number of them still exist and continue to operate in their intended capacity as locomotive storing and servicing facilities. Of the roughly 3,000 roundhouses that once existed in North America, fewer than 200 roundhouses are extant in the US as of 2010[update]; in Canada, none exist east of Montreal. Below is a list of locations with operational roundhouses that are also open to the public.
|Location||Address||Track gauge||Number of intact stalls in use||Year built||Notes|
|Age of Steam Roundhouse Museum||Sugarcreek, Ohio, US||4 ft 8+1⁄2 in (1,435 mm)||18||2011||Open May–October on Thursdays, Fridays, and Saturdays for guided tours only.|
|Colorado Railroad Museum||Golden, Colorado, US||3 ft (914 mm)||5||2000|
|Como Roundhouse, Railroad Depot and Hotel Complex||Como, Colorado, US||3 ft (914 mm)||2||1881|
|Connecticut Eastern Railroad Museum||Willimantic, Connecticut, US||4 ft 8+1⁄2 in (1,435 mm)||
|Durango & Silverton Narrow Gauge Railroad||Durango, Colorado, US||3 ft (914 mm)||7||1990||Replica; utilizes parts from original structure built in 1881 on same site, which burned down in 1989|
|East Broad Top Railroad and Coal Company||Rockhill Furnace, Pennsylvania, US||3 ft (914 mm)||8||1882|
|Esquimalt and Nanaimo Railway Roundhouse||Victoria, British Columbia, Canada||4 ft 8+1⁄2 in (1,435 mm)||?||1913|
|Heritage Park Historical Village||Calgary, Alberta, Canada||4 ft 8+1⁄2 in (1,435 mm)||6||1981||Replica|
|North Carolina Transportation Museum||Spencer, North Carolina, US||4 ft 8+1⁄2 in (1,435 mm)||6||1924|
|Railtown 1897 State Historic Park||Jamestown, California, US||4 ft 8+1⁄2 in (1,435 mm)||6||1910|
|Steamtown National Historic Site||Scranton, Pennsylvania, US||4 ft 8+1⁄2 in (1,435 mm)||13||1902|
|Union Pacific Roundhouse||Cheyenne, Wyoming, US||4 ft 8+1⁄2 in (1,435 mm)||7||1931||Used to store and maintain the Union Pacific Heritage Fleet; only open during third weekend of May|
|Weiser Railroad (Greenfield Village)||Dearborn, Michigan, US||4 ft 8+1⁄2 in (1,435 mm)||6||2000||Replica; utilizes parts from original structure built in 1884 in Marshall, Michigan|