In mechanical engineering, a key is a machine element used to connect a rotating machine element to a shaft. The key prevents relative rotation between the two parts and may enable torque transmission. For a key to function, the shaft and rotating machine element must have a keyway and a keyseat, which is a slot and pocket in which the key fits. The whole system is called a keyed joint. A keyed joint may allow relative axial movement between the parts.