If you get the key size wrong, your shaft-hub connection is likely to fail. This could mean stripped keyways, bent or split keys, or the drive jamming up. The calculator below works out key dimensions and length from your shaft diameter, torque, and chosen key material. This matters for any setup transmitting torque—gearboxes, motor couplings, conveyors, and automated equipment. You’ll find the design formulas, an example, technical notes, and FAQs further down the page.
What is keyway and key sizing?
Keyway and key sizing is about picking the correct width, height, and length for a rectangular metal key that keeps a shaft and hub rotating together. If your key is too small or short, you risk it shearing off or the keyway collapsing—either will put your equipment out of commission.
Simple Explanation
The key is just a simple chunk of metal sitting in matched slots cut into a shaft and its hub. It stops them from turning separately. The key must be long and strong enough to handle the torque—otherwise it’ll either shear through or crush against the wall. This calculator figures out what you actually need based on the numbers you put in.
📐 Browse all 1000+ Interactive Calculators
Table of Contents
Key and Keyway System Diagram
Keyway Key Size Calculator
This calculator is intended for education, concept evaluation, and preliminary design. Results are based on the equations and assumptions described on this page, but cannot account for every real-world load case, tolerance, material property, environmental condition, installation detail, safety factor, code, or regulatory requirement. Verify all inputs, assumptions, units, and results independently before selecting components or using the result in a real application. Safety-critical, structural, medical, lifting, transportation, or regulated applications must be reviewed by a qualified engineer.
Keyway and Key Sizing Interactive Visualizer
This animation shows how shaft size and torque decide the minimum safe key length, based on shear and crush stresses. Adjust the numbers; you’ll see which stress controls and where failure would start if the loads are too high.
KEY SIZE (W×H)
8×7 mm
REQ'D LENGTH
31.7 mm
GOVERNING MODE
COMPRESSION
FIRGELLI Automations — Interactive Engineering Calculators
How to Use This Calculator
- Input the shaft diameter in mm; the tool uses this to set ISO 2491 standard key size.
- Enter your applied torque in Newton-metres.
- Pick your key material based on what you have or intend to use.
- Click Calculate for results.
Simple Example
Shaft diameter: 25 mm. Torque: 80 N·m. Material: Medium Carbon Steel (60 MPa).
ISO 2491 key size: 8 × 7 mm (W × H). Required key length: ~31.7 mm (compression governs). Safety check: PASS.
📹 Video Walkthrough — How to Use This Calculator
Mathematical Equations
The calculator checks two main things: the shear stress in the key and the compressive stress (crushing) where the key presses against the keyway.
Use the formula below to calculate shear stress in the key.
Shear Stress in Key:
τ = 2T/(dWL)
Where:
- τ = Shear stress (MPa)
- T = Applied torque (N⋅m)
- d = Shaft diameter (m)
- W = Key width (m)
- L = Key length (m)
Use the formula below to calculate compressive stress in the key.
Compressive Stress in Key:
σ = 4T/(dHL)
Where:
- σ = Compressive stress (MPa)
- T = Applied torque (N⋅m)
- d = Shaft diameter (m)
- H = Key height (m)
- L = Key length (m)
Complete Technical Guide to Keyway and Key Design
Understanding Keys and Keyways
Keys and keyways are some of the most basic components in mechanical linkages. They lock shafts and hubs together by preventing them from turning apart, but still allow for axial assembly if you need to slide things off. You find them in nearly every sort of power transmission setup. This calculator helps you size them to handle loads without failure.
The metal key fits into matching slots in both shaft and hub. Torque is transmitted through the key by shear force and surface bearing. Compared to splines or interference fits, keys are simpler and cheaper, and make disassembly much easier down the road.
Types of Keys and Applications
Most shafts use parallel square or rectangular keys standardized by ISO 2491. Up to roughly 22mm diameter, square keys are normal. For larger shaft diameters, wider rectangular keys give higher torque capacity without cutting too deep into the shaft.
In automation—especially anything using FIRGELLI linear actuators—keys turn up in gearboxes, coupler hubs, and other drive links. If the sizing is right, these keep your motion system working without trouble from key slip or failure.
Design Theory and Stress Analysis
Key design boils down to watching for two things: shear failure (the key splits) and compressive failure (the key or keyway gets crushed). The calculator checks both with standard formulas from basic mechanics.
Shear failure comes from torques high enough to split the key across its width and length. τ = 2T/(dWL) is the standard equation, using the actual torque, shaft diameter, key width, and key length. The factor of 2 in the formula reflects real geometry and units.
Compressive or "bearing" failure is when the key material, or the hub wall, gets overloaded and yields. This is given by σ = 4T/(dHL), with 'H' as key height. The factor of 4 is based on how the load spreads over the contact surface.
Material Selection and Allowable Stresses
Your allowable stress is set by what material key you’re using. Mild steel (~40 MPa) is fine for low loads or intermittent operation. Medium carbon (about 60 MPa) is the general workhorse for most steady or moderate setups. Go to a higher carbon or alloy steel (80-120 MPa) for bigger shocks or heavier work.
All the calculations use a safety factor of 2.0. So the stress in the key should stay below half the rated strength of the material. That margin helps cover uneven loading, manufacturing issues, and other unknowns.
Worked Design Example
Suppose you have a 30mm shaft carrying 150 N·m, and plan to use a medium carbon steel key (60 MPa):
Step 1: From ISO 2491, a 30mm shaft takes an 8×7mm key.
Step 2: Shear length check: L = 2T/(τ_allow × d × W) = (2 × 150)/(60×10⁶ × 0.030 × 0.008) = 20.8mm
Step 3: Compression length check: L = 4T/(σ_allow × d × H) = (4 × 150)/(60×10⁶ × 0.030 × 0.007) = 47.6mm
Step 4: Use the longer of the two—call it 50mm after rounding up for safety and tolerance.
This shows why, with standard keys, it's usually compressive stress that drives your choice of length—not shear.
Manufacturing and Installation Considerations
Your calculations only hold up if your parts are made well. Keyways should be cut with attention to surface finish and clean corners—no sharp nicks or gouges. Fit should be snug, not overly tight or sloppy, to get full contact and predictable stress.
Standard fits use H9 (keyway) and h9 (key) tolerances for a running fit with minimal play. Keep the key shorter than the hub by a few millimetres, to avoid jamming when you assemble it all.
Especially in FIRGELLI actuator systems, a properly fitted key is important for repeatability and long-term accuracy.
Advanced Design Considerations
These equations assume everything’s static and stress is uniform—real life may not be that tidy:
Dynamic Loading: If your load reverses, cycles rapidly, or gets shocked, a bigger safety margin or better material is worth considering. Standard parallel keys aren’t always the best choice for high cycling and impact.
Stress Concentrations: Keyway corners can create local high stresses, much greater than average. If you can't add a radius to the ends, use tougher material or derate accordingly.
Multiple Keys: With very big shafts, sometimes more than one key is spaced around. The load rarely splits perfectly, so assumptions get less certain. Stick to conservative estimates or do a more careful analysis in these cases.
Integration with Related Engineering Calculations
Adding keyways cuts a lot of strength out of a shaft. Plan for this; it can mean you'll upsize the shaft over what’s required for a plain spindle—often by 25–50%. Also check shaft, bearing, and hub design together with these numbers, especially if you’re building a full motion system.
The way the rotary stage and linear actuators interact can affect how much torque you actually get at the key. Overlooking this has caused plenty of real-world problems; check the whole system, not just the parts in isolation.
Quality Control and Testing
Once assembled, you should do a simple load test to catch loose keys, mismachined slots, or other problems early. On anything critical, non-destructive test methods (like dye penetrant) help spot problems without tearing things down again.
Check key condition as part of regular maintenance where there’s a lot of cycling. A worn key loses its strength; don’t re-use it unless you’ve checked it properly.
Documentation—like key specs, material certs, and fit reports—makes troubleshooting much easier later on, especially in automation or traceable manufacturing environments.
Frequently Asked Questions
📐 Browse all 1000+ Interactive Calculators →
About the Author
Robbie Dickson
Chief Engineer & Founder, FIRGELLI Automations
Robbie Dickson brings over two decades of engineering expertise to FIRGELLI Automations. With a distinguished career at Rolls-Royce, BMW, and Ford, he has deep expertise in mechanical systems, actuator technology, and precision engineering.
Need to implement these calculations?
Explore the precision-engineered motion control solutions used by top engineers.
