D-shaft hole size for 3D printed knobs and couplers

Model the D with two numbers, the shaft diameter and the size across the flat, each offset by the fit. A 6 mm pot or encoder shaft (4.5 mm across the flat) takes a 5.90 mm bore with a 4.40 mm flat for a push-on knob, or 6.20 mm and 4.70 mm with a set screw.

Written by 3D Calculators Team·Published

For a 3D printed coupler on a 5 mm NEMA 17 stepper shaft, model a 5.20 mm bore with 4.70 mm across the flat and lock it with an M3 set screw on the flat. A push-on knob for a 6 mm potentiometer or encoder shaft takes a 5.90 mm bore with 4.40 mm across the flat.

What size hole does a D-shaft need in a 3D print?

A D-shaft needs a D-shaped hole sized from two dimensions: the shaft diameter and the across-flat size, each offset by the fit. For a 6 mm potentiometer or encoder shaft with 4.5 mm across the flat, model 5.90 and 4.40 mm for a push-on knob, or 6.20 and 4.70 mm for a set-screw fit.

“Across the flat” is the distance from the flat to the far side of the shaft. Each bore cell below gives the diameter, then the across-flat size.

Shaft Diameter Across flat Push-on knob, 0.05 mm interference per side Set screw, 0.10 mm clearance per side
6 mm pot or encoder (Alps RK09K, Alps EC11E, Bourns PEC11R) 6.00 mm 4.50 mm 5.90 / 4.40 mm 6.20 / 4.70 mm
5 mm NEMA 17 stepper (SOYO SY42STH38-1684A) 5.00 mm 4.50 mm 4.90 / 4.40 mm 5.20 / 4.70 mm
1/4 in pot (CTS Series 450, flatted) 6.35 mm (0.250 in) 3.96 mm (0.156 in) 6.25 / 3.86 mm (0.246 / 0.152 in) 6.55 / 4.16 mm (0.258 / 0.164 in)
1/4 in NEMA 23 stepper (SOYO SY57STH56-2804A) 6.35 mm (0.250 in) 5.85 mm (0.230 in) 6.25 / 5.75 mm (0.246 / 0.226 in) 6.55 / 6.05 mm (0.258 / 0.238 in)

The two offsets are the tolerance calculator’s press fit (0.05 mm of interference per side, 0.10 mm total) and snug fit (0.10 mm per side, 0.20 mm total). Apply the per-side value to every face of the D, so the diameter and the across-flat size each change by the total.

  • Material: the values assume PLA or PETG, a 0.4 mm nozzle and 0.2 mm layers on a calibrated printer, QIDI’s baseline. For ABS or ASA, QIDI adds 0.05 to 0.10 mm per side.
  • Push-on fits vary by printer: published values run from 0.15 mm of interference per side (QIDI) to 0.2 mm of clearance per side (the University of the Arts London lab’s UltiMaker S7). If the hub cracks, try 0 per side. If the knob slips, try 0.10 mm of interference per side.
  • Holes print small: Hubs says filament (FDM) printers often print vertical holes undersized. The shortfall depends on the printer, slicer, hole size and material. Print the bore, measure its round side with calipers, and add the shortfall to both numbers. To correct every hole at once in the slicer, use the hole compensation calculator.
  • Shafts vary too: Bourns allows the PEC11R shaft 6.0 ± 0.1 mm, so measure yours before you print a push-on fit.

D-shaft dimensions: 6 mm, 5 mm and 1/4 in

The makers’ drawings give these sizes. The flat’s length sets how deep a knob’s D can go.

Shaft Part Diameter Across flat Flat length
6 mm potentiometer Alps Alpine RK09K, RK09D 6 mm, +0/-0.05 4.5 mm, +0/-0.05 6 mm on a 15 mm shaft, 7 mm on a 20 mm RK09D
6 mm encoder Alps Alpine EC11E 6 mm, +0/-0.05 4.5 mm, +0/-0.1 12 mm on a 20 mm shaft
6 mm encoder Bourns PEC11R 6.0 ± 0.1 mm 4.5 mm, +0/-0.05 7, 10 and 12 mm on 15, 20 and 25 or 30 mm shafts
1/4 in potentiometer CTS Series 450, flatted trim 6.35 mm (0.250 in) 3.96 mm (0.156 in) 9.53 mm (0.375 in)
5 mm stepper, NEMA 17 (42 mm frame) SOYO SY42STH38-1684A 5 mm, +0/-0.012 4.5 mm (flat 0.5 mm deep) not given; 24 mm shaft
1/4 in stepper, NEMA 23 (57 mm frame) SOYO SY57STH56-2804A 6.35 mm (0.250 in) 5.85 mm (flat 0.5 mm deep) not given

Two shafts sold as “1/4 in D” differ by 1.89 mm across the flat: CTS cuts its flat 2.39 mm deep, SOYO only 0.5 mm. Even a datasheet can be wrong: Pololu notes that its NEMA 23 drawing shows 6 mm across the flat when the real figure is 5.85 mm. Measure across the flat with calipers before you model.

Knurled shafts take a different bore. The knurled Bourns PEC11R shaft has 18 teeth on 6.0 mm, and the CTS 450 split knurl has 24. A knob for either needs a matching spline, or a round bore pressed over the teeth.

How to model a D-shaft hole in CAD

flat depth               h = D - F
flat line from center    e = F - D/2
flat width (chord)       w = 2 × √((D/2)² - e²)

bore diameter            D_bore = D + 2c
bore across flat         F_bore = F + 2c
bore flat from center    e_bore = e + c
  • D is the shaft diameter and F the size across the flat.
  • c is the clearance per side: -0.05 mm for a push-on knob, 0.10 mm for a set-screw fit.

Sketch a circle at D_bore, add a line e_bore from the center and trim the arc beyond it. On a 6 mm pot shaft, e is 4.5 - 3 = 1.5 mm and the flat is 5.20 mm wide, so a push-on bore’s flat line sits 1.45 mm from the center. A 5 mm stepper’s 0.5 mm flat is only 3.00 mm wide, with its line 2.0 mm from the center (1.95 mm for a push-on bore).

How to 3D print a 6 mm D-shaft knob

Model a 5.90 mm bore with 4.40 mm across the flat, then:

  • Print the bore vertical. Each layer then draws the D as one closed outline, with the flat as a straight wall and no support. Hubs notes that horizontal holes need bridges or support, and that layer orientation makes FDM parts weaker in one direction. With the bore vertical, pressing the knob on stretches the hub along its layer lines instead of pulling them apart.
  • Keep the D section no deeper than the shaft’s flat: 6 mm on a 15 mm Alps RK09K, 7 mm on a 15 mm Bourns PEC11R, 12 mm on a 20 mm Alps EC11E. A longer D hits the end of the flat before the knob seats. Past that depth, either end the bore or open it to a round 6.20 mm.
  • Add a set screw if the push fit loosens. Switch the bore to 6.20 / 4.70 mm and drive an M3 set screw onto the flat (see the coupler section).

How to 3D print a D-shaft coupler

Give each end its own bore and its own set screw. To join a 5 mm NEMA 17 shaft to an 8 mm round lead screw, model the motor end at 5.20 mm with 4.70 mm across the flat and the screw end at 8.20 mm round. Both are snug fits, 0.10 mm per side.

Aim the set screw at the flat. LulzBot’s TAZ 6 assembly guide calls it “crucial” that the first set screw tightened lines up with the flat side of the motor shaft. Prusa’s knowledge base gives the same rule for the pulley set screws on its X and Y motors. An M3 cup-point set screw (ISO 4029) takes a 1.5 mm hex key.

The set screw needs a thread to work against. Give it one of these:

  • A nut trap: a slot from the hub’s top face that holds an ISO 4032 M3 nut (5.5 mm across flats, 2.4 mm thick) on the screw’s axis. Model the slot 5.7 mm wide and 2.6 mm thick, the snug fit’s 0.10 mm per side added to each face. Run a 3.4 mm hole, the ASME B18.2.8 normal clearance for M3, from the outside wall through the slot to the bore.
  • A heat-set insert: model the hole the insert maker gives for its M3 insert.
  • A tapped hole: model 2.5 mm and cut an M3 × 0.5 thread with a tap.

The nut sits between the bore and the outside wall, so a nut trap needs a thicker hub. For scale, LulzBot’s aluminum coupler for two 5 mm shafts is 16 mm across and 23 mm long. For a screw other than M3, the screw hole size calculator gives the clearance, tap and pilot holes.

Watch the motor’s heat. SOYO allows the SY42STH38-1684A a temperature rise of up to 80 °C over ambient at rated current. Prusa says PLA “gets soft and deforms at temperatures over 60 °C”. A printed coupler on a stepper shaft suits a light load on a motor that runs cool.

For a printer’s Z axis, the maker’s part is metal. LulzBot’s Mini 1 and TAZ 4 to 6 join each Z motor to its lead screw with a helical flexible coupling in anodized 7075-T6 aluminum, held by M3 set screws.

When a printed knob or coupler won’t fit

  • It won’t go on, or the hub cracks: measure the printed bore. If it came out small, add the shortfall to both numbers, or move the push-on fit from -0.05 to 0 per side.
  • It turns on the shaft: the flat isn’t gripping. Measure your shaft across the flat, since the 1/4 in shafts above range from 3.96 to 5.85 mm, and check that the set screw lands on the flat.
  • It stops short: the D section is longer than the shaft’s flat, or the first layers squashed into the bore. The tolerance calculator covers that bottom-layer bulge (elephant’s foot).

Written by 3D Calculators Team· Published · Figures last checked

Sources

  1. Alps Alpine, RK09K/RK09D Series rotary potentiometer catalog (9 mm insulated shaft snap-in type) (accessed 2026-10-26)
  2. Alps Alpine, EC11E Series encoder catalog (11 mm metal shaft type) (accessed 2026-10-26)
  3. Bourns, PEC11R Series 12 mm incremental encoder datasheet (accessed 2026-10-26)
  4. CTS, Series 450 24 mm rotary potentiometer datasheet, Rev. E (shaft diameter and trim options) (accessed 2026-10-26)
  5. Pololu, Stepper Motor: Bipolar, 200 Steps/Rev, 42×38mm, 2.8V, 1.7 A/Phase (SOYO SY42STH38-1684A, NEMA 17) (accessed 2026-10-26)
  6. SOYO (Changzhou Songyang), SY42STH38-1684A hybrid stepping motor specifications, hosted by Pololu (accessed 2026-10-26)
  7. Pololu, Stepper Motor: Bipolar, 200 Steps/Rev, 57×56mm, 2.5V, 2.8 A/Phase (SOYO SY57STH56-2804A, NEMA 23) (accessed 2026-10-26)
  8. QIDI, 3D Printed Interlocking Parts: Clearance & Fit Guide (accessed 2026-10-26)
  9. UAL Creative Computing Institute wiki, Design the clearance and tolerance (accessed 2026-10-26)
  10. Hubs, How to design parts for FDM 3D printing (accessed 2026-10-26)
  11. LulzBot, TAZ 6 Final Assembly Workflow (Attach Z-Couplers to Motors) (accessed 2026-10-26)
  12. LulzBot, Helical Flexible Shaft Coupling 2 Pack (accessed 2026-10-26)
  13. Prusa Knowledge Base, Check axis length X/Y/Z (MK3S) (accessed 2026-10-26)
  14. Prusa Knowledge Base, PLA (accessed 2026-10-26)
  15. fasteners.eu, ISO 4032 hexagon nuts, style 1 (dimension table) (accessed 2026-10-26)
  16. fasteners.eu, ISO 4029 hexagon socket set screws with cup point (dimension table) (accessed 2026-10-26)
  17. AmesWeb, Metric clearance hole chart per ASME B18.2.8 (accessed 2026-10-26)
  18. AmesWeb, Metric tap drill chart (ISO coarse and fine) (accessed 2026-10-26)

More from the blog

  • tolerances
  • dimensional accuracy

Counterbore holes in 3D prints: sizes for socket head screws

Counterbore hole 3D print sizes: for M3, model 6.5 mm wide and 3.4 mm deep over a 3.4 mm hole. Tables for M2 to M8 and #4 to 1/4 in, and printing it face down.

  • tolerances
  • dimensional accuracy

3D print countersink: sizes for flat head screws and how to print them

3D print countersink sizes: 90° for metric and 82° for inch flat head screws, 0.2 mm over the head's sharp diameter. M3 socket: 6.92 mm over a 3.4 mm hole.

  • tolerances
  • dimensional accuracy

3D print living hinge: thickness, length and filaments that last

A 3D print living hinge needs a web 0.4 to 0.6 mm thick, two or three layers. In a fold test, PP passed 1 million folds and PLA about 160. Sizes and settings.