Gandy dancer is a slang term used for early railroad workers who laid and maintained railroad tracks in the years before the work was done by machines. The British equivalents of the term gandy dancer are "navvy" (from "navigator"), originally builders of canals or "inland navigations", for builders of railway lines, and "platelayer" for workers employed to inspect and maintain the track. In the U.S. Southwest and Mexico, Mexican and Mexican-American track workers were colloquially "traqueros".

In some texts, the term is described as specific to those workers who built the track. One text states that "layers of railroad track are hardly ever called gandy dancers," asserting, rather, that the job of the gandy dancer refers to "track examiners", ascribing their responsibilities as "checking ties, bolts, track, and roadbed for necessary repairs." However, most sources refer to gandy dancers as the men who did the difficult physical work of track maintenance under the direction of an overseer.

There are various theories about the derivation of the term, but most refer to the "dancing" movements of the workers using a specially manufactured 5-foot (1.52 m) "lining" bar (which may have come to be called a "gandy") as a lever to keep the tracks in alignment.