Keyway Calculator Guide: How to Size a Shaft Key Correctly
A keyway calculator is one of the most practical tools in mechanical design when you need to connect a shaft to a hub and transmit torque safely. Whether you are designing a pulley, gear, coupling, sprocket, or flywheel connection, a properly sized key and keyway help prevent slipping, fretting, and sudden failure. This page combines a working keyway calculator with a detailed engineering guide so you can estimate key dimensions faster and make stronger design decisions.
In simple terms, a machine key is a mechanical element that sits partly in the shaft keyseat and partly in the mating hub keyway. As torque is applied, the key transfers load from one component to the other. If the key is undersized, it may fail in shear or crushing (bearing). If it is oversized or improperly fitted, you can create stress concentration, manufacturing issues, or assembly difficulty. Good keyway design balances strength, geometry standards, fit quality, and service conditions.
What This Keyway Calculator Does
- Recommends a standard metric parallel key size (b × h) from shaft diameter.
- Calculates minimum key length by shear strength.
- Calculates minimum key length by crushing/bearing strength.
- Applies a design safety factor to torque.
- Accepts torque directly, or converts from power and RPM.
- Checks an entered actual key length to show a quick pass/fail indication.
Core Key Design Formulas
The calculator uses a widely used first-pass approach for rectangular parallel keys in metric units. Let:
- T = torque in N·mm
- d = shaft diameter in mm
- b = key width in mm
- h = key height in mm
- L = key effective length in mm
- τallow = allowable shear stress in MPa (N/mm²)
- σc,allow = allowable crushing stress in MPa
Minimum length from shear:
Lshear = 2T / (d · b · τallow)
Minimum length from crushing:
Lcrush = 4T / (d · h · σc,allow)
Required minimum length is the larger of the two values. A safety factor is normally applied to transmitted torque before these checks.
Standard Metric Key Size Selection (Typical)
For many designs, key width and height are first chosen from standard ranges based on shaft diameter. The table below is a typical quick-reference set commonly used in machine design practice. Always verify against your governing standard and manufacturing tolerance class.
| Shaft Diameter d (mm) | Recommended Key b × h (mm) |
|---|---|
| 6 to 8 | 2 × 2 |
| 8 to 10 | 3 × 3 |
| 10 to 12 | 4 × 4 |
| 12 to 17 | 5 × 5 |
| 17 to 22 | 6 × 6 |
| 22 to 30 | 8 × 7 |
| 30 to 38 | 10 × 8 |
| 38 to 44 | 12 × 8 |
| 44 to 50 | 14 × 9 |
| 50 to 58 | 16 × 10 |
| 58 to 65 | 18 × 11 |
| 65 to 75 | 20 × 12 |
| 75 to 85 | 22 × 14 |
| 85 to 95 | 25 × 14 |
| 95 to 110 | 28 × 16 |
| 110 to 130 | 32 × 18 |
| 130 to 150 | 36 × 20 |
| 150 to 170 | 40 × 22 |
| 170 to 200 | 45 × 25 |
| 200 to 230 | 50 × 28 |
How to Use the Calculator Step by Step
- Enter shaft diameter in millimeters.
- Choose torque mode:
- Torque mode: enter transmitted torque directly.
- Power + RPM mode: enter power and speed; calculator converts to torque.
- Enter allowable shear and crushing stresses for your key/hub material system.
- Set design safety factor appropriate to duty cycle and shock loading.
- Use standard key size lookup or enable custom b and h values.
- Click Calculate to get minimum key length and governing mode.
- Optionally input actual key length to verify pass/fail margin.
Engineering Notes for Better Keyway Design
1) Material and Heat Treatment Matter
Allowable stresses should come from credible material data and your design code. Key steel, shaft steel, and hub material can differ, and real failure often starts in the weaker interface. If hub material is soft, crushing may govern before key shear. For hardened shafts with softer keys, wear and fretting also become important in cyclic service.
2) Shock and Reversing Loads
Steady torque sizing is only part of design. Start-stop cycles, impact, misalignment, and reversal can produce peak loads far above nominal values. Increase safety factor for harsh duty and evaluate fatigue where needed. If dynamic loading is severe, splines, interference fits, or alternative coupling strategies may outperform a single key.
3) Effective Length vs. Nominal Length
Nominal key length may be greater than effective load-bearing length due to chamfers, radiused ends, and local contact conditions. Designers often choose a practical standard length above the minimum calculated value. In compact hubs, ensure adequate engagement remains after accounting for edge relief and assembly constraints.
4) Keyway Geometry and Stress Concentration
A keyway introduces a stress raiser in the shaft, reducing torsional capacity relative to a plain shaft. For high-performance rotating systems, check shaft strength with keyway factor corrections and evaluate fatigue stress concentration. The key itself may pass, while the shaft root near the keyseat can become the critical location.
5) Fits, Tolerances, and Manufacturing
Even correctly sized keys can fail early if tolerances are poor. Excessive side clearance can cause impact loading and fretting. Over-tight fits can make assembly difficult and transfer load unpredictably. Use the relevant fit class, ensure quality broaching/milling, and verify key seating depth and parallelism.
Common Keyway Design Mistakes
- Using a key selected only by shaft diameter without checking torque-induced length.
- Ignoring crushing check and validating only shear.
- Applying nominal instead of peak torque in variable duty service.
- Choosing low safety factor for shock-loaded machinery.
- Skipping shaft stress concentration and fatigue review.
- Assuming catalog key material properties without certification.
When to Use Splines Instead of Keys
Keys are cost-effective and easy to manufacture, especially for moderate torque and simple assemblies. However, splines distribute load over multiple teeth and are often preferred for high torque density, frequent assembly/disassembly, precise angular positioning, or axial sliding. If your key length becomes impractically long, or if local contact stress is too high, evaluate a spline design.
FAQ: Keyway Calculator and Key Sizing
What units does this calculator use?
It uses metric units: mm for geometry, N·m for torque input, kW and RPM for power-based conversion, and MPa for allowable stresses.
Can I use custom key dimensions?
Yes. Enable the custom key option and enter width (b) and height (h) manually. This is useful when a legacy machine uses non-default dimensions.
What if my actual key length is less than required?
You should redesign: use a longer key, increase key size where standards allow, reduce transmitted torque, increase material strength/allowables if justified, or switch connection method.
Is this calculator enough for final design approval?
No. It is a first-pass engineering calculator. Final design should include full code compliance, tolerance stack-up, fatigue checks, shaft strength with keyway effects, and manufacturing review.
Why does crushing often govern?
Because contact pressure on the key flank can be high, especially with short hubs or softer materials. In many practical applications, bearing (crushing) sets the required key length before shear does.
Conclusion
A reliable keyway design starts with correct key size selection and minimum length checks under realistic torque and safety assumptions. This calculator helps you get that baseline quickly and consistently. For best results, pair these calculations with material validation, manufacturing tolerance control, and full system-level mechanical review.