Reference

G-Code List — Every G-Code Explained with Examples

Complete G-code list for CNC mills and lathes (Fanuc, Haas, Mazak, Siemens ISO). Each code with syntax, parameters, example program and common mistakes.

All common G-codes for CNC mills and lathes, in the Fanuc/ISO dialect used by most controls. Click a code for syntax, parameters and a working example.

Fanuc listHaas listGRBL listSiemens SINUMERIK listM-codesPrintable cheat sheet

CodeFunctionGroupTypeMachine
G00Rapid Positioning01ModalBoth
G01Linear Interpolation (Feed Move)01ModalBoth
G02Circular Interpolation Clockwise01ModalBoth
G03Circular Interpolation Counter-Clockwise01ModalBoth
G04Dwell00One-shotBoth
G05.1AI Contour Control / High-Speed Look-Ahead—ModalMill
G07.1Cylindrical Interpolation18ModalBoth
G08Advanced Preview Control (Look-Ahead)19ModalMill
G09Exact Stop (one block)00One-shotBoth
G10Programmable Data Input (Set Offsets)00One-shotBoth
G11Programmable Data Input Cancel00One-shotBoth
G12Circular Pocket Milling CW (Haas) / Polar Interpolation (Lathe G12.1)00One-shotMill
G13Circular Pocket Milling CCW (Haas) / Cancel Polar Interpolation (G13.1)00One-shotMill
G15Polar Coordinate Command Cancel17ModalMill
G16Polar Coordinate Command17ModalMill
G17XY Plane Selection02ModalMill
G18XZ Plane Selection02ModalBoth
G19YZ Plane Selection02ModalMill
G20Inch Input06ModalBoth
G21Metric Input06ModalBoth
G22Stored Stroke Check On04ModalBoth
G23Stored Stroke Check Off04ModalBoth
G25Spindle Speed Fluctuation Detection Off08ModalLathe
G26Spindle Speed Fluctuation Detection On08ModalLathe
G27Reference Position Return Check00One-shotBoth
G28Return to Reference Point (Machine Home)00One-shotBoth
G28.1Set Predefined Position (GRBL / LinuxCNC)00One-shotMill
G30Return to 2nd/3rd/4th Reference Point00One-shotBoth
G30.1Set Second Predefined Position (GRBL / LinuxCNC)00One-shotMill
G31Skip Function (Probing Move)00One-shotBoth
G32Thread Cutting (Single Pass, Lathe)01ModalLathe
G33Thread Cutting (Spindle-Synchronised Motion)01ModalMill
G34Variable Lead Thread Cutting01ModalLathe
G36Automatic Tool Compensation X (Lathe)00One-shotLathe
G37Automatic Tool Length Measurement00One-shotBoth
G38.2Straight Probe Toward Workpiece (Stop on Contact, Error if Not)01One-shotMill
G38.3Straight Probe Toward Workpiece (No Error)01One-shotMill
G39Corner Offset Circular Interpolation00One-shotMill
G40Cutter Radius Compensation Cancel07ModalBoth
G41Cutter Radius Compensation Left07ModalBoth
G41.1Normal Direction Control (Left / Right)19ModalMill
G42Cutter Radius Compensation Right07ModalBoth
G43Tool Length Compensation (+)08ModalMill
G43.1Dynamic Tool Length Offset (GRBL / LinuxCNC)08ModalMill
G43.4Tool Centre Point Control (TCPC)08ModalMill
G44Tool Length Compensation (−)08ModalMill
G45Tool Position Offset (Increase)00One-shotMill
G49Tool Length Compensation Cancel08ModalMill
G50Max Spindle Speed Clamp (Lathe) / Scaling Cancel (Mill)00One-shotBoth
G50.1Programmable Mirror Image Cancel22ModalMill
G51Scaling11ModalMill
G51.1Programmable Mirror Image22ModalMill
G51.2Polygon Turning20ModalLathe
G52Local Coordinate System00One-shotBoth
G53Machine Coordinate System (One Block)00One-shotBoth
G53.1Tool Axis Direction Control00One-shotMill
G54Work Coordinate System 114ModalBoth
G54.1Additional Work Coordinate Systems14ModalMill
G55Work Coordinate System 214ModalBoth
G56Work Coordinate System 314ModalBoth
G57Work Coordinate System 414ModalBoth
G58Work Coordinate System 514ModalBoth
G59Work Coordinate System 614ModalBoth
G60Single Direction Positioning00One-shotMill
G61Exact Stop Mode15ModalBoth
G62Automatic Corner Override15ModalMill
G63Tapping Mode15ModalMill
G64Cutting Mode (Continuous Path)15ModalBoth
G65Macro Call (Non-Modal)00One-shotBoth
G66Modal Macro Call12ModalBoth
G67Modal Macro Call Cancel12ModalBoth
G68Coordinate System Rotation16ModalMill
G68.2Tilted Working Plane (3+2)16ModalMill
G69Coordinate Rotation Cancel16ModalMill
G70Finishing Cycle (Lathe)00One-shotLathe
G71Stock Removal in Turning (Roughing Cycle)00One-shotLathe
G72Stock Removal in Facing00One-shotLathe
G73Pattern Repeating (Lathe) / High-Speed Peck Drilling (Mill)00/09One-shotBoth
G74Left-Hand Tapping (Mill) / Face Peck Drilling (Lathe)09One-shotBoth
G75Grooving Cycle (Lathe X)00One-shotLathe
G76Threading Cycle (Lathe) / Fine Boring (Mill)00/09One-shotBoth
G80Cancel Canned Cycle09ModalBoth
G81Drilling Cycle (Spot Drill)09ModalMill
G82Drilling Cycle with Dwell (Counterbore / Spot)09ModalMill
G83Peck Drilling Cycle (Deep Hole)09ModalMill
G84Tapping Cycle (Right-Hand)09ModalMill
G85Boring Cycle (Feed In, Feed Out)09ModalMill
G86Boring Cycle (Spindle Stop, Rapid Out)09ModalMill
G87Back Boring Cycle09ModalMill
G88Boring Cycle (Dwell, Manual Retract)09ModalMill
G89Boring Cycle (Dwell, Feed Out)09ModalMill
G90Absolute Programming (Mill) / OD Turning Cycle (Lathe)03/01ModalBoth
G90.1Absolute Arc Centre Mode (IJK)—ModalMill
G91Incremental Programming03ModalMill
G92Coordinate System Setting (Mill) / Threading Cycle (Lathe)00/01One-shotBoth
G92.1Cancel G92 Offset / Coordinate Preset00One-shotBoth
G93Inverse Time Feed05ModalMill
G94Feed per Minute (Mill) / Facing Cycle (Lathe)05/01ModalBoth
G95Feed per Revolution (Mill)05ModalMill
G96Constant Surface Speed (CSS)02ModalLathe
G97Constant RPM (CSS Cancel)02ModalLathe
G98Initial Plane Return (Mill) / Feed per Minute (Lathe)10/05ModalBoth
G99R-Plane Return (Mill) / Feed per Revolution (Lathe)10/05ModalBoth
G101Mirror Image On (Haas)11ModalMill
G103Limit Block Look-Ahead (Haas)00ModalMill
G107Cylindrical Mapping / Interpolation00One-shotBoth
G112Polar Coordinate Interpolation On (Lathe)21ModalLathe
G1413D Cutter Compensation (Haas)07ModalMill
G1435-Axis Tool Length Compensation (Haas)08ModalMill
G150General Purpose Pocket Milling (Haas)00One-shotMill
G154Additional Work Offsets (Haas)12ModalMill
G187Smoothness / Accuracy Control (Haas)—ModalMill
G234Tool Centre Point Control (Haas TCPC)08ModalMill
G254Dynamic Work Offset (Haas DWO)23ModalMill
G268Feature Coordinate System (Haas Tilted Plane)16ModalMill

Test yourself: G-code quiz →