Keyway Calculator: Standard & Custom Dimensions


Keyway Calculator

Calculate standard key and keyway dimensions based on shaft diameter for square and rectangular keys.



Select the measurement unit for your shaft diameter.


Standard determines key type based on shaft size.


What is a Keyway Calculator?

A keyway calculator is a specialized engineering tool designed to determine the correct dimensions for a key and its corresponding slot (the keyway) on a rotating shaft. Keys and keyways are mechanical components used to connect a rotating element, like a gear, pulley, or sprocket, to a shaft. They prevent relative rotation and transmit torque between the two parts. This calculator uses industry standards, such as ANSI B17.1, to provide the precise width and depth for square or rectangular keys based on the shaft’s diameter.

Anyone involved in mechanical design, machinery repair, or manufacturing can use this tool, from mechanical engineers and CNC machinists to maintenance technicians. A common misunderstanding is that any size of key will work. In reality, an undersized key can shear under load, while an oversized key can induce dangerous stress concentrations in the shaft, leading to premature failure. Using a shaft keyway standards compliant calculator is critical for reliability.

Keyway Formula and Explanation

While there isn’t a single universal formula, keyway dimensions are typically based on standardized tables derived from empirical data and engineering principles. However, a common rule of thumb for initial design estimation is:

  • Key Width (W) ≈ D / 4
  • Key Height (H) ≈ D / 6 (for rectangular keys) or W (for square keys)

Here, ‘D’ is the nominal shaft diameter. The keyway cut into the shaft and the hub is then half the height of the key. This calculator doesn’t just use this approximation; it references a lookup table based on ANSI B17.1 standards to find the exact specified dimensions for a given range of shaft diameters, which is the professional practice.

Variables Table

Primary variables in keyway design.
Variable Meaning Unit Typical Range
D Shaft Diameter mm or inches 5 mm – 500 mm (0.25″ – 20″)
W Key Width mm or inches Determined by D
H Key Height mm or inches Determined by D
t1, t2 Keyway Depth (in Shaft/Hub) mm or inches Typically H/2

Practical Examples

Example 1: Metric Shaft

An engineer is designing a drive system with a 50 mm diameter shaft.

  • Inputs: Shaft Diameter = 50 mm, Unit = mm, Type = Standard.
  • Calculation: Based on standards for a 50mm shaft, a 14mm wide x 9mm high rectangular key is specified.
  • Results:
    • Key Dimensions: 14mm x 9mm
    • Shaft Keyway Depth: 5.5mm
    • Hub Keyway Depth: 3.8mm

Example 2: Imperial Shaft

A machinist needs to cut a keyway in a 2.0 inch diameter shaft.

  • Inputs: Shaft Diameter = 2.0 in, Unit = inches, Type = Standard.
  • Calculation: For a 2.0″ shaft, a 0.5″ (1/2 inch) square key is the standard.
  • Results:
    • Key Dimensions: 0.5″ x 0.5″
    • Shaft Keyway Depth: 0.25″
    • Hub Keyway Depth: 0.25″

How to Use This Keyway Calculator

  1. Enter Shaft Diameter: Input the nominal outer diameter of your shaft into the “Shaft Diameter (D)” field.
  2. Select Units: Choose whether the diameter you entered is in millimeters (mm) or inches (in). The calculator handles conversions automatically. A proper parallel key design depends on accurate units.
  3. Choose Key Type: Select ‘Standard’ to let the calculator choose between a square or rectangular key based on the most common practice for your shaft size. Select ‘Force Square’ if your application specifically requires a square key.
  4. Interpret Results: The calculator instantly provides the key’s width and height, along with the required depth of the keyway in both the shaft and the hub. A visual diagram also helps in understanding the geometry.

Key Factors That Affect Keyway Design

  • Torque Requirement: The primary factor. Higher torque requires a larger key and keyway to distribute the load and stay within the material’s shear and compressive stress limits.
  • Shaft Material & Hardness: A softer shaft material may require a larger key to reduce compressive stress on the sides of the keyway. You might need to perform a keyway stress analysis for demanding applications.
  • Fit Type: The tolerance between the key and keyway can be a clearance fit (for sliding components) or an interference fit (for permanent fixtures), which affects stress and assembly.
  • Operating Conditions: Factors like reversing loads, shock, or high temperatures can increase stress and may require derating the key’s capacity or choosing a stronger key material selection.
  • Shaft Diameter: As the calculator demonstrates, the shaft diameter is the primary input for determining the baseline key size according to standards.
  • Key Style: While this calculator focuses on parallel keys, other types like Woodruff keys or tapered keys have different calculations. A Woodruff key calculator would be needed for that specific type.

Frequently Asked Questions (FAQ)

What’s the difference between a key, a keyseat, and a keyway?
The ‘key’ is the separate piece of metal. The slot in the shaft is the ‘keyseat’, and the slot in the hub is the ‘keyway’. However, ‘keyway’ is often used informally to refer to both slots.
Why are some keys square and some rectangular?
Square keys are common for smaller shafts (e.g., under 6.5 inches). Rectangular keys (or ‘flat keys’) are wider than they are tall and are often preferred for larger shafts as they provide a larger contact area without cutting as deep into the shaft, which helps preserve its strength.
What if my shaft diameter is between two standard sizes?
Standards provide dimensions for ranges. For example, a shaft from 38mm to 44mm might use the same key size. This calculator automatically finds the correct range for your input.
How deep should a keyway be?
Typically, the keyway depth in both the shaft and the hub is half the key’s height (H/2). This ensures the load is shared evenly. The calculator provides these specific depth values.
Can I use two keys on one shaft?
Yes, for very high torque applications, two keys can be used, often offset by 90 or 180 degrees. This requires special design considerations not covered by this basic calculator.
What units does this calculator support?
This keyway calculator supports both metric (millimeters) and imperial (inches) units. You can switch between them, and the calculations will adjust accordingly.
What standard is this calculator based on?
The calculations are based on the widely recognized ANSI B17.1-1967 (R2013) standard for keys and keyseats.
How do I handle tolerances?
This calculator provides the nominal dimensions. Professional applications require applying specific tolerances (e.g., for a press fit vs. a sliding fit) as specified in engineering standards like DIN 6885 or ANSI B17.1.

© 2026 Your Website. All Rights Reserved. This calculator is for informational purposes only. Consult a professional engineer for critical applications.



Leave a Reply

Your email address will not be published. Required fields are marked *