Designing and Embedding Magnets in 3D Printed Parts: Pocket Tolerances, Polarity, and Retention
This site's Gridfinity coverage mentions magnet-bottomed bins in passing, and the general design-rules guide covers tolerances and snap fits broadly, but embedding magnets specifically โ sizing the pocket, keeping polarity consistent across a batch of parts, and actually retaining the magnet long-term โ is its own small design discipline with its own failure modes. Done well, embedded magnets turn a 3D printed part into something that snaps together, mounts to a steel panel, or self-aligns without screws or clips. Done without attention to tolerance and retention, they're the first thing that falls out of the part within a week.
Press-In vs. Printed-In-Place
MethodHow it worksBest for Press-fit pocketPrint a slightly undersized pocket, press the magnet in after printing, often with a drop of CA glue or epoxyMost designs โ simplest to get right, easy to replace a magnet if it's ever damaged Print-in-place (pause and insert)Pause the print at a specific layer, drop the magnet into an open pocket, resume printing to cap it with more plasticFully sealed, tamper-resistant parts (no visible pocket or glue line); requires per-print manual intervention, not practical for batches Slot-and-cap (print two parts, insert, glue a cap)Print the main body with an open-sided pocket, insert the magnet, print or press-fit a separate thin cap piece over itBatch production without pausing every single print; slightly more design and assembly work per partPocket Sizing
Neodymium magnets are manufactured to tight tolerances, but FDM printers are not, and the pocket's final size depends heavily on wall count, line width, and whether the pocket is a "hole" (two walls, likely to shrink more) or an open-sided pocket (likely to print closer to nominal). As a starting point for a round neodymium disc magnet on a well-tuned printer:
- Diameter: add 0.1-0.15mm to the magnet's actual measured diameter for a snug press fit, or 0.2-0.3mm for one you want to drop in with a dab of glue rather than force. Always measure the actual magnet with calipers โ "6mm" neodymium discs are routinely closer to 5.9mm, and designing to the nominal spec instead of the measured part is the single most common cause of a sloppy fit.
- Depth: match the magnet's thickness plus 0.0-0.2mm depending on whether you want it slightly recessed (safer, won't scratch a mating surface) or flush.
- Print pocket walls with at least 2-3 perimeters regardless of the model's general wall count โ a thin-walled pocket is the part most likely to crack when the magnet is pressed in, especially in brittle materials like PLA at low infill.
- Orient the pocket opening in the XY plane where possible rather than relying on an overhang bridge to form the pocket's far wall โ a bridged pocket roof sags slightly, which quietly shrinks the usable depth and leaves the magnet sitting proud of where it was designed to sit.
Keeping Polarity Consistent
A single wrongly-flipped magnet in a batch of parts meant to snap together is a frustrating thing to discover after printing twenty of them. A few practical habits prevent it:
- Mark one face of every magnet before inserting it โ a permanent marker dot on the "north" (or whichever pole faces out) side, checked against a known reference magnet, removes any guessing during assembly.
- Design an asymmetric pocket (a small keyed notch, or simply a non-circular pocket) when the part absolutely must go in one orientation only โ this prevents a correctly-polarized magnet from being inserted rotated the wrong way in a design where that matters (e.g., a magnet with an off-center pocket for a label or logo).
- For mating pairs (lid and base, two halves of an enclosure), insert and test-fit magnets in both halves together before the glue sets, rather than assembling each half independently and discovering a mismatch at final assembly.
Retention: Why Magnets Fall Out
A magnet held purely by an interference fit in FDM plastic is relying on friction against a material that creeps (slowly deforms) under sustained stress, especially in PLA at anything above room temperature โ a part that fit snugly on day one can loosen over weeks, especially if it lives somewhere warm like a car dashboard mount or near a sunny window. For anything beyond a low-stakes fridge magnet, back up the press fit with a small drop of cyanoacrylate (CA) glue or a two-part epoxy around the magnet's edge before it's fully seated. Avoid super glue directly on bare neodymium in high-humidity environments long-term; the glue bond to the metal is the weak point, not the plastic pocket, when parts eventually do fail.
Material and Strength Considerations
PETG and ABS hold a press-fit magnet noticeably better than PLA over time, specifically because they resist creep better at room temperature and above โ a meaningful consideration for anything that'll sit in a hot car, near a window, or anywhere else that gets warm. For parts that need to resist being pulled apart with real force (a magnetic latch holding a lid shut, a tool-holder meant to survive being bumped), size the magnet for the actual holding force needed rather than defaulting to whatever disc magnet is on hand โ neodymium magnet strength scales with volume, and a magnet twice the diameter can hold dramatically more than double the force of a thin one.
Embedded magnets are a small design detail that make a 3D printed part feel considerably more finished โ self-aligning lids, modular storage that actually stays put, tool mounts that snap on and off cleanly. The difference between a magnet that stays embedded for years and one that works its way loose within a month almost always comes down to the handful of tolerance and retention details above, not the magnet itself.