Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.
How to Convert Gerber to G-Code for CNC Milling: Complete PCB Prototyping Guide
There’s something deeply satisfying about watching a CNC machine carve copper traces from a blank PCB. No chemicals, no waiting for boards to ship from overseas, and most importantly, instant gratification when you need a prototype right now. The key to making this work is converting your Gerber files to G-Code that your CNC understands. This guide covers everything you need to know about converting Gerber to G-Code for CNC milling, from software selection through optimal cutting parameters.
Why Mill PCBs on a CNC Machine?
Chemical etching has been the go-to method for DIY PCBs for decades, but CNC milling offers compelling advantages for prototyping:
Factor
CNC Milling
Chemical Etching
Setup time
Minutes
30+ minutes
Chemicals required
None
Ferric chloride, developer
Environmental impact
Copper dust (vacuum)
Hazardous waste disposal
Repeatability
Excellent
Variable
Double-sided alignment
Precise with pins
Difficult
Drilling
Integrated
Separate step
Resolution
0.2mm traces typical
0.15mm possible
The process is called “isolation routing” or “isolation milling” because we’re mechanically isolating copper traces by removing the copper between them rather than chemically dissolving unwanted copper.
Understanding the Gerber to G-Code Conversion Process
Gerber files describe your PCB as a series of geometric shapes, traces, and pads. G-Code tells your CNC machine where to move and how deep to cut. The conversion process involves:
Reading Gerber geometry (traces, pads, polygons)
Calculating isolation paths around copper features
Generating toolpath offsets based on bit geometry
Creating G-Code motion commands with appropriate feeds/speeds
Adding drilling operations from Excellon files
Generating board outline cutout paths
What Files You Need
File Type
Extension
Purpose
Top copper
.GTL, .gbr
Front side traces
Bottom copper
.GBL, .gbr
Back side traces
Board outline
.GKO, .GM1
Cutout path
Drill file
.DRL, .XLN
Hole locations and sizes
Top silkscreen (optional)
.GTO
Reference markings
Best Software to Convert Gerber to G-Code
Several capable tools exist for Gerber to G-Code conversion, ranging from fully-featured GUI applications to command-line powerhouses.
Method 1: Using FlatCAM (Recommended for Beginners)
FlatCAM is the most popular open-source tool for PCB isolation routing. It’s written in Python, runs on Windows, Linux, and macOS, and provides an intuitive visual interface for the entire workflow.
Key Features:
Visual preview of Gerber, Excellon, and generated G-Code
Multiple isolation passes for wider clearance
Board cutout with tabs to hold the PCB
Double-sided PCB support with mirroring
Customizable tool library
Step-by-Step FlatCAM Process:
Step 1: Import Your Files
Launch FlatCAM
Go to File → Open Gerber and select your copper layer
Go to File → Open Excellon and load your drill file
Import board outline Gerber if needed
Step 2: Generate Isolation Geometry
Select your copper Gerber in the Project panel
In the Selected tab, find “Isolation Routing”
Set parameters:
Tool dia: 0.2mm (typical for V-bit at 0.1mm depth)
Width (# passes): 2-3 for adequate clearance
Pass overlap: 0.15 (15% overlap between passes)
Click Generate Geometry
Step 3: Create CNC Job from Geometry
Select the generated geometry object
In the CNC Job section, set:
Cut Z: -0.1mm (isolation depth)
Travel Z: 2mm (safe retract height)
Feed Rate: 60-120 mm/min
Spindle Speed: 10000-30000 RPM
Click Generate
Step 4: Export G-Code
Select the CNC job object
Click Export G-Code
Save with .nc or .gcode extension
FlatCAM Parameter Reference:
Parameter
Typical Value
Description
Tool diameter
0.1-0.3mm
Effective cut width at depth
Cut Z
-0.05 to -0.15mm
Depth into copper (1oz = 0.035mm)
Travel Z
2-5mm
Safe height for rapid moves
Feed Rate
60-150 mm/min
Cutting speed
Spindle Speed
10000-30000 RPM
Tool rotation speed
Passes
2-4
Number of isolation cuts
Pass overlap
0.1-0.2
Fraction overlap between passes
Method 2: Using pcb2gcode (Command-Line Power)
pcb2gcode is a powerful command-line tool that offers excellent control and automation capabilities. It’s ideal for scripting and batch processing.
Line Grinder is a Windows-specific tool designed for reliable double-sided PCB production with excellent registration features.
Key Features:
Bed flattening G-Code generation
Reference pin drilling for alignment
X or Y axis board flipping
Visual plot view for verification
Highly configurable output
Step-by-Step Process:
Launch Line Grinder
Add Gerber files via File Manager
Assign layer types (copper, outline, drill)
Configure tool parameters for each operation
Generate isolation G-Code for copper layers
Generate edge milling G-Code for outline
Generate drilling G-Code from Excellon
Export all G-Code files
Method 4: Using Rapid PCB (Online Tool)
For quick conversions without installing software, Rapid PCB from Carbide 3D offers browser-based conversion:
Visit copper.carbide3d.com/rapidpcb
Drag and drop your Gerber file
Drag and drop your Excellon drill file
Adjust isolation settings
Download generated G-Code
This is particularly convenient for Nomad CNC users but works with any GRBL-compatible machine.
Method 5: Using PCB-GCode (Eagle ULP)
If you use Autodesk Eagle for PCB design, the PCB-GCode ULP generates G-Code directly from your board file without exporting Gerbers first.
Open your board in Eagle
Run the pcb-gcode.ulp script
Configure milling parameters
Generate G-Code files
Choosing the Right Cutting Tools
Tool selection dramatically affects your milling results. V-bits are most common for isolation routing because their geometry allows precise control of cut width through depth adjustment.
V-Bit Geometry and Effective Diameter
V-Bit Angle
Depth 0.05mm
Depth 0.1mm
Depth 0.15mm
10°
0.009mm
0.018mm
0.026mm
20°
0.018mm
0.035mm
0.053mm
30°
0.027mm
0.054mm
0.080mm
45°
0.041mm
0.083mm
0.124mm
60°
0.058mm
0.115mm
0.173mm
90°
0.100mm
0.200mm
0.300mm
Effective diameter formula:
Width = 2 × Depth × tan(Angle/2)
Tool Recommendations
Tool Type
Best For
Typical Specs
10° V-bit
Fine traces, SMD
0.1mm tip, carbide
20° V-bit
Standard traces
0.1-0.2mm tip
30° V-bit
General use, durable
0.1-0.2mm tip
60° V-bit
Wide isolation, rugged
0.2mm tip
Flat end mill
Cutouts, drilling
0.8-1.0mm diameter
Drill bits
Through holes, vias
0.6-1.0mm typical
Material Considerations:
Use carbide (tungsten) bits, not HSS
Titanium-coated bits last longer
FR4 glass fiber wears tools quickly
FR2/FR3 (paper-based) is gentler on tools
Optimal Feeds and Speeds for PCB Milling
Getting feeds and speeds right is crucial for clean traces and long tool life.
Recommended Starting Parameters
Operation
Spindle Speed
Feed Rate
Depth per Pass
Isolation (V-bit)
20,000-30,000 RPM
60-150 mm/min
0.05-0.15mm
Cutout (1mm end mill)
15,000-20,000 RPM
100-200 mm/min
0.3-0.5mm
Drilling (0.8mm)
15,000-20,000 RPM
30-60 mm/min (plunge)
Full depth
Adjusting for Your Machine
Machine Type
Typical Max RPM
Notes
3018 Pro/Genmitsu
10,000-12,000
Reduce feed rate to compensate
Shapeoko
10,000-30,000
With router, use higher speeds
LPKF ProtoMat
60,000-100,000
Professional results
DIY spindle
Varies
Match parameters to capability
Rule of thumb: Higher spindle speed = cleaner cuts, but watch for overheating. If your spindle is slow, reduce feed rate proportionally.
Critical Setup Steps for Success
Bed Leveling and Surface Flatness
PCB isolation routing is extremely sensitive to Z-height variations. Copper on standard FR4 is only 0.035mm (1oz) thick, so even small variations in surface flatness cause inconsistent results.
Solutions:
Method
Description
Sacrificial bed surfacing
Mill the spoilboard flat with a large end mill
Auto-leveling probe
Use Z-probe to map surface and compensate G-Code
Vacuum table
Holds board flat against machined surface
Double-sided tape
Works for small boards, check for air pockets
Auto-Leveling with Probing
Many hobbyist setups use auto-leveling software that probes the board surface at multiple points and adjusts Z-height during cutting:
AutoLeveller (Windows) – Modifies G-Code based on probe data
ChiliPeppr – Web-based with auto-level support
bCNC – Built-in auto-leveling for GRBL machines
Candle – Simple auto-level for GRBL
Double-Sided Board Registration
For double-sided boards, precise alignment is essential:
Mill reference pin holes through the board
Insert alignment pins (1-2mm dowels work well)
Mill bottom side with board flipped
Pins ensure top/bottom copper alignment
Most CAM software can generate reference pin G-Code specifically for this purpose.
Troubleshooting Common Issues
Problem: Traces Have Rough or Burry Edges
Cause
Solution
Feed rate too high
Reduce to 60-80 mm/min
Spindle speed too low
Increase if possible
Dull tool
Replace with fresh carbide bit
Poor chip evacuation
Add vacuum or air blast
Problem: Traces Vary in Width Across Board
Cause
Solution
Board not flat
Implement auto-leveling
Spoilboard uneven
Surface the spoilboard
Spindle not perpendicular
Check tramming
Tape allowing movement
Use more tape or vacuum
Problem: Tool Breaking During Cut
Cause
Solution
Plunge rate too fast
Reduce plunge to 30mm/min
Cut depth too aggressive
Reduce to 0.05mm for fine bits
Runout in spindle/collet
Check and reduce TIR
Chip packing in cut
Improve chip evacuation
Problem: Copper Not Fully Removed Between Traces
Cause
Solution
Cut depth too shallow
Increase slightly (0.02mm increments)
Tool diameter wrong in software
Measure effective width at depth
Insufficient isolation passes
Add more passes
Board thickness variation
Use auto-leveling
Resources and Download Links
CAM Software
Software
Platform
Website
FlatCAM
Windows, Linux, macOS
flatcam.org
pcb2gcode
Linux, Windows, macOS
github.com/pcb2gcode/pcb2gcode
Line Grinder
Windows
ofitselfso.com/LineGrinder
Rapid PCB
Online
copper.carbide3d.com/rapidpcb
PCB-GCode
Eagle ULP
pcbgcode.org
PCBConverter
Windows, Linux
github.com/Nikolay-Kha/PCBConverter
CNC Control Software
Software
Type
Website
LinuxCNC
Full controller
linuxcnc.org
GRBL
Firmware
github.com/grbl/grbl
Candle
GRBL sender
github.com/Denvi/Candle
bCNC
GRBL sender
github.com/vlachoudis/bCNC
ChiliPeppr
Web-based
chilipeppr.com
Universal G-Code Sender
Cross-platform
winder.github.io/ugs_website
Tooling Suppliers
Supplier
Specialty
Precise Bits
Micro end mills, V-bits
Think & Tinker
PCB-specific tooling
Drillman (eBay)
Budget carbide end mills
Amazon/AliExpress
Inexpensive V-bit sets
Frequently Asked Questions
What’s the minimum trace width I can mill reliably?
With a quality setup and auto-leveling, 0.2mm (8 mil) traces are achievable consistently. Some users push to 0.15mm with sharp 10° V-bits and careful calibration. For reliable results without heroic efforts, design with 0.25mm (10 mil) minimum traces and 0.3mm spacing.
Do I need auto-leveling for PCB milling?
For single-sided boards with simple designs, you might get acceptable results without it by carefully surfacing your spoilboard and using consistent material. For double-sided boards or designs with fine features, auto-leveling is nearly essential. The copper layer is so thin that even minor surface variations cause inconsistent isolation.
Can I use a hobby 3018 CNC for PCB milling?
Yes, the 3018-style machines work for PCB milling, though they have limitations. Their lower spindle speeds (typically 10,000-12,000 RPM) require slower feed rates to maintain cut quality. Rigidity can be an issue for precision work. Upgrade to a better spindle if you plan to do regular PCB work, and always use auto-leveling.
What depth should I set for isolation routing?
Start with 0.1mm (0.004″) for 1oz copper (0.035mm thick). This provides margin for variation while not being so deep that traces become too thin. With auto-leveling, you can reduce to 0.05-0.08mm for finer control. Watch your actual results and adjust in 0.02mm increments.
How do I handle boards with ground planes or large copper fills?
Large copper areas require special consideration. Options include: (1) Use the “voronoi” or flood-fill option in your CAM software to remove all exposed copper, (2) Add multiple extra passes with increasing offset to widen isolation, (3) Consider hybrid approach with chemical etching for large copper removal and milling for fine features, (4) Design ground pours with thermal relief and adequate spacing from traces.
Conclusion
Converting Gerber to G-Code for CNC milling opens up rapid PCB prototyping without chemicals or waiting for fab house shipments. While the initial learning curve involves understanding toolpath generation, feeds and speeds, and machine setup, the process becomes straightforward once you’ve dialed in your parameters.
Start with FlatCAM for its visual feedback and intuitive interface. Focus on getting your machine properly leveled and implement auto-probing if you’re serious about consistent results. Choose appropriate V-bits for your trace widths, and don’t be afraid to experiment with parameters on scrap material before committing to your actual board.
The satisfaction of designing a circuit and having a working PCB in your hands within the hour never gets old. Your CNC machine is waiting.
Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.