CNC File Optimizer

About & Help

What is this?

CNC File Optimizer converts 3D printer toolpath files into clean, optimized files suitable for CNC machines. 3D printer slicers often generate files with far more detail than a CNC machine needs — thousands of tiny line segments where a few smooth moves would do. This tool strips that excess, reducing file size and improving cut quality.

How it works

  1. Upload — Drag and drop your file or click to browse. Everything runs locally in your browser.
  2. Configure — Adjust optimization settings to match your CNC machine's capabilities.
  3. Download — Get your optimized file, ready for your CNC controller.

Privacy

Your files never leave your computer. All parsing and conversion happens entirely in your browser using JavaScript. Nothing is uploaded to any server.

Supported file types

The optimizer accepts all common G-code and CNC file formats. If your file isn't listed, try renaming it to .txt or .nc — the parser also detects G-code by content.

Category Extensions
3D Printer G-code .gcode .gco .gc .g
Generic CNC .nc .ngc .ncf .ncc .ncd .cnc .tap .eia .din .iso .min
Fanuc .fan .fnc
Siemens .mpf .spf
ShopBot .sbp
Roland .rol
Keller .knc
Heidenhain .hnc
Mazak .mpt
Mach .xpi
Other .plt .ptp .txt

G-code quick reference

Common commands you'll encounter in these files:

Command Description
G0Rapid move (non-cutting travel)
G1Linear move (cutting / feed rate)
G2 / G3Clockwise / counter-clockwise arc
G28Return to home position
G90Absolute positioning
G91Relative positioning
M3 / M4Spindle on (CW / CCW)
M5Spindle off
M30Program end
FFeed rate
SSpindle speed

Why optimize 3D printer files for CNC?

3D printer slicers (Cura, PrusaSlicer, etc.) generate toolpaths optimized for layer-by-layer FDM printing. When repurposed for CNC routing or milling, these files typically have issues:

  • Excessive point density — Thousands of tiny G1 segments where smooth arcs or longer lines would suffice. CNC controllers can bog down parsing millions of micro-moves.
  • Printer-specific commands — Temperature settings (M104/M109), fan control (M106/M107), and extrusion commands (E values) that are meaningless to a CNC machine.
  • Wrong coordinate precision — 3D printers commonly use 3-4 decimal places; many CNC machines only need 2-3.
  • Missing CNC essentials — No spindle start/stop, no tool changes, no safe retract heights.

This optimizer addresses these issues, producing clean files your CNC controller can process efficiently.

Tips

  • Always do a dry run (air cut) with any newly converted file before cutting material.
  • Check your CNC controller's documentation for the specific G-code dialect it supports.
  • Back up your original files before optimization — the original is not modified, but it's good practice.
  • If the optimizer doesn't recognize your file extension, rename it to .txt and try again.