# What kinds of gaps/tolerances should I use when designing pieces that fit together?

Let's say I'm modeling a simple box with a lid. Just as an example, we'll say the outer edge along the top of the box is 50 mm x 50 mm. With 3D modeling software, it's easy to build a lid for this box to surround the top with an inner edge size of also exactly 50 mm x 50 mm ...but this seems like a bad idea. Surely I'll want some kind of of gap, to ensure an easy on/off. An exact fit seems like it's asking for trouble.

• How much gap do we leave for this kind of thing?
• Is it related to nozzle size?
• I suppose it also matters how tightly you want to fit, though I expect in cases where a tight fit matters some kind of snap or clip would be used.
• Are draft prints with larger layer sizes useful for figuring this, or do the rough layers make things seem tighter than they'll be in a final print?
• There's always the "print and then file to fit" approach, but I wouldn't recommend it Commented Aug 7, 2018 at 12:45
• 0.4 mm is enough to fit the parts, 0.6 to get disassembled easily. Commented Apr 27, 2019 at 5:45
• It depends also on the slicer: Prusaslicer has XY shrinkage to compensate for it youtu.be/q8U2vaUdz-U?t=314
– FarO
Commented Sep 21, 2022 at 12:33

I use my clearance values according to my rule of thumb: 0.1 mm - to fit with some force, 0.2 mm - just fit edge to edge without force.

Examples:

1. 3 mm metal cylinder to be pressed into plastic part needs $$3\ mm+0.1\ mm*2=3.2\ mm$$ diameter printed hole (clearance from two sides)

2. 3 mm screw to fit into plastic part needs a hole bigger than $$3\ mm+0.2\ mm*2=3.4\ mm$$ that is 3.5 mm will be already good.

This is fully experimental but always worked for me on three different printers and both on PLA and ABS.

• While I agree with the numerical values, you need to keep in mind that printer's tollerance. Thicker Extrusion needs more tollerance. Commented Sep 7, 2018 at 4:51

Before we get into nozzle sizes and snap fits, let's start with the bigger picture. We need to use a common language for defining the parts.

• Allowance is a planned difference between a nominal or reference value and an exact value.
• Clearance is an allowance defining the intentional space between two parts.
• Interference is an allowance defining the intentional overlap between two parts.
• Tolerance is the amount of random deviation or variation permitted for a given dimension. How much error can the part tolerate and still function?

Let's use an example. We want a 5 mm pin to go into a 5 mm hole, and we want a loose fit between them.

We've said 5 mm, but which 5 mm is more important -- the 5 mm hole or the 5 mm pin? Let's say other people have 5 mm pins they want to use with our hole. In this case the pin dimension is out of our control, and therefore is more important for interoperability.

The loose fit is calling for clearance. Let's specify 0.2 mm so they're free to turn. We could add the 0.2 mm allowance to the hole, giving a 5.2 mm hole with a 5.0 mm pin; we could subtract the 0.2 mm allowance from the pin, giving a 5.0 mm hole with a 4.8 mm pin; or split the difference in any way we want, such as a 5.1 mm hole and a 4.9 mm pin. Because we specified the pin is more important, we'll add the allowance to the hole.

Now that we have defined our part, let's define other terms important to helping us understand the manufacturing process:

• Accuracy is the maximum dimensional variation between parts. (Another word might be repeatability.) Note that a machine cannot produce parts with a tighter tolerance than its accuracy.
• Precision is the size of the steps a machine is capable of. Precision is often confused with accuracy, but they are not the same thing.

Now we need to understand our machine's accuracy. The printer could print the pin larger than 5 mm or smaller than 5 mm. Or it could print the hole larger than 5 mm or smaller than 5 mm. To determine the printer's accuracy, we'll need to print some 5 mm pins and 5 mm holes and measure the differences between what we defined and what we printed. The difference between the largest and smallest measurements is our machine's accuracy. Be sure to measure the accuracy in the X, Y, and Z dimensions; a printer might have a difference between the X and Y axes that would affect the roundness of the parts. (If it's off, this can usually be adjusted in the machine's firmware through a calibration process.) Furthermore, we should test round parts, round holes, square parts, and square holes, as each printer can be different in how repeatable those parts are.

Let's say that the printer's measured accuracy for both round holes and round pins is +/- 0.2 mm.

Then, we move to clearance. What is the minimum gap between parts that still does the job, and what is the maximum acceptable gap? As the designer, it's up to you to decide. In this example we said we want a loose fit, so let's define a clearance of at least 0.2 mm between the pin and hole, but no more than 1.0 mm or the parts will fall out.

Since the machine's accuracy is +/-0.2 mm, the pin will be anywhere between 5.2 mm and 4.8 mm. The hole must therefore be the maximum pin size, 5.2 mm, plus clearance plus the accuracy of the hole. That gives the hole dimension as 5.6 mm +/-0.2 mm. The minimum tolerance condition would be a minimum-sized hole (5.4 mm) and a maximum-sized pin (5.2 mm), giving a 0.2 mm clearance; the maximum tolerance would be a maximum-sized hole (5.8 mm) and a minimum-sized pin (4.8 mm) giving a 1.0 mm clearance.

Note that a clearance of 1.0 mm is really sloppy. It might be way too loose for our application. We might think to tighten the tolerances to 0.05 mm in order to reduce the clearance. But we've noted that a machine can't produce a tolerance tighter than its accuracy. If the printer can't produce a part that meets our specified tolerances, we would need to find a different way to manufacture or finish the parts.

In the metalworking world, a common way to do this is to specify the parts to be initially manufactured with intentionally maximal material. This lets us start with a smaller hole and use a bore or a drill bit to open it up to a more precise and round hole. We can do the same thing with a pin, by starting with a thicker rod and turning or grinding it down to make it more smooth and round.

In the FDM 3D printing world, we can do the same kind of thing at the workbench. First, print the parts with an extra wall layer (or two). The extra thickness gives more material to remove while drilling it out, or grinding it down, without weakening the part too badly. After printing, run a drill bit through the hole to clean it up. Or spin the pin in a drill motor's chuck and grind it down with a loop of sandpaper.

Of course, any time you add a finishing operation, it's more labor-intensive and therefore more expensive. So this isn't something we want to do on every part, but we can consider it.

Notice that when you define parts this way you aren't starting with the nozzle diameter or layer height. Instead, you're allowing the nozzle diameter, layer height, belt stretch, and the sum of all the causes of variations to show up in the measured accuracy of the machine. Smaller nozzles, thinner layers, heated beds, slower speeds, or cooling fans may each contribute to improved accuracy, allowing you to print parts with tighter tolerances. But to make successful prints you need to factor in the cumulative impact of all the machine's options.

Once you've got the terminology, it will be much more clear how to factor in an allowance for half the width of the extruded material, which is a function of nozzle width, extrusion rate, and layer height.

Yes, some clearance is necessary. Even if you were machining perfect metal parts, you would want a clearance gap (and make an allowance for mis-alignment along the Z axis too, long joints can bind quite easily).

In addition to this, you need to make a small allowance for the walls bulging slightly under the extrusion pressure (layer height being less than the nozzle diameter).

Other factors to take into account are layer-change ooze (which often makes a small seam appear), and ripple effects resulting from acceleration. This means that even once you have tested the gap that a specific model requires on your printer, you can't rely on the same gap working perfectly when you design another model. If you require rotational symmetry in your fit, it will be harder to get a good tight joint to be reliable.

Sometimes a print-in-place design can give you a similar effect to a clip together design, but permitting a more positive retention

Short version: basically, this depends on your printer, make, model, type, state of maintenance, extruder, slicer settings, belt tension, play, friction, etc.

Long version: Basically your printer determines how accurate it prints; you can influence the accuracy a little by calibrating and fine tuning the printer. What regularly is done is to print calibration cubes of fixed size. Before you do that, you should read "How do I calibrate the extruder of my printer?"; this explains to calibrate the extruder. With a fine tuned extruder you could print those XYZ calibration cubes, or in your case create a box of e.g. 50 x 50 x 15 mm. When you measure the length and the width with a caliper, you will know how much the tolerances are for this print size. Eventually, you could change this by re-adjusting the steps per mm in the firmware of the printer, but this is not always a recommendation (as your steps per mm should be related to the mechanical layout of the used mechanism, e.g. the belt size and pitch in combination with the pulley and the stepper resolution).

Please also look into the answer of "How to make moving parts not stick together?"; this answer hints to printing a tolerance calibration model that uses diabolic shapes set apart from the outer object by several values for the offset between the pieces. When you print this you can find out what sort of tolerance works for you. Please do note that the tolerances on smaller parts may be different than the tolerances on larger parts.

The answer on your question thus depends on your 3D printing machine, but usually the tolerance values range in the few tenths of a millimeter. To enable a lid on top of a box like in your example, you need to keep the tolerance in mind when designing the lid. Usually an extra few tenths of a millimeter will do the trick, but if you make some test prints first you will know exactly.

To answer the question what the influence is of layer height on tolerance, I quote:

Load a 25 mm cube into your slicer and set the infill to 0%, perimeters to 1, and top solid layers to 0. You’ll also want to print it at a fine resolution – I chose 0.15 mm and it actualy did make a small (0.02 mm) difference in the wall thickness as opposed to 0.3 mm.

So yes the layer height has an effect, it is very little though.

An interesting read is "A Guide to Understanding the Tolerances of Your 3D Printer" from "matterhackers".

Furthermore, when you have calibrated the printer but still run into small deviations, is that most slicers will allow you to compensate for X and Y dimensions.

After printing 4 months, I've learned an answer for at least two situations, based on the geometry of the filament and nozzle. For this discussion, I'm using .1mm layers with a .4mm nozzle.

First is the basic box and lid, from my question. It's important to remember the shape of the nozzle opening is a circle, and therefore when extruding to open air you get a cylinder. But we don't extrude to open air. We subtly press the extruded filament into the build surface or previous layer. In that case, using my best ascii art, a cross section of an extruded line of filament has rounded edges that only approximate that .4mm nozzle size, like this:

(    )


And as you lay down several layers, the exterior edge of a printed part should look more like this:

(
(
(
(


where the outer edge of the curve actually protrudes slightly from the planned dimensions of the part. The question is, "how much"? My experience so far has been as much as 0.05 mm. And remember, you need to account for that for both the box part and the lid part. Additionally, when designing the lid, you need to account for this gap on both ends of each dimensional axis. That means a gap of as much as 0.2 mm could still be a nice, snug fit.

For the second scenario, let's say you have a pair of prints that will fit together. The base print includes an upward-pointing rod or cylinder, like a Lego piece, that will slot into a paired opening.

Now you need to create the matching cylinder opening in the upper part, and you need to know how big. The concern is the top of the opening, which has nothing but air below it to hold up the filament. For small gaps you might bridge the distance. For larger gaps you might use support material or hemisphere top.

Let's say you find those options difficult for this scenario, or perhaps other factors have you printing this part laying sideways. so instead of an opening for a cylinder sitting like a can of soup, you print the part as is the cylinder were laying on it's side.

Now we can consider the geometry of how the filament is laid down. With my example nozzle and layer dimensions, we realize your opening is not the precise circle indicated by the model. Instead, you have a grid pattern, like old 8-bit computer art. Worse, the width of each "pixel" is up to 4 times greater than the height.

With that in mind, the minimum extra space you need will be 1/2 of that 0.1 mm height, and the wrong situation could extend this to as much as 1/2 of the 0.4 mm filament width. And since this goes all the way around the part (on both sides) you need these distances twice. This is in addition to the ridging effect discussed for the box earlier. The result means your rounded part should look for between a gap between 0.3 mm and 0.5 mm, with additional gap space if you're designing a part you may want to scale at some point. Remember, though, that plastic is pliable and if push comes to (literal) shove, sandable. In practice I've done well near the lower end of that range.

My approach has always been that I'm going to lose material when I sand down the item to remove layer lines, so I generally print to exact fit, and then manually correct with sandpaper or a craft knife.

Since you said nozzle, I expect you mean FDM 3d printing. Typically you would use one (1) outline of gap between the parts. An outline is usually equal to the size of the nozzle. The corners of a 3d printed square object are rounded. The radius of that rounding would be half your nozzle diameter (i.e. the nozzle's radius). Also if there was any over extrusion occurring on the outline it the two parts would not fit within each other. This is of course assuming that they are being designed to easily come apart. Otherwise you can make them an exact fit if you intend to friction fit them together.

• 1 is playing it Safe. 0.5 nozzles is doable on a not too well calibrated printer. 0.25 nozzles is achieveable, 0.125 nozzles a wet dream with a 0.4mm nozzle. The 0.05mm gap ist a pain to get with a 0.2 mm nozzle, but just a PITA Commented Sep 7, 2018 at 4:57

I usually print a test cube with different wall thicknesses and calculate the average deviation. This I use as tolerance. However, I do not believe that many belt driven cartesian printers can perform much better than +/- 0.1 to 0.25 mm along the XY-axis. Consequently, I would suggest to use something between 0.1 to 0.25 mm. If it is more than 0.5 mm you have an issue with the mechanics.

• I have achieved a 0.05 with a 0.2mm nozzle on a straight line. With a 0.1mm nozzle, this would be a trivial task. Commented Sep 27, 2018 at 17:09
• Try it in a rect-wave pattern. This tests the mechanics. Commented Sep 28, 2018 at 8:26

Start with your nozzle width for a prototype. I made some 50-80 mm jars with screw-on lids using a 0.4 mm nozzle. I could get the threads to start using 0.15 \$slop parameter (BOSL2 scad library trapezoidal thread at pitch 5 or 6) but couldn't get past 1/4 turn. With 0.4$slop it turned loosely with just a little bit of play and tightened up nicely.

There are obviously a bunch of parameters that will affect the actual clearance, but nozzle width seems like an excellent rule of thumb for a draft.