G codes: Full list (Milling & Turning)
* Click the G Code to read the full explanation
Gcode | What it Does | Advanced | Mill | Turn |
---|---|---|---|---|
G00 | Linear Rapid Positioning (Rapid Traverse) | X | V | V |
G01 | Linear interpolation with Controlod Feed | X | V | V |
G02 | Circular Interpolation CW | X | V | V |
G03 | Circular Interpolation CCW | X | V | V |
G04 | Dwell (Time delay) | X | V | V |
G09 | Exact stop | X | V | V |
G10 | Modifies Work Coordinate Position | V | V | V |
G15 | Polar Coordinates Off | X | V | X |
G16 | Polar Coordinates On | X | V | X |
G17 | XY plane selection | X | V | X |
G18 | ZX plane selection | X | V | X |
G19 | YZ plane selection | X | V | X |
G20 | Input in inch | V | V | V |
G21 | Iinput in mm | V | V | V |
G22 | Stored Stoke Limit On | V | V | V |
G23 | Stored Stoke Limit Off | V | V | V |
G27 | Reference Point Return Check | V | V | V |
G28 | Return to reference point | X | V | V |
G29 | Return from reference point | V | V | V |
G30 | Return to alternate home position | V | V | V |
G31 | External skip function (Probe trigger) | V | V | V |
G33 | Thread cutting, constant lead | V | X | V |
G34 | Thread cutting, increasing lead | V | X | V |
G35 | Thread cutting, decreasing lead | V | X | V |
G40 | Tool compensation cancel | X | V | V |
G41 | Tool compensation left | X | V | V |
G42 | Tool compensation right | X | V | V |
G43 | Tool length compensation (+) | X | V | V |
G44 | Tool length compensation (-) | X | V | V |
G49 | Cancel tool length compensation | X | V | V |
G52 | Offset axis relative to 0 point | V | V | V |
G53 | Cancel Axsis Ofset | V | V | V |
G54 | Select coordinate system #1 | X | V | V |
G55 | Select coordinate system #2 | X | V | V |
G56 | Select coordinate system #3 | X | V | V |
G57 | Select coordinate system #4 | X | V | V |
G58 | Select coordinate system #5 | X | V | V |
G59 | Select coordinate system #6 | X | V | V |
G61 | Exact stop check mode | X | V | V |
G62 | Automatic corner overide | V | V | V |
G64 | Cancels Exact stop mode (G61) | X | V | V |
G65 | Macro Call | V | V | V |
G66 | Modal mode for Macro Call | V | V | V |
G67 | Cancel modal mode for Macro Call (G66) | V | V | V |
G68 | Coordinate syslaim rotation ON | V | V | X |
G69 | Coordinate syslaim rotation OFF | V | V | X |
G70 | Finishing Canned Cycle | V | X | V |
G71 | Rough Turning Canned Cycle | V | X | V |
G72 | Facing Cycle | V | X | V |
G73 | Peck drilling cycle | V | V | V |
G74 | Milling tapping cycle | V | V | X |
G74 | Lathe pecking drilling Cycle | V | X | V |
G75 | Lath Grooving canned cycle | V | X | V |
G76 | Lathe threading cycle | V | X | V |
G76 | Milling fine boring cycle | V | V | X |
G80 | Canned cycles cancelation | V | V | V |
G81 | Drilling cycle without dwell | V | V | X |
G82 | Drilling cycle with dwell | V | V | X |
G83 | Deep hole, peck drilling cycle | V | V | X |
G84 | Tapping cycle | V | V | X |
G85 | boring, no dwell, feed out | V | V | X |
G86 | boring, spindle stop, rapid out | V | V | X |
G87 | boring cycle with manual retraction | V | V | X |
G88 | Boring cycle with spindle stop | V | V | X |
G89 | Boring cycle with Dwell | V | V | X |
G90 | Absolute programing mode | X | V | V |
G91 | Incremental (Relative) progeaming mode | X | V | V |
G92 | Temporary Zero point | X | V | V |
G93 | Feedrate mode - Inverse time | V | V | X |
G94 | Feedrate mode - by time | V | V | X |
G95 | Feedrate mode - Per revolution | V | V | V |
G96 | Constant Surface Speed Control | X | V | V |
G97 | Constant Spindle Speed Control | X | V | V |
G98 | Return to initial point in canned cycle | V | V | X |
G99 | Return to reference point in canned cycle | V | V | X |
What is a G code?
G-code is the common name for the most widely used CNC programming language. It was developed in the 1950s at MIT. The language is very “primitive” by today’s standards. All the commands are represented by codes (G01, G02, etc..) and not by meaningful words. Variables are represented by numbers(#500, #151, etc..) and not by words; conditional logic is very limited. Amazingly this 70-year-old language is still the industry standard. Several tool manufacturers developed higher-end Wizard-like languages such as Mazak – Mazatrol or Okuma – AOT, but none of them gained very high popularity.
The target of the code is to control the movements of a computerized controlled machine. The code basically “tells” the machine in what path to move from one coordinate to the next (Called “Toolpath”), and at what speed (Called “Feedrate”).
G code syntax
Sample short program
N10 O1000;
N20 T05;
N30 G01 A10 X40 Z60 F1.0 S1000;
N40 M05;
What does each letter in the program mean?
G code Basic Syntax Letters
wdt_ID | Letter | Description |
---|---|---|
1 | G | Command Number. |
2 | X,Y,Z,A,B,C | Coordinates - Where to move next. |
3 | F | Feedrate - At what speed to move to the next coordinate. |
4 | S | Spindle Speed - At speed the spindle should be rotating. |
5 | I,J,K | Defines arc center for circulare interpolation commands (G02, G03) |
6 |
M Codes
“G” stands for Geometry; hence, the G-Code commands are responsible for the movements of the machine that create the geometry of the part. “M” stands for Machine (or Miscellaneous), and the M-Codes are responsible for Machine commands that cause particular operations of the equipment. Unlike G-codes, which can appear multiple times on the same line, M-Code is limited to one code per line.
List of M-codes
* Press ⊕ to read the full explanation
wdt_ID | CODE | ACTION | EXPLNATION |
---|---|---|---|
1 | M00 | Machine Stop | The Machine will stop the operation in the middle of the program |
2 | M01 | Optional stop | The machine will stop in the middle of the program only if the optional stop button is "On". |
3 | M02 | program End | End of Program |
4 | M03 | Spindle on CW direction | The spindle will start to rotate in CW direction at the speed given in the S parameter |
5 | M04 | Spindle on CCW direction | The spindle will start to rotate in CCW direction at the speed given in the S parameter |
6 | M05 | Spindle stop | The spindle will stop rotating |
7 | M06 | Automatic tool change (ATC) | The machine will change the tool and pick from the Turret/Magazine a new tool according to the "T" parameter |
8 | M07 | Mist (Shower) Coolant On | A spray of coolant fluid droplets |
9 | M08 | Flood Coolant On | An overflowing of coolant fluid. |
10 | M09 | Coolant off | Shut down the coolant (Both M07 & M08) |
11 | M30 | End of Program | The spindle will start to rotate in CW direction at the speed given in the S parameter |
12 | M41 - M44 | Gear selection | Select the gear suitable for the spindle speed (ON lathe Machines) |
13 | M48 | Feedrate override On | Operator feedrate overide is respected |
14 | M49 | Feedrate override Off | Operator feedreate override is ignored. |
15 | M98 | Subprogram call | Passes control to the subprogram number provided in parameter P |
16 | M99 | Subprogram end | Placed at end of the subprogram and returns the control to the main program one line after the line it was called from. |