Full G-code list
Sorted by number. Each code links to its page with the syntax per control, an example and common mistakes.
| Code | What it does | Machine |
|---|---|---|
| G00 | Quick positioning | Mill, Lathe, Mill-turn |
| G01 | Linear interpolation | Mill, Lathe, Mill-turn, Laser |
| G02 | Hourly circular interpolation | Mill, Lathe, Mill-turn |
| G02.1/G03.1 | Spiral interpolation (circular threading B) | Mill, Lathe, Mill-turn |
| G02.2/G03.2 | Involute interpolation | Mill, Mill-turn |
| Mitsubishi G02.3/G03.3 | Exponential interpolation | Mill, Mill-turn |
| G03 | Counterclockwise circular interpolation | Mill, Lathe, Mill-turn |
| G04 | Timed dwell | Mill, Lathe, Mill-turn |
| G05/G05.1 | High speed / AI contour | Mill, Mill-turn |
| G5/G5.1/G5.2 | Splines and NURBS | Mill, Mill-turn |
| G05.4 | HRV3/HRV4 on/off | Mill, Mill-turn |
| G06.2 | NURBS interpolation | Mill, Mill-turn |
| G07 | Hypothetical axis interpolation | Mill, Lathe, Mill-turn |
| G7/G8 | Diameter/radius mode around lathe | Lathe, Mill-turn |
| Mitsubishi G07.1/G107 | Cylindrical interpolation | Mill, Lathe, Mill-turn |
| G08/G09 | Smoothing and block-wise exact stop | Mill, Lathe, Mill-turn |
| G10 | Offset writing | Mill, Lathe, Mill-turn |
| Mitsubishi G10/G11 | Programmable data input | Mill, Lathe, Mill-turn |
| Fanuc G10.6/G10.8/G10.9 | Retraction, internal data and diameter/radius | Mill, Lathe, Mill-turn |
| G12/G13 | Circular pocket | Mill, Mill-turn |
| Fanuc G12.1/G13.1 | Lathe polar interpolation | Lathe, Mill-turn |
| Mitsubishi G12.1/G13.1 | Polar interpolation | Lathe, Mill-turn |
| Haas G14/G15 | Lathe subspindle transfer | Lathe, Mill-turn |
| G15/G16 | Polar coordinates | Mill, Mill-turn |
| Okuma G15 H | Okuma offset selection | Mill, Mill-turn |
| G17/G18/G19 | Plane selection | Mill, Lathe, Mill-turn |
| G20/G21 | Units inches/millimeters | Mill, Lathe, Mill-turn |
| G22/G23 | Programmed stroke limits | Mill, Lathe, Mill-turn |
| G25/G26 | Spindle speed fluctuation detection | Mill, Lathe, Mill-turn |
| G27 | Reference return check | Mill, Lathe, Mill-turn |
| G28/G30 | Return to reference | Mill, Lathe, Mill-turn |
| Fanuc G29/G30.1/G30.2 | Advanced reference returns | Mill, Lathe, Mill-turn |
| G31 | Skip / probing | Mill, Lathe, Mill-turn |
| G32 | Simple lathe threading | Lathe, Mill-turn |
| G33/G33.1 | Synchronized tapping | Lathe, Mill-turn |
| G34 | Variable-lead threading | Lathe, Mill-turn |
| Haas G35/G36/G37 | Haas automatic measurement tool | Mill, Mill-turn |
| G36/G37 | Automatic tool measurement | Lathe, Mill-turn |
| G38.2-G38.5 | Advanced straight probing | Mill, Lathe, Mill-turn |
| G39 | Corner interpolation with offset | Mill, Lathe, Mill-turn |
| G40/G41/G42 | Radius compensation | Mill, Lathe, Mill-turn |
| G41.1/G42.1 | Dynamic radius compensation | Mill, Mill-turn |
| G41.2/G42.2 | 3D tool radius compensation (5 axes) | Mill, Mill-turn |
| G43/G49 | Length compensation | Mill, Mill-turn |
| G43.4/G43.5 | TCP/5-axis compensation | Mill, Mill-turn |
| G44 | Positive length compensation | Mill, Mill-turn |
| G45-G48 | Offset increment/decrement | Mill, Lathe, Mill-turn |
| Haas G47 | Text engraving | Mill, Lathe, Mill-turn |
| G50 | Lathe RPM limiter | Lathe, Mill-turn |
| G50.1/G51.1 | Programmable mirroring | Mill, Mill-turn |
| Fanuc G50.2/G51.2 | Polygon turning | Lathe, Mill-turn |
| Fanuc G50.3/G54.2 | Dynamic part and fixture preset | Mill, Lathe, Mill-turn |
| Fanuc G50.4-G51.6 | Synchronous, composite and overlapping control | Lathe, Mill-turn |
| G51/G50 | Scale/scale cancellation | Mill, Mill-turn |
| G52/G92 | Local shift / preset | Mill, Lathe, Mill-turn |
| G53 | Movement in machine coordinates | Mill, Lathe, Mill-turn |
| G54-G59 | Part zero | Mill, Lathe, Mill-turn |
| G54.1 | Extended offsets | Mill, Lathe, Mill-turn |
| G54.4 | WSEC part position error compensation | Mill, Mill-turn |
| G60 | Single-direction positioning | Mill, Lathe, Mill-turn |
| G61/G64 | Exact stop and continuous mode | Mill, Lathe, Mill-turn |
| G62/G63 | Automatic override/threading mode | Mill, Lathe, Mill-turn |
| G65 | Macro call | Mill, Lathe, Mill-turn |
| G66/G67 | Modal macro and cancellation | Mill, Lathe, Mill-turn |
| G66.1 | Modal macro B call | Mill, Lathe, Mill-turn |
| G68/G69 | Coordinate rotation | Mill, Mill-turn |
| Fanuc G68.3/G68.4 | Advanced inclined plane | Mill, Mill-turn |
| G70/G71/G72/G73 | Lathe roughing and finishing family | Lathe, Mill-turn |
| Haas G70/G71/G72 mill | Haas hole patterns | Mill, Mill-turn |
| G71 | Lathe roughing cycle | Lathe, Mill-turn |
| Okuma G71/G73/G75-G78 | Okuma lathe cycles | Lathe, Mill-turn |
| Fanuc G71.7-G76.7 | Modern .7 lathe cycles | Lathe, Mill-turn |
| Fanuc G72.1/G72.2 | Pattern repeat | Mill, Mill-turn |
| G73 | Fast pecking drilling | Mill, Mill-turn |
| G74 fresado | Reverse tapping / special milling cycle | Mill, Mill-turn |
| G74/G75 | Deep drilling and grooving on the lathe | Lathe, Mill-turn |
| G76 | Lathe threading cycle | Lathe, Mill-turn |
| Haas G77 | Back bore / flatting cycle | Mill, Lathe, Mill-turn |
| G80 | Cancel fixed cycle | Mill, Mill-turn |
| Fagor G81-G89 | Fagor drilling and tapping | Mill, Mill-turn |
| G81/G82/G83 | Drilling canned cycles | Mill, Mill-turn |
| G83.1 | Peck drilling high speed | Mill, Mill-turn |
| G84 | Rigid threading on a milling machine | Mill, Mill-turn |
| G84.2/G84.3 | Rigid threading format FS15 / left | Mill, Mill-turn |
| G85-G89 | Boring, reaming and hole cycles | Mill, Mill-turn |
| G86/G87/G88 | Special boring cycles | Mill, Mill-turn |
| G90 torno | Simple turning/taper cycle | Lathe, Mill-turn |
| G90/G91 | Absolute / incremental | Mill, Lathe, Mill-turn |
| G90.1/G91.1 | IJK absolute/incremental mode | Mill, Lathe, Mill-turn |
| G92 torno | Simple lathe threading cycle | Lathe, Mill-turn |
| G92.1/G92.2 | Cancel/suspend offset G92 | Mill, Lathe, Mill-turn |
| G93 | Inverse time feed | Mill, Mill-turn |
| G94 torno | Simple facing cycle | Lathe, Mill-turn |
| G94/G95 | Advance mode | Lathe, Mill, Mill-turn |
| G96/G97 | Constant speed / fixed RPM | Lathe, Mill-turn |
| G98/G99 | Return plane in canned cycles | Mill, Lathe, Mill-turn |
| Haas G100/G101 | Haas mirror image | Mill, Mill-turn |
| Haas G102 | Programmable RS-232 output | Mill, Mill-turn |
| Haas G103 | Limit look-ahead | Mill, Lathe, Mill-turn |
| Haas G105 | Servo bar command | Lathe, Mill-turn |
| Haas G107 | Cylindrical mapping | Mill, Mill-turn |
| Okuma G107 | OSP cylindrical interpolation | Lathe, Mill-turn |
| Haas G110-G129 | Legacy Haas extended offsets | Mill, Mill-turn |
| Haas G112/G113 | XY to XC for live tool | Lathe, Mill-turn |
| Haas G136 | Automatic center of origin measurement | Mill, Mill-turn |
| Haas G141 | 3D+ tool compensation | Mill, Mill-turn |
| Haas G143 | 5-axis length compensation | Mill, Mill-turn |
| Haas G150 | General pocket via subprogram | Mill, Mill-turn |
| Haas G153-G169 | Haas 5-axis canned cycles | Mill, Mill-turn |
| Haas G154 | Extended offsets P1-P99 | Mill, Lathe, Mill-turn |
| Haas G156/G167 | Broaching and setting modification | Mill, Mill-turn |
| Haas G170/G171/G172 | Override radius/diameter lathe | Lathe, Mill-turn |
| Haas G174/G184 | Rigid non-vertical threading | Mill, Mill-turn |
| Haas G186 | Automatic door opening/closing | Mill, Lathe, Mill-turn |
| Haas G187 | Haas Smoothing/Precision Control | Mill, Mill-turn |
| Siemens G505-G599 | Siemens extended offsets | Mill, Lathe, Mill-turn |
01Modal and non-modal: why a G-code stays active
Almost all G-codes are modal: once written they stay active in the following blocks until another code from the same group replaces them. That is why after G01 you only need coordinates: the machine keeps cutting in a straight line. Non-modal codes only act in their own block, such as the G04 dwell, the G28 reference return or the G53 machine-coordinate move.
02Groups: only one per group at a time
G-codes are organised in groups and only one per group can be active: motion (G00, G01, G02, G03), plane (G17, G18, G19), absolute or incremental (G90, G91), units (G20, G21), cutter radius compensation (G40, G41, G42), tool length compensation (G43, G49), canned cycles (G73 to G89, cancelled with G80) and work offsets (G54 to G59). Writing two from the same group in one block is a classic mistake: the control keeps the last one or raises an alarm.
03Lathe and mill do not always mean the same
The same number can do different things depending on the machine. On a Fanuc lathe G71 is the roughing cycle, while on other controls G71 selects millimetres; on a lathe G50 limits rpm or sets coordinates and G90 can be a turning cycle; G96 and G97 (constant surface speed or fixed rpm) are almost lathe-only. Before copying a program between machines, check the control and the G-code system it uses.
04Every control adds its own
The ISO base is shared, but Fanuc, Haas, Siemens, Heidenhain, Fagor, Okuma and Mitsubishi add their own codes: pocket cycles, high-speed machining, 5-axis or probing. The list below also includes the manufacturer-specific G-codes we document, with the brand in front.
Frequently asked questions
What is a G-code?
It is a preparatory command in a CNC program: it sets the type of motion (rapid, linear, circular), the working plane, units, work offset, compensations or the canned cycle the machine will use in the following blocks.
What is the difference between G-codes and M-codes?
G-codes prepare and control tool motion; M-codes control auxiliary machine functions such as the spindle (M03, M05), coolant (M08, M09), tool change (M06) or end of program (M30).
Are G-codes the same on every machine?
The basic ones (G00, G01, G02, G03, G17, G54, G90…) are almost universal, but many change between lathe and mill and between controls. Always check your control manual before running a new program.
What is the difference between G00 and G01?
G00 moves in rapid to position, without cutting and without a programmed feed; G01 moves in a straight line cutting at feed F. Using G00 close to the part is one of the most common causes of crashes.
General reference: syntax and meaning change with the control, the machine builder and machine parameters. Check the official manual before running a program. Last updated: