Guide · Programming

How to Check a G-Code Program Before You Run It: 15 Common Mistakes

A practical routine for checking CNC programs: the 15 mistakes that cause most alarms and crashes, how to find them in minutes, and how to prove out the first part.

By cnccode · Updated
On this page
  1. The 15 mistakes
  2. A five-minute routine
  3. At the machine
  4. A safe start and end
  5. More guides
  6. Frequently asked questions

Most crashes are not caused by difficult geometry. They come from small things: a missing decimal point, the wrong H number, a G00 that should be a G01. The good news is that nearly all of them can be found at the desk.

The 15 mistakes

Dangerous

  1. G00 to a Z below the surface.
  2. G43 missing after a tool change, so the length of the tool is ignored.
  3. H number of another tool.
  4. G28 in G90 with X0 Y0 Z0, which first moves through work zero.
  5. Wrong work offset: G55 is active while the part sits in G54.
  6. Clearance plane lower than a clamp.

Alarm or scrap

  1. Coordinates without a decimal point. On many Fanuc controls X10 is 0.010 mm.
  2. Arc centre does not fit the end point.
  3. G41 without D, or started on an arc.
  4. G41 not cancelled before the tool change.
  5. Canned cycle still active because G80 is missing. Every following position gets a hole.
  6. Tapping feed does not equal RPM times pitch.
  7. Inch program on a metric control.
  8. S word missing after a tool change, so the last speed is used.
  9. Letter O instead of zero.

A five-minute routine

  1. Paste the program into the G-code checker and read every line it reports.
  2. Cut it in the mill or lathe simulator. Compare the shape with the drawing.
  3. Compare the tool list in the program with the tools in the machine: number, length, diameter.
  4. Read the first Z move of each tool aloud, including sign and decimal point.

At the machine

Shift the work offset up by a safe amount, for example 50 mm, and run the program in the air. Then run the real start of each tool with single block, 5 % rapid and a hand on feed hold. Watch the distance-to-go display. If the tool is 10 mm above the part and the display says 40 mm to go, stop.

A safe start and end

G-code
G21 G17 G40 G49 G80 G90
G91 G28 Z0.
G90
T1 M06
G54 G00 X0. Y0. S3000 M03
G43 H01 Z50. M08
(...)
M09
G91 G28 Z0.
M30

Frequently asked questions

Is a simulation enough?
No. A simulation knows only what you tell it. Real tool lengths, clamps and the work offset are set at the machine, so a careful first run is always needed.
Can I trust G-code written by ChatGPT?
Treat it like code from a beginner. It often looks right and contains one serious error. Check it, simulate it and run it in the air first.
Was this page helpful?