A key is the small bar that transmits torque between a shaft and the hub mounted on it, seated half in a keyseat milled into the shaft and half standing proud into the keyway of the hub. ASME B17.1 schedules the cross-section directly from shaft diameter — a 1-inch shaft takes a 1/4 × 1/4 square key with a 1/8 in deep keyseat, a 1-1/2 inch shaft a 3/8 × 3/8 key — with square keys preferred through 6-1/2 inch shafts, a shorter rectangular alternative listed for most bands, and the nominal keyseat depth always half the key height.
Strength comes down to two classical failure modes on the tangential force F = 2T/d. Shear cuts across the key’s width: τ = 2T/(d·w·L), checked against the distortion-energy allowable 0.577·Sy/nd. Bearing crushes the half-height flank: σ = 4T/(d·h·L) against Sy/nd — the factor 4 appears because only h/2 of the key bears in each member, and bearing is what usually governs. Design factors of 2 to 3 against yield are common because keys see impact and reversal, and practice keeps key length between about 1 and 1.5 shaft diameters.
Two judgment calls ride along. The key should be slightly weaker than shaft and hub so the cheap, replaceable part is the mechanical fuse that fails first. And the keyseat itself weakens the shaft — a stress-concentration factor near 2 at the end-milled runout is typical — which is why shaft design at a keyed section carries fatigue stress-concentration factors of its own.