Keyway Size Calculator
Determine standard keyway dimensions from shaft diameter using ANSI/DIN tables. Enter values for instant results with step-by-step formulas.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Keyway Size Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Key size is determined by shaft diameter from ANSI B17.1 or DIN 6885 tables
Worked example โ Key: 8mm x 7mm | Shaft depth: 3.6mm | Hub depth: 3.5mm | Length: ~38mm
Formula
Key size is determined by shaft diameter from ANSI B17.1 or DIN 6885 tables
Standard keyway dimensions are selected based on the shaft diameter range. The key width and height increase with shaft diameter according to standardized tables. Shaft keyseat depth is approximately half the key height plus clearance.
Worked Examples
Example 1: Standard Keyway for 25mm Shaft
Problem:Determine the standard keyway dimensions for a 25mm diameter shaft using ANSI B17.1.
Solution:Shaft diameter: 25mm falls in the 22-30mm range Key width (w) = 8mm Key height (h) = 7mm Shaft keyseat depth = 7/2 + 0.1 = 3.6mm Hub keyseat depth = 7 - 3.6 + 0.1 = 3.5mm Recommended key length = 1.5 x 25 = 37.5mm (use 38mm)
Result:Key: 8mm x 7mm | Shaft depth: 3.6mm | Hub depth: 3.5mm | Length: ~38mm
Example 2: Keyway for Large Industrial Shaft
Problem:Find keyway dimensions for a 75mm shaft driving a heavy-duty gearbox coupling.
Solution:Shaft diameter: 75mm falls in the 65-75mm range Key width (w) = 20mm Key height (h) = 12mm Shaft keyseat depth = 12/2 + 0.1 = 6.1mm Hub keyseat depth = 12 - 6.1 + 0.1 = 6.0mm Recommended key length = 1.5 x 75 = 112.5mm
Result:Key: 20mm x 12mm | Shaft depth: 6.1mm | Hub depth: 6.0mm | Length: ~112mm
Frequently Asked Questions
What is a keyway and what is its purpose in mechanical design?
A keyway is a slot machined into a shaft and a matching slot (called a keyseat) in the hub of a gear, pulley, or coupling that together hold a key to transmit torque between the shaft and the mounted component. The key prevents relative rotation between the shaft and the hub while allowing the component to slide axially for assembly and disassembly. Keyways are one of the most common and economical methods of transmitting torque in mechanical power transmission systems. They are used in applications ranging from small electric motors to large industrial machinery, providing a positive drive connection that is simple to manufacture and maintain.
How do I determine the correct keyway size for my shaft?
The correct keyway size is determined primarily by the shaft diameter using standardized tables from ANSI B17.1 or DIN 6885. These standards specify the key width and height based on the shaft diameter range. For example, a 25mm shaft uses an 8mm wide by 7mm tall key according to both standards. The key length is typically determined by the hub width of the component being mounted and the torque requirements. Always use the standard dimensions unless specific engineering analysis shows different dimensions are needed. Using non-standard keyway sizes makes replacement keys difficult to source and increases manufacturing costs.
What is the difference between ANSI and DIN keyway standards?
ANSI B17.1 is the American standard while DIN 6885 is the European (German) standard for parallel keys and keyways. Both standards define very similar key cross-sections for given shaft diameter ranges, and in many cases the dimensions are identical. The main differences are in tolerances, fit classes, and some dimensional preferences at certain shaft sizes. ANSI tends to use fractional inch sizes for imperial shafts while DIN uses metric dimensions throughout. When designing new equipment choose the standard that matches your market and supply chain. For replacement parts identify which standard the original equipment used by measuring the existing keyway dimensions carefully.
What are the different types of keys used in keyway connections?
Several types of keys are used in mechanical design, each suited to different applications. Square keys have equal width and height and are used for shaft diameters up to about 22mm. Rectangular (flat) keys are wider than they are tall and used for larger shafts where the deeper shaft keyseat would weaken the shaft too much. Woodruff keys are semicircular and self-aligning, commonly used in tapered shaft applications and automotive transmissions. Gib-head keys have a head that allows removal without access to both ends and are used where the key must be driven out from one end. Round (pin) keys are simple and inexpensive for light-duty applications.
How deep should the keyway be cut into the shaft and hub?
Standard practice distributes the key height between the shaft keyseat and the hub keyseat. For rectangular keys, the shaft keyseat depth is approximately half the key height plus a small clearance of 0.1 to 0.2mm. The hub keyseat depth is the remaining key height minus the shaft depth plus clearance. This ensures the key fits with slight interference or transition fit in the radial direction. The total of shaft depth plus hub depth should be slightly more than the key height to prevent the key from bottoming out in both slots simultaneously. Precise depth dimensions and tolerances are specified in the relevant standard and should be followed exactly for reliable torque transmission.
How do I calculate the torque capacity of a keyed connection?
The torque capacity of a keyed connection is limited by either shear failure or compressive failure of the key. For shear, the allowable torque equals the shear stress limit times the key width times the key length times the shaft radius divided by the safety factor. For compression, the torque equals the compressive stress limit times half the key height times the key length times the shaft radius divided by the safety factor. The lower of the two values is the limiting torque capacity. Typical allowable shear stress for AISI 1018 steel keys is about 60 MPa, and compressive stress about 90 MPa with a safety factor of 2 to 3 depending on loading type (steady, intermittent, or shock).
What materials are commonly used for keys?
Keys are typically made from low to medium carbon steel, most commonly AISI 1018 or 1045 cold-drawn steel bar stock. The key material should be softer than both the shaft and hub so that the key fails first in an overload condition, acting as a sacrificial element that protects the more expensive shaft and component from damage. For higher torque applications, alloy steels like 4140 or 4340 may be used. Stainless steel keys (303 or 316) are used in corrosive environments or food processing equipment. In rare cases brass or bronze keys are used where a deliberate shear pin function is desired at a specific torque value to protect downstream equipment.
What is a Woodruff key and when should I use one?
A Woodruff key is a semicircular key that sits in a semicircular pocket milled into the shaft. The curved bottom allows the key to self-align with any slight taper or misalignment between the shaft and hub. Woodruff keys are commonly used on tapered shaft ends where a parallel key would bind during assembly and disassembly. They are widely used in automotive applications including machine tool spindles, automotive steering columns, and small power tool shafts. The disadvantage of Woodruff keys is that the deep semicircular keyseat weakens the shaft more than a rectangular keyseat, so they are generally limited to lighter torque applications and smaller shaft diameters.
How do I machine a keyway accurately?
Keyways can be machined using several methods depending on the production volume and required accuracy. Broaching is the most common production method for internal hub keyways, producing excellent dimensional accuracy and surface finish in a single pass. Shaping or slotting machines cut keyways using a single-point tool in a reciprocating motion and are common in job shops. Milling with an end mill is used for shaft keyways, cutting either a sled-runner style (open-ended) or profile (closed-ended) keyway. Wire EDM is used for hardened materials or complex shapes. Regardless of method, the keyway must be located accurately relative to the shaft centerline and have the correct width tolerance for the specified fit class.
What are common keyway failures and how do I prevent them?
The most common keyway failure modes are key shear, compressive deformation (wallowing), shaft fatigue cracking at the keyway root, and fretting corrosion. Key shear occurs when the applied torque exceeds the key material shear strength and is prevented by using the correct key size for the shaft or increasing key length. Compressive failure (wallowing) causes the key to gradually deform and create looseness, prevented by using harder key materials or longer keys. Shaft fatigue cracking initiates at the sharp corners of the keyway root and is prevented by specifying fillet radii at the keyway corners (typically 0.25 to 0.5mm radius). Fretting corrosion occurs from micro-movement between the key and keyway surfaces and is reduced by ensuring proper fit and using anti-fretting compounds.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎInverter Size Calculator
Calculate the inverter size needed for off-grid or backup power from total load wattage.
๐งฎStorm Drain Size Calculator
Size storm drains using the Rational Method from rainfall intensity and drainage area.
๐งฎO-Ring Size Calculator
Select the correct O-ring size from groove dimensions, ID, and cross-section.
๐งฎAir Compressor Size Calculator
Size an air compressor from CFM requirements, duty cycle, and tool demand.
๐งฎFuse Size Calculator
Calculate the correct fuse or circuit breaker size from load current and wire gauge.
๐งฎCatch Basin Size Calculator
Size storm water catch basins from drainage area, runoff coefficient, and rainfall intensity.
๐งฎCulvert Size Calculator
Calculate culvert pipe diameter from peak flow rate and allowable headwater depth.
๐งฎCable Tray Size Calculator
Calculate cable tray width from cable count, diameters, and NEC fill requirements.