G-Code Quick Reference
G-Codes (Preparatory)
| Code | Description | Example |
| G00 | Rapid positioning | G00 X1.0 Y2.0 Z0.5 |
| G01 | Linear interpolation (feed) | G01 X2.0 Y3.0 F10.0 |
| G02 | Circular interpolation CW | G02 X1.0 Y0 I0.5 J0 F8.0 |
| G03 | Circular interpolation CCW | G03 X1.0 Y0 I0.5 J0 F8.0 |
| G04 | Dwell | G04 P500 (500 ms) |
| G10 | Data setting (offsets) | G10 L2 P1 X0 Y0 Z0 |
| G17 | XY plane selection | G17 |
| G18 | XZ plane selection | G18 |
| G19 | YZ plane selection | G19 |
| G20 | Inch mode | G20 |
| G21 | Metric mode | G21 |
| G28 | Return to home position | G28 G91 Z0 |
| G40 | Cutter compensation cancel | G40 |
| G41 | Cutter compensation left | G41 D1 X1.0 F10.0 |
| G42 | Cutter compensation right | G42 D1 X1.0 F10.0 |
| G43 | Tool length compensation + | G43 H1 Z1.0 |
| G44 | Tool length compensation − | G44 H2 Z1.0 |
| G49 | Tool length compensation cancel | G49 |
| G53 | Machine coordinate system | G53 G00 Z0 |
| G54 | Work coordinate system 1 | G54 |
| G55 | Work coordinate system 2 | G55 |
| G56 | Work coordinate system 3 | G56 |
| G57 | Work coordinate system 4 | G57 |
| G58 | Work coordinate system 5 | G58 |
| G59 | Work coordinate system 6 | G59 |
| G80 | Cancel canned cycle | G80 |
| G81 | Drill cycle | G81 X1.0 Y1.0 Z-0.5 R0.1 F5.0 |
| G82 | Spot drill / counterbore (dwell) | G82 X1.0 Y1.0 Z-0.25 R0.1 P200 F4.0 |
| G83 | Peck drill cycle | G83 X1.0 Y1.0 Z-1.0 R0.1 Q0.15 F5.0 |
| G84 | Tapping cycle | G84 X1.0 Y1.0 Z-0.75 R0.1 F25.0 |
| G85 | Bore cycle (feed out) | G85 X1.0 Y1.0 Z-0.5 R0.1 F4.0 |
| G86 | Bore cycle (rapid out) | G86 X1.0 Y1.0 Z-0.5 R0.1 F4.0 |
| G90 | Absolute positioning | G90 |
| G91 | Incremental positioning | G91 |
| G92 | Set work coordinate offset | G92 X0 Y0 Z0 |
| G94 | Feed per minute | G94 F200 |
| G95 | Feed per revolution | G95 F0.010 |
| G96 | Constant surface speed | G96 S400 |
| G97 | Cancel CSS / direct RPM mode | G97 S1500 |
| G98 | Return to initial Z level | G98 |
| G99 | Return to R plane | G99 |
M-Codes (Miscellaneous)
| Code | Description |
| M00 | Program stop (unconditional) |
| M01 | Optional stop |
| M02 | End program |
| M03 | Spindle on — clockwise |
| M04 | Spindle on — counter-clockwise |
| M05 | Spindle stop |
| M06 | Tool change |
| M07 | Mist coolant on |
| M08 | Flood coolant on |
| M09 | Coolant off |
| M10 | Clamp |
| M11 | Unclamp |
| M19 | Spindle orient |
| M30 | End program and rewind |
| M48 | Enable feed/speed override |
| M49 | Disable feed/speed override |
| M98 | Call subprogram |
| M99 | Return from subprogram |
Address Codes
| Letter | Meaning |
| A | Rotary axis A |
| B | Rotary axis B |
| C | Rotary axis C |
| D | Tool diameter offset number |
| F | Feed rate |
| G | Preparatory function |
| H | Tool length offset number |
| I | Arc center offset in X |
| J | Arc center offset in Y |
| K | Arc center offset in Z |
| L | Loop count / repetitions |
| M | Miscellaneous function |
| N | Line (sequence) number |
| O | Program number |
| P | Dwell time / subprogram number |
| Q | Peck depth (drilling cycles) |
| R | Arc radius / retract plane |
| S | Spindle speed |
| T | Tool number |
| X | X-axis position |
| Y | Y-axis position |
| Z | Z-axis position |
Common Programming Patterns
Lathe-Specific G-Codes
| Code | Description |
| G70 | Finish cycle |
| G71 | Rough turning cycle |
| G72 | Rough facing cycle |
| G73 | Pattern repeat cycle |
| G74 | Peck drilling cycle (Z-axis) |
| G75 | Grooving cycle (X-axis) |
| G76 | Threading cycle (multi-pass) |
| G92 | Threading cycle (single pass) |
| G96 | Constant surface speed (CSS) |
| G97 | Direct RPM mode |
Disclaimer
The content on this page is provided for educational and quick-reference purposes only. It is not a substitute for manufacturer specifications, tooling documentation, or professional machining guidance. Always verify feeds, speeds, and tooling recommendations for your specific setup, machine, and material before machining. machref.com makes no warranty regarding the accuracy or completeness of this information. See our Terms of Service, Privacy Policy, and Accessibility Statement.