CNC Lathe G-Code and M-Code Reference List for CNC Lathes (2024)

  • Mill G Code Guide
  • Turning G Codes
  • Fanuc Alarm Codes
  • GCode Simulator

These are the common g-codes for CNC Lathes and turning. Code categories are the groupings for the g-code Wizard (type Ctrl+G for the Wizard). Function tells what the g-code does, Notes gives a little more information such as the parameters, and Tutorial is a link (if any) to a g-code tutorial that uses G-Wizard Editor to teach how to use the g-code.

Code

Category

Function

Notes

Tutorials

G00

Motion

Move in a straight line at rapids speed. XYZ of endpoint G00 and MDI.

Linear Motion: G00 and G01

G01

Motion

Move in a straight line at last speed commanded by a (F)eedrate XYZ of endpoint G01 and MDI.

Linear Motion: G00 and G01

G02

Motion

Clockwise circular arc at (F)eedrate XYZ of endpoint

IJK relative to center

R for radius

Circular Arcs: G02 and G03
G03

Motion

Counter-clockwise circular arc at (F)eedrate XYZ of endpoint

IJK relative to center

R for radius

Circular Arcs: G02 and G03
G04

Motion

Dwell: Stop for a specified time. P for milliseconds

X for seconds

Precise Timing and Speed: Dwell, Exact Stop, Backlash Compensation
G09

Motion

Exact stop check Precise Timing and Speed: Dwell, Exact Stop, Backlash Compensation
G10

Compensation

Programmable parameter input
G17

Coordinate

Select X-Y plane Select X-Y plane
G18

Coordinate

Select X-Z plane Select X-Z plane
G19

Coordinate

Select Y-Z plane Select Y-Z plane
G20

Coordinate

Program coordinates are inches G20 and G21: Unit Conversion
G21

Coordinate

Program coordinates are mm G20 and G21: Unit Conversion
G27

Motion

Reference point return check G28: Return to Reference Point
G28

Motion

Return to home position G28: Return to Reference Point
G29

Motion

Return from the reference position G28: Return to Reference Point
G30

Motion

Return to the 2nd, 3rd, and 4th reference point G28: Return to Reference Point
G32

Canned

Constant lead threading (like G01 synchronized with spindle)
G40

Compensation

Tool cutter compensation off (radius comp.)
G41

Compensation

Tool cutter compensation left (radius comp.)
G42

Compensation

Tool cutter compensation right (radius comp.)
G43

Compensation

Apply tool length compensation (plus)
G44

Compensation

Apply tool length compensation (minus)
G49

Compensation

Tool length compensation cancel
G50

Compensation

Reset all scale factors to 1.0
G51

Compensation

Turn on scale factors
G52

Coordinate

Local workshift for all coordinate systems: add XYZ offsets
G53

Coordinate

Machine coordinate system (cancel work offsets)
G54

Coordinate

Work coordinate system (1st Workpiece)
G55

Coordinate

Work coordinate system (2nd Workpiece)
G56

Coordinate

Work coordinate system (3rd Workpiece)
G57

Coordinate

Work coordinate system (4th Workpiece)
G58

Coordinate

Work coordinate system (5th Workpiece)
G59

Coordinate

Work coordinate system (6th Workpiece)
G61

Other

Exact stop check mode Precise Timing and Speed: Dwell, Exact Stop, Backlash Compensation
G62

Other

Automatic corner override
G63

Other

Tapping mode
G64

Other

Best speed path
G65

Other

Custom macro simple call Subprograms and Macros
G70

Canned

Finish Turning Cycle
G71

Canned

Rough Turning Cycle G71: Rough Turning Cycle

G71 Type II: Rough Turning With “Pockets”

G72

Canned

Rough Facing Cycle
G73

Canned

Pattern Repeating Cycle
G74

Canned

Peck Drilling Cycle
G75

Canned

Grooving Cycle
G76

Canned

Threading Cycle G76 Lathe Threading Cycle
G80

Canned

Cancel canned cycle
G83

Canned

Face drilling cycle
G84

Canned

Face Tapping cycle
G86

Canned

Boring canned cycle, spindle stop, rapid out
G87

Canned

Side Drilling Cycle
G88

Canned

Side Tapping Cycle
G89

Canned

Side Boring Cycle
G90

Coordinate

Absolute programming of XYZ (type B and C systems) G90 and G91 Absolute vs Incremental Mode
G90.1

Coordinate

Absolute programming IJK (type B and C systems)
G91

Coordinate

Incremental programming of XYZ (type B and C systems) G90 and G91 Absolute vs Incremental Mode
G91.1

Coordinate

Incremental programming IJK (type B and C systems)
G92

Coordinate

Thread Cutting Cycle
G92 (alternate)

Motion

Clamp of maximum spindle speed S
G94

Motion

Endface Turning Cycle
G96

Motion

Constant Surface Speed ON G96: Constant Surface Speed
G97

Motion

Constant Surface Speed Cancel G96: Constant Surface Speed
G98

Motion

Feedrate per Minute G98 G-Code and G99 G-Code: Canned Cycle Return or Feedrate Modes
G99

Motion

Feedrate per Revolution G98 G-Code and G99 G-Code: Canned Cycle Return or Feedrate Modes
G190 Motion Radius mode CNC Lathe Programming
G191 Motion Diameter mode CNC Lathe Programming
CNC Lathe G-Code and M-Code Reference List for CNC Lathes (2024)

References

Top Articles
Latest Posts
Article information

Author: Trent Wehner

Last Updated:

Views: 5551

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Trent Wehner

Birthday: 1993-03-14

Address: 872 Kevin Squares, New Codyville, AK 01785-0416

Phone: +18698800304764

Job: Senior Farming Developer

Hobby: Paintball, Calligraphy, Hunting, Flying disc, Lapidary, Rafting, Inline skating

Introduction: My name is Trent Wehner, I am a talented, brainy, zealous, light, funny, gleaming, attractive person who loves writing and wants to share my knowledge and understanding with you.