How to Embed Magnets in 3D Prints: Snap-Fit Everything
Once you start embedding magnets in your 3D prints, you will never go back to friction-fit lids, loose battery covers, or fiddly snap-fits that break after three uses. Magnets make everything better — modular tool organizers, snap-on lids, detachable cosplay armor, swappable game pieces, you name it.
I have been designing with embedded magnets for about two years now, and they have become one of my most-used design techniques. The satisfying snap of a magnetic closure elevates a 3D print from "hobby project" to "product" in a way that few other techniques can match.
Types of Magnets for 3D Printing
Not all magnets are equal. Here is what works best for different applications.
Neodymium (Rare Earth) Magnets
These are what you want for 99% of 3D printing projects. Neodymium magnets are incredibly strong for their size.
Common sizes for 3D printing:
| Size | Pull Force | Best For | |---|---|---| | 3mm x 2mm disc | ~0.3 kg | Small closures, indicator dials | | 6mm x 3mm disc | ~1.0 kg | General purpose, lids, panels | | 8mm x 3mm disc | ~1.5 kg | Medium assemblies, tool holders | | 10mm x 3mm disc | ~2.5 kg | Heavy-duty closures, mounting | | 6mm x 2mm x 2mm bar | ~0.4 kg | Slots, linear alignment |
I buy most of my magnets in bulk packs. These 6x3mm neodymium disc magnets are my workhorse — strong enough for most applications and small enough to fit in thin walls. For smaller projects, 3x2mm magnets disappear into prints without adding bulk.
Magnet Grades
Neodymium magnets come in grades like N35, N42, N52. Higher numbers mean stronger magnetic fields. For 3D printing:
- N35: Budget grade, fine for light-duty closures
- N42: Good all-around strength, my recommendation
- N52: Maximum strength, noticeably more powerful, costs more
The difference between N35 and N52 is about 50% more pull force. For critical applications where the magnet needs to hold weight or resist separation, spend the extra dollar for N52.
Temperature Ratings
Standard neodymium magnets start losing strength above 80°C and permanently demagnetize around 150°C. This matters if your print will be in a hot environment (car dashboard, near electronics, outdoor use in summer).
For high-temperature applications, look for magnets rated N42SH or N42H, which handle up to 120-150°C. High-temp neodymium magnets cost more but maintain their strength where standard grades fail.
Designing Magnet Pockets in CAD
The key to reliable magnet embedding is getting the pocket dimensions right. Too loose and the magnet falls out. Too tight and it will not seat fully, leaving a bump on the surface.
Pocket Sizing
For FDM printing, add clearance to the magnet dimensions:
- Diameter: Magnet diameter + 0.2mm (e.g., 6.2mm pocket for a 6mm magnet)
- Depth: Magnet thickness + 0.1mm (e.g., 3.1mm pocket for a 3mm magnet)
This gives a press fit — the magnet pushes in with slight resistance and stays put without adhesive in most cases. However, I always recommend adding a drop of superglue for insurance.
If your printer is well-calibrated with tight tolerances, you might only need +0.1mm on diameter. Print a test pocket first to dial it in for your specific machine.
Pocket Design Tips
-
Chamfer the pocket opening. A small 0.5mm chamfer at the top of the pocket makes it much easier to push the magnet in. Without it, you are fighting the lip of the first layer.
-
Add a small hole at the bottom of the pocket. A 2mm hole through the bottom lets you push the magnet out from the back side if you need to remove or reposition it.
-
Make the pocket walls at least 1mm thick. Thinner walls crack when you press in the magnet or when the magnetic force pulls on them during use.
-
Leave 0.4-0.6mm of plastic above the magnet if you want it fully enclosed. This thin layer prints over the magnet pocket and creates a smooth surface while still allowing magnetic attraction through the plastic.
According to the Prusa blog on designing with magnets, the optimal wall thickness above an embedded magnet is 1-2 layer heights — thin enough for strong magnetic attraction but thick enough to create a sealed surface.
Three Methods for Embedding Magnets
Method 1: Pause at Layer (Most Common)
This is the most popular method and the one I use most often.
- In your slicer, add a pause command at the layer where the magnet pocket is fully formed
- When the printer pauses, drop the magnet into the pocket
- Add a drop of superglue (optional but recommended)
- Resume the print — subsequent layers print over the magnet
In Bambu Studio / OrcaSlicer: Right-click on the layer slider → Add Pause
In PrusaSlicer:
Right-click on the layer slider → Add Custom G-code → M601
In Cura: Extensions → Post Processing → Modify G-Code → Add Pause at Height
The key is pausing at exactly the right layer. The pocket should be fully formed (all walls and bottom printed) but not yet covered by top layers. Calculate which layer this is based on your pocket depth and layer height.
Example: If your pocket is 3.1mm deep and you are printing at 0.2mm layer height, the pocket takes about 15.5 layers (round to 16). If the pocket starts at layer 20, you pause at layer 36.
Method 2: Design a Lid
Instead of pausing the print, design the part in two halves:
- Print the bottom half with open magnet pockets
- Insert magnets with superglue
- Print a top cap or lid that glues onto the bottom half, enclosing the magnets
This is slower but removes the need for precise pause timing. It also lets you verify magnet polarity before sealing everything up.
Method 3: Post-Print Insertion
Design open-top pockets and simply press magnets in after printing. This is the simplest method and works great when the magnet does not need to be fully enclosed.
- Apply a drop of thick superglue into the pocket
- Press the magnet in firmly
- The superglue bonds the magnet to the PLA and prevents it from pulling out under magnetic force
I use this method for everything where the magnet pocket will not be visible — like the inside of a box lid or the back of a wall-mounted item.
The Polarity Problem (And How to Solve It)
This is the number one issue that ruins magnet projects. If you insert even one magnet with the wrong polarity, the mating parts will repel instead of attract. And once the magnet is glued in or printed over, you cannot fix it without reprinting.
My Polarity System
-
Mark every magnet before inserting. I use a Sharpie to put a dot on the north face of every magnet in a project. This takes 30 seconds and saves hours of frustration.
-
Use a reference magnet. Keep one marked reference magnet nearby. Before inserting any magnet, test it against the reference to confirm orientation.
-
Think about which faces need to attract. In a two-part assembly, the mating faces need opposite poles. So if Part A has the north face up, Part B needs the south face up.
-
Build a polarity jig. For production runs, I 3D print a small jig with embedded magnets in the correct orientation. When placing magnets in the actual part, I stack them on the jig first — they automatically orient correctly.
As discussed on the Printables forum for magnet embedding, the most reliable method is to stack all magnets for one side of the assembly in a column, mark the top faces, then stack all magnets for the other side in a column touching the first — they will automatically orient as mirror opposites.
Quick Reference: Polarity for Common Configurations
| Configuration | Part A Magnet | Part B Magnet | |---|---|---| | Snap-on lid | North up | South up | | Side-by-side alignment | North right | South left | | Magnet to steel | Either orientation | N/A (steel attracted to both) |
Magnet Alternatives: When Steel Works Better
For some applications, you only need a magnet on one side. The other side can be a steel disc, washer, or plate.
Advantages of magnet-to-steel:
- No polarity issues (steel is attracted to both poles)
- Cheaper (steel is much less expensive than neodymium)
- Easier to embed (a steel washer lies flat in a shallow pocket)
Small steel discs work perfectly for this. I use them in applications where I want one magnetic side (like a tool holder that sticks to a wall-mounted plate).
Practical Applications
Modular Storage
Design boxes, bins, and organizers with magnets that snap together. I have a modular desk organizer where every component magnetically attaches to every other component. Rearranging takes seconds.
Cosplay Armor
Embed magnets in armor plates and the underlying body suit attachment points. Armor snaps on and off without straps, Velcro, or clips. This is hugely popular in the cosplay community.
Board Game Accessories
Magnetic dice towers, snap-on terrain pieces, and modular game boards. The magnets keep everything in place during play but allow easy teardown.
Tool Organization
Wall-mounted panels with embedded magnets hold tools, bits, and accessories. Combined with steel or magnetic back plates, you get a fully customizable tool wall.
Cases and Enclosures
Magnetic closures for electronics enclosures, storage cases, and decorative boxes. No clips to break, no hinges to wear out.
Print Settings for Magnet Embedding
| Setting | Recommendation | Why | |---|---|---| | Layer height | 0.2mm | Good balance of speed and precision for pocket dimensions | | Walls | 3-4 | Structural integrity around magnet pockets | | Infill | 20%+ near magnets | Prevents pocket walls from flexing | | Top layers | 4+ above magnets | Ensures complete coverage over embedded magnets | | Material | PLA or PETG | Both work well; PETG is slightly more flexible for press fits |
Designing Better Magnet Assemblies
For model-specific advice on designing parts with embedded magnets, check out 3DSearch. The AI Settings feature can help you optimize print settings for parts with internal pockets and thin walls, ensuring your magnet cavities come out dimensionally accurate every time.
Troubleshooting
Magnet pulls out during use
- Pocket was too loose — tighten tolerances
- No adhesive was used — always add superglue
- Magnetic force exceeds the glue bond — use a stronger adhesive (epoxy) or a deeper pocket with mechanical retention
Print fails when printing over the magnet
- Magnet is attracting the nozzle — this happens with steel nozzles and strong magnets. Switch to a brass or hardened steel non-magnetic nozzle or increase the gap between the magnet top and the nozzle path
- Magnet is too tall — it is protruding above the pocket rim and the nozzle catches on it
Mating parts repel instead of attract
- Polarity is wrong — you will need to remove the magnet (drill it out or reprint) and insert it with the correct orientation
- Always test polarity before gluing or printing over
Magnets crack during insertion
- Neodymium magnets are brittle — do not hammer them in. Press gently or use a softer push tool
- Make the pocket slightly larger and rely on adhesive instead of press fit
Final Thoughts
Embedding magnets is one of those techniques that seems simple on the surface but opens up enormous design possibilities. Once you get comfortable with pocket sizing, polarity management, and the pause-at-layer workflow, you will start seeing magnetic solutions everywhere.
Start with a simple project — a magnetic lid for a small box. Get your tolerances dialed in, practice checking polarity, and build from there. Your designs will feel more professional, more functional, and more satisfying to use. That magnetic snap never gets old.
Search for related models on 3DSearch
Find 3D printable models across Printables, Thingiverse, and Cults3D in one search. Get AI-powered slicer settings for your printer.
Search 3DSearch →