You can find it here standard and brand-specific G-codes and M-codes. Standard basic turning codes are hugely standardized. However, more complex machines like mill-turns and machines with sub-spindle can have extra and different codes. So always check specific machine code guides.
You can learn about how to read and write g-codes from here.
You can find G-Codes and M-Codes for milling from here.
Standard Common G-Codes for Turning
G-Code | Description | Possible Parameters |
---|---|---|
G00 | Rapid positioning | X, Z |
G01 | Linear interpolation | X, Z, F |
G02 | Circular interpolation, clockwise | X, Z, I, K, F |
G03 | Circular interpolation, counterclockwise | X, Z, I, K, F |
G04 | Dwell | P or X |
G20 | Programming in inches | None |
G21 | Programming in millimeters | None |
G28 | Return to home position | X, Z |
G32 | Threading | X, Z, F |
G40 | Cutter compensation off | None |
G41 | Cutter compensation left | D |
G42 | Cutter compensation right | D |
G70 | Finishing cycle | P, Q |
G71 | Rough turning cycle | U, R, K, P, Q |
G72 | Rough facing cycle | U, R, K, P, Q |
G90 | Absolute programming | None |
G92 | Threading cycle | X, Z, P, Q, F |
G94 | Feedrate per minute | F |
G95 | Feedrate per revolution | F |
Standard Common M-Codes for Turning
M-Code | Description | Possible Parameters |
---|---|---|
M00 | Program stop, take a bow | None |
M01 | End of the program, the final curtain | None |
M02 | The spindle start, clockwise | None |
M03 | Call the subprogram, summon the spirits | S (speed) |
M04 | End of the program with reset, a standing ovation | S (speed) |
M05 | Spindle stop, rest the wheel | None |
M06 | Tool change, switch the wand | T (tool number) |
M08 | Coolant on, quench the thirst | None |
M09 | Coolant off, dry the brow | None |
M30 | The spindle starts, counterclockwise | None |
M41 | Low gear range, tread lightly | None |
M42 | High gear range, full steam ahead | None |
M98 | End of the subprogram, spirits be gone | P (program number), L (number of repeats) |
M99 | End of subprogram, spirits be gone | None |
Brand Specific G-Codes, M-Codes for Turning
Mazak G-Codes (Turning)
G-Code | Description |
---|---|
G12.1 | Polar coordinate interpolation mode on |
G13.1 | Polar coordinate interpolation mode off |
G22 | Stored stroke limit on |
G23 | Stored stroke limit off |
G31 | Skip function |
G35 | Coordinate system rotation on |
G36 | Coordinate system rotation off |
G68 | Mirror image on |
G69 | Mirror image off |
G135 | Cylindrical interpolation cancel |
G136 | Cylindrical interpolation (X-axis) |
Mazak M-Codes (Turning)
M-Code | Description |
---|---|
M26 | Spindle gear range change, high gear |
M27 | Spindle gear range change, low gear |
M30 | End of the program with a return to start |
M36 | Automatic door open |
M37 | Automatic door close |
M38 | Chip conveyor forward |
M39 | Chip conveyor reverse |
M48 | Cancel override |
M49 | Enable override |
M97 | Local subprogram call |
M98 | Call external subprogram |
M99 | End of subprogram |
Siemens G-Codes (Turning)
G-Code | Description |
---|---|
G70 | Finishing cycle |
G71 | Longitudinal turning cycle |
G72 | Face turning cycle |
G73 | Pattern repeating cycle |
G74 | Face grooving or drilling |
G75 | Outer/internal longitudinal grooving |
G76 | Fine boring cycle |
G96 | Constant cutting speed on |
G97 | Constant cutting speed off |
Siemens M-Codes (Turning)
M-Code | Description |
---|---|
M17 | End of subprogram |
M21 | External M-function |
M22 | Spindle cooling on |
M23 | Spindle cooling off |
M25 | Release clamping device |
M26 | Engage clamping device |
M29 | High-speed spindle mode |
M30 | End of program with reset |
M38 | Chip conveyor on |
M39 | Chip conveyor off |
M50 | Override cancel |
M51 | Feedrate override |
M52 | Rapid traverse override |
M53 | Spindle override |
Fanuc G-Codes (Turning)
G-Code | Description |
---|---|
G20 | Programming in inches |
G21 | Programming in millimeters |
G22 | Stored stroke check on |
G23 | Stored stroke check off |
G40 | Cutter compensation cancel |
G41 | Cutter compensation left |
G42 | Cutter compensation right |
G50 | Set coordinate system |
G70 | Finishing cycle |
G71 | Turning cycle |
G72 | Facing cycle |
G73 | Pattern repeating cycle |
G74 | End face peck drilling cycle |
G75 | OD/ID grooving |
G76 | Fine boring cycle |
G92 | Threading cycle |
G94 | Feedrate per minute |
G95 | Feedrate per revolution |
Fanuc M-Codes (Turning)
M-Code | Description |
---|---|
M19 | Spindle orientation on |
M21 | Mirror image X-axis on |
M22 | Mirror image X-axis off |
M26 | Spindle gear range change |
M29 | High-speed spindle mode |
M41 | Low gear range |
M42 | High gear range |
M52 | Unload the last tool from the spindle |
M53 | Disable override |
M61 | Set constant surface speed |
M62 | Single direction positioning |
M64 | Tailstock forward |
M65 | Tailstock backward |