Contact Sales & After-Sales Service

Contact & Quotation

  • 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.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

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:

FactorCNC MillingChemical Etching
Setup timeMinutes30+ minutes
Chemicals requiredNoneFerric chloride, developer
Environmental impactCopper dust (vacuum)Hazardous waste disposal
RepeatabilityExcellentVariable
Double-sided alignmentPrecise with pinsDifficult
DrillingIntegratedSeparate step
Resolution0.2mm traces typical0.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:

  1. Reading Gerber geometry (traces, pads, polygons)
  2. Calculating isolation paths around copper features
  3. Generating toolpath offsets based on bit geometry
  4. Creating G-Code motion commands with appropriate feeds/speeds
  5. Adding drilling operations from Excellon files
  6. Generating board outline cutout paths

What Files You Need

File TypeExtensionPurpose
Top copper.GTL, .gbrFront side traces
Bottom copper.GBL, .gbrBack side traces
Board outline.GKO, .GM1Cutout path
Drill file.DRL, .XLNHole locations and sizes
Top silkscreen (optional).GTOReference 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

  1. Launch FlatCAM
  2. Go to File → Open Gerber and select your copper layer
  3. Go to File → Open Excellon and load your drill file
  4. Import board outline Gerber if needed

Step 2: Generate Isolation Geometry

  1. Select your copper Gerber in the Project panel
  2. In the Selected tab, find “Isolation Routing”
  3. Set parameters:
    1. Tool dia: 0.2mm (typical for V-bit at 0.1mm depth)
    1. Width (# passes): 2-3 for adequate clearance
    1. Pass overlap: 0.15 (15% overlap between passes)
  4. Click Generate Geometry

Step 3: Create CNC Job from Geometry

  1. Select the generated geometry object
  2. In the CNC Job section, set:
    1. Cut Z: -0.1mm (isolation depth)
    1. Travel Z: 2mm (safe retract height)
    1. Feed Rate: 60-120 mm/min
    1. Spindle Speed: 10000-30000 RPM
  3. Click Generate

Step 4: Export G-Code

  1. Select the CNC job object
  2. Click Export G-Code
  3. Save with .nc or .gcode extension

FlatCAM Parameter Reference:

ParameterTypical ValueDescription
Tool diameter0.1-0.3mmEffective cut width at depth
Cut Z-0.05 to -0.15mmDepth into copper (1oz = 0.035mm)
Travel Z2-5mmSafe height for rapid moves
Feed Rate60-150 mm/minCutting speed
Spindle Speed10000-30000 RPMTool rotation speed
Passes2-4Number of isolation cuts
Pass overlap0.1-0.2Fraction 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.

Installation (Linux):

bash

sudo apt install pcb2gcode

Basic Usage:

bash

pcb2gcode –front=top_copper.gtl –back=bottom_copper.gbl \          –drill=board.drl –outline=board.gko

Sample millproject Configuration File:

# Gerber input filesfront=board_top.gtlback=board_bottom.gbldrill=board.drloutline=board.gko# Isolation routing parameterszwork=-0.1zsafe=2.0zchange=25.0mill-feed=100mill-speed=20000offset=0.1# Drilling parameterszdrill=-1.8drill-feed=50drill-speed=15000# Board cutout parameterscutter-diameter=1.0zcut=-1.8cut-feed=60cut-speed=15000cut-infeed=0.5# General settingsmetric=truemirror-absolute=true

pcb2gcode Key Options:

OptionDescription
–frontTop copper Gerber file
–backBottom copper Gerber file
–drillExcellon drill file
–outlineBoard outline Gerber
–zworkIsolation cut depth (mm)
–zsafeSafe travel height (mm)
–mill-feedIsolation feed rate (mm/min)
–mill-speedSpindle RPM for isolation
–offsetTool offset from copper edge
–extra-passesAdditional isolation passes
–voronoiEnable flood-fill isolation

Method 3: Using Line Grinder (Windows)

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:

  1. Launch Line Grinder
  2. Add Gerber files via File Manager
  3. Assign layer types (copper, outline, drill)
  4. Configure tool parameters for each operation
  5. Generate isolation G-Code for copper layers
  6. Generate edge milling G-Code for outline
  7. Generate drilling G-Code from Excellon
  8. 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:

  1. Visit copper.carbide3d.com/rapidpcb
  2. Drag and drop your Gerber file
  3. Drag and drop your Excellon drill file
  4. Adjust isolation settings
  5. 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.

  1. Open your board in Eagle
  2. Run the pcb-gcode.ulp script
  3. Configure milling parameters
  4. 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 AngleDepth 0.05mmDepth 0.1mmDepth 0.15mm
10°0.009mm0.018mm0.026mm
20°0.018mm0.035mm0.053mm
30°0.027mm0.054mm0.080mm
45°0.041mm0.083mm0.124mm
60°0.058mm0.115mm0.173mm
90°0.100mm0.200mm0.300mm

Effective diameter formula:

Width = 2 × Depth × tan(Angle/2)

Tool Recommendations

Tool TypeBest ForTypical Specs
10° V-bitFine traces, SMD0.1mm tip, carbide
20° V-bitStandard traces0.1-0.2mm tip
30° V-bitGeneral use, durable0.1-0.2mm tip
60° V-bitWide isolation, rugged0.2mm tip
Flat end millCutouts, drilling0.8-1.0mm diameter
Drill bitsThrough holes, vias0.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

OperationSpindle SpeedFeed RateDepth per Pass
Isolation (V-bit)20,000-30,000 RPM60-150 mm/min0.05-0.15mm
Cutout (1mm end mill)15,000-20,000 RPM100-200 mm/min0.3-0.5mm
Drilling (0.8mm)15,000-20,000 RPM30-60 mm/min (plunge)Full depth

Adjusting for Your Machine

Machine TypeTypical Max RPMNotes
3018 Pro/Genmitsu10,000-12,000Reduce feed rate to compensate
Shapeoko10,000-30,000With router, use higher speeds
LPKF ProtoMat60,000-100,000Professional results
DIY spindleVariesMatch 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:

MethodDescription
Sacrificial bed surfacingMill the spoilboard flat with a large end mill
Auto-leveling probeUse Z-probe to map surface and compensate G-Code
Vacuum tableHolds board flat against machined surface
Double-sided tapeWorks 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:

  1. AutoLeveller (Windows) – Modifies G-Code based on probe data
  2. ChiliPeppr – Web-based with auto-level support
  3. bCNC – Built-in auto-leveling for GRBL machines
  4. Candle – Simple auto-level for GRBL

Double-Sided Board Registration

For double-sided boards, precise alignment is essential:

  1. Mill reference pin holes through the board
  2. Insert alignment pins (1-2mm dowels work well)
  3. Mill bottom side with board flipped
  4. 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

CauseSolution
Feed rate too highReduce to 60-80 mm/min
Spindle speed too lowIncrease if possible
Dull toolReplace with fresh carbide bit
Poor chip evacuationAdd vacuum or air blast

Problem: Traces Vary in Width Across Board

CauseSolution
Board not flatImplement auto-leveling
Spoilboard unevenSurface the spoilboard
Spindle not perpendicularCheck tramming
Tape allowing movementUse more tape or vacuum

Problem: Tool Breaking During Cut

CauseSolution
Plunge rate too fastReduce plunge to 30mm/min
Cut depth too aggressiveReduce to 0.05mm for fine bits
Runout in spindle/colletCheck and reduce TIR
Chip packing in cutImprove chip evacuation

Problem: Copper Not Fully Removed Between Traces

CauseSolution
Cut depth too shallowIncrease slightly (0.02mm increments)
Tool diameter wrong in softwareMeasure effective width at depth
Insufficient isolation passesAdd more passes
Board thickness variationUse auto-leveling

Resources and Download Links

CAM Software

SoftwarePlatformWebsite
FlatCAMWindows, Linux, macOSflatcam.org
pcb2gcodeLinux, Windows, macOSgithub.com/pcb2gcode/pcb2gcode
Line GrinderWindowsofitselfso.com/LineGrinder
Rapid PCBOnlinecopper.carbide3d.com/rapidpcb
PCB-GCodeEagle ULPpcbgcode.org
PCBConverterWindows, Linuxgithub.com/Nikolay-Kha/PCBConverter

CNC Control Software

SoftwareTypeWebsite
LinuxCNCFull controllerlinuxcnc.org
GRBLFirmwaregithub.com/grbl/grbl
CandleGRBL sendergithub.com/Denvi/Candle
bCNCGRBL sendergithub.com/vlachoudis/bCNC
ChiliPepprWeb-basedchilipeppr.com
Universal G-Code SenderCross-platformwinder.github.io/ugs_website

Tooling Suppliers

SupplierSpecialty
Precise BitsMicro end mills, V-bits
Think & TinkerPCB-specific tooling
Drillman (eBay)Budget carbide end mills
Amazon/AliExpressInexpensive 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • 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.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

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.