G and M codes explained
Free training, on phone or computer, in 5 languages.
- G00 · Rapid move, without cutting, to the given point.
- G01 · Straight-line feed move at feed rate F, cutting.
- G02 · Clockwise arc (radius R or centre I J K).
- G03 · Counter-clockwise arc.
- G04 · Dwell: the machine waits (P in milliseconds or X in seconds).
- G17 · XY working plane (milling).
- G18 · ZX working plane (lathe).
- G20 · Dimensions in inches.
- G21 · Dimensions in millimetres.
- G28 · Return to the machine reference point (often “G91 G28 Z0” to clear Z first).
- G40 · Cancels tool radius compensation.
- G41 · Tool radius compensation, left of the profile.
- G42 · Tool radius compensation, right of the profile.
- G43 · Activates tool length compensation (H).
- G49 · Cancels tool length compensation.
- G54 · Work offset no. 1 (G55 to G59: offsets 2 to 6).
- G70 · Finishing cycle for the profile defined for G71 or G72.
- G71 · Rough turning cycle (passes along Z).
- G76 · Multi-pass threading cycle.
- G80 · Cancels the active drilling cycle.
- G81 · Simple drilling cycle (feed to Z, then rapid retract).
- G83 · Peck drilling (steps Q) to break and clear chips.
- G90 · Absolute positioning: relative to the work zero.
- G91 · Incremental positioning: from the current position.
- G94 · Feed in mm per minute.
- G95 · Feed in mm per revolution.
- G96 · Constant surface speed (S in m/min): the spindle speeds up as the diameter decreases.
- G97 · Fixed spindle speed (S in rpm).
- G98 · Milling: return to the initial plane after a cycle. Lathe: feed in mm per minute.
- G99 · Milling: return to the R plane after a cycle. Lathe: feed in mm per revolution.
- M00 · Program stop: the machine waits for a new cycle start.
- M01 · Optional stop (only if “optional stop” is on).
- M03 · Spindle on, clockwise.
- M04 · Spindle on, counter-clockwise.
- M05 · Spindle stop.
- M06 · Tool change (the chosen tool T goes into the spindle).
- M08 · Coolant on.
- M09 · Coolant off.
- M30 · End of program, rewind to the start.