← How-Tos
cnc May 6, 2026 ◑ 3 views ◯ 7 min read

How to Mill PCBs with FlatCAM: Gerber Import to Isolation Routing G-Code

flatcampcb millingcncgerberisolation routingv bitdrillexcellondouble sidedcopper cladhowto

Introduction

FlatCAM is a free, open-source CAM program specifically designed for PCB milling. It takes Gerber and Excellon files from your PCB design software (KiCad, Eagle, EasyEDA) and generates isolation routing toolpaths, drilling toolpaths, and board outline cuts. Unlike general-purpose CAM software that requires manual toolpath creation, FlatCAM understands PCB terminology: traces, pads, vias, drills, soldermask, and silkscreen. It automatically calculates isolation routing paths that follow your trace geometry with precise kerf compensation. This guide covers the complete PCB milling workflow: importing Gerbers, generating isolation toolpaths, handling double-sided boards with alignment, drilling, and cutting out the finished board.

What You Need

Step 1: Export Gerbers from KiCad

In KiCad PCB Editor:

  1. File > Fabrication Outputs > Gerbers
  2. Select these layers:
  1. Set format: 4.6 trailing (standard)
  2. Set output directory
  3. Click Plot
  4. File > Fabrication Outputs > Drill Files
  5. Generate Excellon drill file (.drl)

Step 2: Import into FlatCAM

  1. Launch FlatCAM.
  2. File > Open Gerber > Select your F.Cu.gbr file.
  3. The top copper layer appears on the canvas. Traces are shown in color, the board outline as a rectangle.
  4. File > Open Excellon > Select your .drl file.
  5. Drill holes appear as circles.
  6. File > Open Gerber > Select Edge.Cuts.gbr (for board outline).

Project organization:

FlatCAM lists all imported files in the Project panel on the right. Double-click a file to view its properties.

Step 3: Generate Isolation Routing Toolpath

Isolation routing cuts a gap around each trace, electrically isolating it from the surrounding copper.

  1. Select the F.Cu Gerber in the Project panel.
  2. Go to the Selected tab (below the project panel).
  3. Under Isolation Routing, set parameters:
  1. Click Generate Geometry
  2. FlatCAM calculates the isolation paths around all traces
  3. The geometry appears as red lines on the canvas

Understanding the toolpath:

The red lines show where the tool will travel. Each pass widens the gap around traces. Multiple passes ensure no copper bridges remain between adjacent traces.

Step 4: Convert Geometry to CNC Job (G-Code)

Geometry is the path definition. A CNC Job adds feed rates, spindle speeds, and Z movements.

  1. Select the generated isolation geometry in the Project panel.
  2. In the Selected tab, click Generate under the CNC Job section.
  3. Set parameters:
  1. Click Generate
  2. The CNC Job appears in the project panel
  3. Double-click the CNC Job to preview the G-code

Step 5: Generate Drill Toolpaths

  1. Select the Excellon drill file in the Project panel.
  2. In the Selected tab, set drill parameters:
  1. Click Create Drills
  2. FlatCAM generates drill points at each hole location
  3. For multiple drill sizes, generate separate CNC jobs for each tool diameter

Step 6: Generate Board Outline Toolpath

  1. Select the Edge.Cuts Gerber in the Project panel.
  2. Click Generate Geometry (follow)
  3. Set the tool: use a 1-2 mm end mill for the outline cut
  4. Set Cut Z: -1.8 mm (through the 1.6 mm board, into the spoilboard slightly)
  5. Set Feed Rate X-Y: 300-500 mm/min
  6. Generate the CNC Job

Step 7: Export G-Code

  1. For each CNC Job (isolation, drills, outline), select it in the Project panel.
  2. Click Export G-Code (save as .nc or .tap file).
  3. Save each operation as a separate file, or combine them into one file with tool changes.

Combined file order:

  1. Isolation routing (V-bit)
  2. Drilling (drill bits, largest to smallest)
  3. Board outline (end mill)

Step 8: Double-Sided Board Alignment

Double-sided boards require flipping the board and aligning the bottom layer precisely.

Method 1: Alignment Holes

  1. Design two or three alignment holes (3 mm diameter) at the corners of your board in KiCad.
  2. Drill these holes first on the top side.
  3. Insert pins (3 mm drill bits or dowels) into the holes to register the board.
  4. Flip the board over. The pins ensure perfect alignment.
  5. Run the bottom copper isolation routing.

Method 2: Edge Alignment

  1. Cut the board outline first, keeping the board attached with tabs.
  2. Use the straight edges of the board as alignment references.
  3. Flip and clamp against a fence or corner fixture.

Method 3: Camera Alignment (if available)

  1. Some CNC setups include a camera mounted on the spindle.
  2. Mark alignment points on the board.
  3. Use the camera to align the bottom toolpath to the flipped board.

Step 9: Physical Setup on the CNC

Secure the PCB:

Set Z-zero precisely:

  1. Jog the tool to approximately where you want to start.
  2. Lower the tool until it just touches the copper surface.
  3. Use a multimeter in continuity mode: one probe on the tool, one on the copper. When the beep sounds, the tool is touching.
  4. Set Z=0 at this position.
  5. Alternatively: use a Z-probe or the paper method (slide paper under tool, lower until paper drags).

Surface leveling (critical for fine traces):

PCB copper is thin (0.035 mm). Any variation in board flatness causes uneven cutting depth.

  1. Use a spoilboard that has been surfaced flat.
  2. For best results, use auto bed leveling (if your CNC supports it).
  3. Alternatively: mill a shallow pocket in a waste board, seat the PCB into the pocket.

Step 10: Run the G-Code

  1. Load the isolation routing G-code first.
  2. Run at conservative speeds on the first attempt.
  3. Inspect the traces with a magnifying glass or microscope.
  4. Check for:
  1. Run the drill file.
  2. Run the outline cut.

Troubleshooting PCB Milling

Tips for PCB Milling Success

Conclusion

FlatCAM transforms PCB milling from a manual, error-prone process into a streamlined CAM workflow. By importing Gerber files directly, calculating isolation paths automatically, and generating toolpaths optimized for V-bits and engraving tools, FlatCAM eliminates the guesswork from PCB prototyping. The key to success is precise Z-zero setting, flat board mounting, sharp tools, and conservative feed rates. With practice, you can produce two-layer PCBs with 0.5 mm traces in under 30 minutes — no chemical etching, no exposure box, no photoresist. For rapid PCB prototyping, CNC milling with FlatCAM is the fastest path from design to physical board.