From TrainSpottingWorld, for Rail fans everywhere
The running gear of a PRR DD1. The jackshafts, and the large electric motors that made them necessary, are clearly visible.
A British Rail Class 04 switcher with a jackshaft under the cab.

A jackshaft is a device for turning the wheels of a locomotive. It is essentially an axle with no wheels. Each end of the jackshaft has a crank pin and a counterweight. The driving wheels are then connected by side rods. The name may come from a combination of "jack," a slang term for a locomotive, and a rotating shaft.

Jackshafts were in use as early as 1836. The Stockton & Darlington's Swift used one to convert the vertical motion of its cylinders to rotating motion at the wheels.

Jackshafts were also used on some small locomotives for a perceived savings of maintenance costs. Using the cylinders to drive a high-mounted jackshaft instead of connecting them directly to the wheels allowed the cylinders to be mounted higher up. This placed them above ground level dust. Whether the added complexity of the jackshaft was warranted is uncertain.

Several steam turbine locomotives used jackshafts to drive the wheels. The turbine was geared to the jackshaft, typically located at the front of the locomotive. This may have been done to help insulate the turbine from vibration of the wheels.

Some early electric locomotives were also equipped with jackshafts. Early electric locomotives required motors that were too big to fit near the axles. The motor turned the jackshaft either by gears or with a connecting rod, and then the jackshaft turned the wheels. Continuing development of electric motors made them smaller and made jackshafts obsolete. Examples include the PRR DD1 and FF1 electric locomotives.

Some diesel locomotives used jackshafts as well. The British Rail Class 03 is one example. They were seldom used on diesel-electrics but were used on some diesel-mechanical and diesel-hydraulic locomotives.