G-code list: a complete list of common G-codes for CNC machining
- December 13, 2024
- Tony

G code is one of the most common CNC codes we use in the process of CNC machining centers. In this paper, we have compiled a list of common G code instructions and detailed analysis, of course, different manufacturers of different CNC systems may be slightly different, in the actual operation in the manual shall prevail.
1. G-code list
G-codes for CNC machining (including lathes and milling machines) are instructions used to control machine movements, cutting modes, coordinate systems, and more. The following is a list of common CNC machining G-codes.
Used to move a tool or table quickly to a target position.
Used for linear interpolation, usually for feed control during cutting.
Used for clockwise circular interpolation, usually for turning or milling circular paths.
Counterclockwise interpolation, usually used for turning or milling circular paths.
Used in delay instructions to pause program execution for a specified time.
Used for high precision interference interpolation control to ensure accurate paths.
Used for linear interpolation, usually for feed control during cutting.
Used to detect roundness deviations during machining.
For precise control of contour machining.
Used to stop the calculation of the current interpolation path, often used when it is necessary to stop feeding or cutting.
Used to enter specific parameters such as coordinate system, tool length, etc. settings.
Used to cancel the parameters set by G10.
Used for clockwise helical interpolation, usually used for turning threads.
For counterclockwise helical interpolation, typically used for turning threads.
Enables the automatic drilling function for drilling operations.
Cancel the automatic drilling control.
Used to set the direction of cutting during machining.
Selects the XY plane for machining, usually used to set the machining plane during milling.
Selects the ZX plane for machining, typically used to select the plane when machining on a lathe.
Selects the YZ plane for machining, suitable for specific types of lathes or milling machines.
Sets the programming unit to inches.
Sets programming units to millimeters.
Activates absolute coordinate programming mode.
Starts incremental coordinate programming mode.
Stops rotary motion to avoid accidental collisions.
Stops automatic tool compensation.
For automatic setting of the depth of cut.
For checking the correctness of the coordinate system.
Moves the tool or table to the machine home position.
Returns to the previous current position from the machine home position.
Returns to the preset second home position.
Enables the probe function for part size inspection or position detection.
Enables the control of the lathe for thread cutting.
To control the lathe for different types of thread cutting.
For variable pitch machining of threads.
Enables mirror image machining.
Used to enable single-step cutting for high-precision cutting.
To enable the auto-calibration function to correct the tool position.
Enables automatic tool compensation.
Enables high precision machining control mode.
Cancel the tool radius compensation function.
Enables tool radius compensation and places the tool on the left side of the machining path.
Enables tool radius compensation and places the tool on the right side of the machining path.
Enables positive tool length compensation.
Enables tool length compensation negative.
Enables the tool radius compensation increment setting.
Enables the tool radius compensation decrement setting.
Enables the Tool Radius Compensation Multiplier setting.
Enables the Tool Radius Compensation Decrement setting.
Cancels the tool length compensation.
Cancels the previously set tool parameters.
Enables proportional transformation of coordinates or dimensions during machining.
Sets the new working coordinate system.
Cancel the current working coordinate system setting.
Selects different working coordinate systems (up to 6).
For precise position control to ensure machining accuracy.
Enables single-step feed mode for precise control.
Automatically adjusts the feed rate to the machining requirements.
Enables high speed cutting mode.
Cancels the precision stop and resumes normal feed.
Calls a subroutine to repeat the operation.
Calls and executes a subroutine directly.
Cancels a call to a subroutine.
Enables the coordinate rotation function to change the machining direction.
Cancel the coordinate rotation function.
Enables the finishing cycle for fine machining.
Enables the roughing cycle for rough machining.
Enables the roughing cycle with return.
Enables a high speed roughing cycle.
Enables left hand thread cutting on the lathe.
Enables high speed thread cutting mode.
Enables fine turning cycle for high precision turning.
Enables cut-off machining mode.
Enables multiple cutting mode.
Enables automatic compensation mode.
Cancels the fixed cycle mode.
Enables the Drill Fixed Cycle, commonly used for drilling operations.
Enables the drill fix cycle with dwell.
Enables the deep hole drilling cycle.
Enables thread machining mode.
Enables the drill cycle with return.
Enables tapered hole machining mode.
Enables elevated drilling mode.
Enables the Incomplete Drilling mode.
Enables drill cycle mode with dwell.
Enables absolute programming mode where all coordinates are calculated with a fixed origin.
Enables incremental programming mode where all coordinates are relative to the current position.
Sets the origin position of the workpiece.
Enables reverse time feed mode, typically used for fine machining.
Enables normal feed mode for machining at feed rates per minute.
Enables feed per revolution mode, commonly used for lathe operation.
Enables constant surface speed control to maintain a constant cutting speed during machining.
Cancels the constant surface speed control and reverts to normal speed.
Returns to the initial position for cycle machining.
Returns to point R for subsequent machining.
The above list of common CNC machining G codes covers most lathe and milling machine programming needs.
Summary of G code
Through in-depth understanding and application of G code, CNC operators can greatly improve machining efficiency, ensure machining quality, and adapt to a variety of different machining needs.
Therefore, the mastery and application of CNC G-code is a basic skill in the CNC machining industry, any CNC machinist should pay attention to and constantly practice.