Keyway and Key Size Calculator

← Back to Engineering Library

If you pick the wrong key size to connect a shaft to a hub, you'll have problems: too small, and the key will fail early; too big, and the shaft is weakened and you waste space. Either mistake is easy to avoid if you check the stresses properly. This Keyway and Key Size Calculator works out standard key dimensions, how deep to cut the keyway, the minimum key length, and the bearing stress, using the shaft diameter and torque you enter. This sort of sizing isn’t busywork—it’s directly tied to making sure things don’t slip or shear in gearboxes, conveyors, and motor couplings. The page covers equations from ANSI B17.1, a full example, the technical approach, and practical FAQ.

What is keyway and key size calculation?

When you're sizing a keyway and key, you're figuring out the shape and size for that little metal block—the key—that locks a shaft and a hub together so they spin as one. If the dimensions are right, the key takes the torque. If they’re off, the key might shear and the hub might spin free, halting the entire machine.

Simple Explanation

A key is basically a metal wedge set between shaft and gear to stop them slipping against each other when torque is applied. The key fits into matching slots (“keyways”) machined into both shaft and hub—this way, the force spreads across both parts instead of just one. The higher the torque, the bigger (longer, wider) the key needs to be so it doesn’t shear or get crushed in service.

📐 Browse all 1000+ Interactive Calculators

Keyway System Diagram

Keyway and Key Size Calculator Technical Diagram

Keyway Key Size Calculator

How to Use This Calculator

Engineering calculation notice

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.

Found a calculation error? Message us

  1. Enter your shaft diameter in inches into the Shaft Diameter field.
  2. Enter the applied torque in lb-in into the Torque field.
  3. Optionally click Try Example to load a pre-filled sample scenario.
  4. Click Calculate to see your result.

📹 Video Walkthrough — How to Use This Calculator

Keyway and Key Size Calculator

Keyway and Key Size Interactive Calculator

You can see how the shaft diameter and torque affect the key dimensions and the stress levels. Changing the sliders lets you quickly spot where stress begins to approach typical limits, so you know if a given key size will hold up in use.

Shaft Diameter 1.5 in
Applied Torque 5000 lb-in

KEY SIZE

3/8"×3/8"

MIN LENGTH

2.37 in

SHEAR STRESS

15000 psi

BEARING STRESS

11842 psi

FIRGELLI Automations — Interactive Engineering Calculators

Design Equations

Here are the basic equations for key sizing: use these to check for shear, bearing stress, and minimum key length.

Key Sizing Equations

Shear Stress in Key:

τ = F / Ashear = (2T/D) / (W × H × L)

Bearing Stress:

σbearing = F / Abearing = (2T/D) / (H × L × D/2)

Minimum Key Length:

Lmin = (2T/D) / (τallow × W × H)

Where:

  • T = Applied torque (lb-in)
  • D = Shaft diameter (in)
  • W = Key width (in)
  • H = Key height (in)
  • L = Key length (in)
  • τallow = Allowable shear stress (15,000 psi for steel)
  • σallow = Allowable bearing stress (25,000 psi for steel)

Simple Example

Shaft diameter: 1.5 in — Torque: 2,000 lb-in
Standard key selected (ANSI B17.1): 3/8" × 3/8" (W × H)
Shear force: (2 × 2,000) / 1.5 = 2,667 lb
Minimum key length: 2,667 / (15,000 × 0.375 × 0.375) = 1.264 in
Bearing stress: 2,667 / (0.375 × 1.264 × 0.75) = 7,496 psi — SAFE

Understanding Keyway Design and Analysis

Keyway and key sizing is a bread-and-butter part of mechanical power transmission. The whole point is to make sure torque passes from shaft to hub without slipping or popping a key. This calculator follows ANSI B17.1 sizing for accuracy, but keep in mind—no calculator can see every real world stress concentration or assembly variation.

Fundamental Principles of Key Design

A key links a spinning shaft to a gear, pulley, or coupling by fitting closely in a slot machined in both parts. It stops relative rotation just by sitting there—the connection only works if the key is sized and fitted for the torque you expect. Materials need to be fit for the load too, not just the size. You always want to check both shear and bearing stress on any key, no matter the standard size.

ANSI B17.1 sets default key sizes for a given shaft diameter, and square keys are common unless space or load says you need something else. Just keep in mind that the basic equations still apply—you’re balancing shear strength, crush (bearing) resistance, and available length for your hub.

Stress Analysis in Key Connections

Keys usually fail in one of two ways: either they're sheared across their cross-section, or they’re crushed (overloaded in bearing) against the keyway wall. Shear comes from torque trying to slide the hub around the shaft, and bearing failure comes from that same force pushing the key into the sides of its slot.

Shear stress assumes the load spreads evenly through the key’s cross-section—usually gives a conservative answer. For bearing, you only count the contact area over half the key height, which is how most real-world fits behave.

Manufacturing Considerations

Getting the keyway cut right matters a lot. Most are cut with an end mill or a broach, and if you go too deep or shallow, the fit won’t be right and stresses concentrate. For most standard keys, the depth should be half the height of the key. On the hub side, finish boring before keyway cutting helps keep it concentric, which really pays off during assembly.

ANSI tolerances are typical: about +0.000/-0.002 inches on width. If you're dealing with high-precision or high-speed equipment, you might need a tighter fit. A smooth finish in the keyway also helps—poor finish or burrs can cause stress risers and eventual cracking.

Practical Design Example

Let’s say there’s a 1.5-inch shaft running at 5000 lb-in torque. The calculator calls for a 3/8" × 3/8" key. The torque turned into shear force is 2T/D = 2(5000)/1.5 = 6667 lbs. For a 1.5-inch key, shear stress becomes 6667/(0.375 × 0.375 × 1.5) = 31,573 psi—twice what’s typical for steel, so that’s a problem.

To fix it, you’d lengthen the key (to 3 inches in this example). Shear stress drops to 15,787 psi, much more reasonable. Bearing stress works out to 6667/(0.375 × 1.5 × 0.75) = 15,787 psi—well below the limit for steel. This kind of calculation makes it clear why you check the numbers before picking a key off the shelf.

Applications in Automation Systems

Keys show up everywhere: connecting pulleys, gears, and couplings to shafts in things like FIRGELLI linear actuators or robotics assemblies. As actuators have gotten more compact and precise, key dimensions have often had to shrink—meaning a bad guess is more likely to cause problems. Tighter packaging and larger expected torques mean running the numbers pays off.

Even in gearboxes on linear actuators, keys have to handle power at several stages. So checking the key sizing every time is worth your while, especially if you’re close on length or worried about space or cost.

Advanced Design Considerations

If you’re working with high-speed machinery, keyway stresses aren’t just from steady torque. Rapid starts and stops cause impact loads that can be several times higher than steady running—so fatigue (and not just static stress) matters. If the system cycles a lot, or the load changes, you need to check for fatigue limits too.

Materials make a difference: plain steel works for most, but corrosive or specialty environments may need stainless or bronze. Stronger steels need heat treating to really take advantage of their higher allowable stress, but it’s more expense. If you’re using other materials, make sure to update the calculation’s allowable stresses.

High-torque setups sometimes allow for two keys 180° apart, but don’t assume perfect load sharing—machining tolerances usually mean one key takes more than the other. If you need even more torque capacity, splined shafts or interference fits can be a better solution than trying for three or more keys.

Quality Control and Testing

Simple gauges check the cut width and depth of the keyway, and you can check the key’s fit before assembly. If assembly is tight or loose, it’s worth re-checking dimensions. Surface finish should be clean—sharp edges or burrs cause issues down the line.

For higher-end work, you can run a torque or fatigue test once assembled, or use dye penetrant to look for surface cracks after loading. In use, watch for visible fretting or wear—this tells you how the load path is behaving and if your sizing matches real conditions.

Frequently Asked Questions

How do I determine the correct key size for my shaft diameter? +
What causes key failure and how can I prevent it? +
How deep should keyways be machined? +
What is the minimum key length required? +
Can I use multiple keys for high torque applications? +
What materials should I use for keys? +

📐 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.

Share This Article
Tags: