LinuxCNC "G-Code" Quick Reference
Code Parameters Description
Motion(X Y Z A B C U V W apply to all motions)
G0Rapid Move
G1Linear Move
G2, G3I J K or R, PArc Move
G5I J P QCubic Spline
G5.1I JQuadratic Spline
G38.2 - G38.5Straight Probe
G33KSpindle Synchronized Motion
G33.1KRigid Tapping
G80 Cancel Canned Cycle
Canned cycles(X Y Z or U V W apply to canned cycles, depending on active plane)
G81R L (P)Drilling Cycle
G82R L (P)Drilling Cycle, Dwell
G83R L QDrilling Cycle, Peck
G84R L (P)Right-hand Tapping Cycle, Dwell
G73R L QDrilling Cycle, Chip Breaking
G74R L (P)Left-hand Tapping Cycle, Dwell
G85R L (P)Boring Cycle, Feed Out
G89R L (P)Boring Cycle, Dwell, Feed Out
G76P Z I J R K Q H L EThreading Cycle
Distance Mode
G90, G91Distance Mode
G90.1, G91.1Arc Distance Mode
G7Lathe Diameter Mode
G8Lathe Radius Mode
Feed Rate Mode
G93, G94, G95Feed Rate Mode
Spindle Control
M3, M4, M5SSpindle Control
M19Orient Spindle
G96, G97 S D Spindle Control Mode
M7, M8, M9Coolant Control
Tool Length Offset
G43 H Tool Length Offset
G43.1 Dynamic Tool Length Offset
G43.2 H Apply additional Tool Length Offset
G49 Cancel Tool Length Compensation
M0, M1Program Pause
M2, M30 Program End
M60Pallet Change Pause
G20, G21 Units
Plane Selection (affects G2, G3, G81…G89, G40…G42)
G17 - G19.1Plane Select
Cutter Radius Compensation
G40Compensation Off
G41,G42DCutter Compensation
G41.1, G42.1D LDynamic Cutter Compensation
Path Control Mode
G61 G61.1Exact Path Mode
G64P QPath Blending
Return Mode in Canned Cycles
G98Canned Cycle Return Level
Other Modal Codes
FSet Feed Rate
SSet Spindle Speed
TSelect Tool)
M48, M49Speed and Feed Override Control
M50P0 (off) or P1 (on)Feed Override Control
M51P0 (off) or P1 (on)Spindle Speed Override Control
M52P0 (off) or P1 (on)Adaptive Feed Control
M53P0 (off) or P1 (on)Feed Stop Control
G54-G59.3Select Coordinate System
Flow-control Codes
o subSubroutines, sub/endsub call
o whileLooping, while/endwhile do/while
o ifConditional, if/else/endif
o repeatRepeat a loop of code
o callCall named file
M70Save modal state
M71Invalidate stored state
M72Restore modal state
M73Save and Auto-restore modal state
Input/Output Codes
M62 - M65PDigital Output Control
M66P E L QWait on Input
M67TAnalog Output,Synchronized
M68TAnalog Output, Immediate
Non-modal Codes
M6TTool Change
M61QSet Current Tool
G10 L1P Q RSet Tool Table
G10 L10PSet Tool Table
G10 L11PSet Tool Table
G10 L2P RSet Coordinate System
G10 L20PSet Coordinate System
G28, G28.1Go/Set Predefined Position
G30, G30.1Go/Set Predefined Position
G53Move in Machine Coordinates
G52, G92Coordinate System Offset
G92.1, G92.2Reset G92 Offsets
G92.3Restore G92 Offsets
M101 - M199P QUser Defined Commands
Comments & Messages
; (…)Comments
(DEBUG,…)Debug Messages
(PRINT,…)Print Messages