G and M codes for Milling and Turning

For the correct syntax and full description of these codes, consult the relevent machine programming handbook. The help of HAAS Automation and Heidenhain are gratefully acknowledged in compiling this list.          
             
ISO Programming - TNC 410, 426, 430 (Milling) ISO Programming - TNC 407, 415B, 425, 426 (Milling) ISO Programming - TNC 360 HAAS VF series fitted with Yasnac, Fanuc or HAAS control (Incomplete - codes above G72 are missing) Microkinetics MillMaster Microkinetics TurnMaster Adolph Numerical Controls M768 for Turning applications
             
G00 Straight-line interpolation, Cartesian coordinates, rapid traverse G00 Straight line interpolation, Cartesian coordinates, rapid traverse G00 Linear interpolation, Cartesian coordinates, at rapid traverse G00 Rapid motion G00 Rapid positioning position G00 Rapid positioning position G00 Rapide traverse, Positioning mode
G01 Straight-line interpolation, Cartesian coordinates G01 Straight line interpolation, Cartesian coordinates G01 Linear interpolation, Cartesian coordinates G01 Linear interpolation motion G01 Linear cutting move G01 Linear cutting move G01 Linear contouring mode
G02 Circular interpolation, Cartesian coordinates, clockwise G02 Circular interpolation, Cartesian coordinates, clockwise G02 Circular interpolation, Cartesian coordinates, clockwise G02 CW interpolation motion G02 CW circular cutting move G02 CW circular cutting move G02 CW circular motion
G03 Circular interpolation, Cartesian coordinates, anticlockwise G03 Circular interpolation, Cartesian coordinates, counterclockwise G03 Circular interpolation, Cartesian coordinates, counterclockwise G03 CCW interpolation motion G03 CCW circular cutting move G03 CCW circular cutting move G03 CCW circular motion
G04 Dwell time with F seconds * G04 Dwell time F (in seconds) * G04 Dwell time G04 Dwell G04 Dwell in seconds G04 Dwell in seconds G04 Dwell, time delay
G05 Circular interpolation, Cartesian coordinates, without indication of direction G05 Circular interpolation, Cartesian coordinates, no direction of rotation G05 Circular interpolation, Cartesian coordinates, no direction of rotation defined G09 Exact stop G17 Select XY plane for contouring (default)   G19 Conditional jump
G06 Circular interpolation, Cartesian coordinates, tangential contour approach G06 Circular interpolation, Cartesian coordinates, tangential contour transition G06 Circular interpolation, Cartesian coordinates, tangential connection G10 Set offsets G18 Select XZ plane for contouring   G33 Thread cutting
G07 Paraxial positioning block * G07 Paraxial positioning block * G07 Single axis positioning block G12 CW circular pocket milling (Yasnac) G19 Select YZ plane for contouring   G40 Tool tip radius compensation off
G10 Straight-line interpolation, polar coordinates, rapid traverse G10 Straight line interpolation, polar coordinates, rapid traverse G10 Linear interpolation, polar coordinates, at rapid traverse G13 CCW circular pocket milling (Yasnac) G25 Execute subroutine G25 Execute subroutine G41 Tool tip radius compensation left
G11 Straight-line interpolation, polar coordinates G11 Straight line interpolation, polar coordinates G11 Linear interpolation, polar coordinates G17 XY plane selection G26 Conditional branch G26 Conditional branch G42 Tool tip radius compensation right
G12 Circular interpolation, polar coordinates, clockwise G12 Circular interpolation, polar coordinates, clockwise G12 Circular interpolation, polar coordinates, clockwise G18 ZX plane selection G27 Undconditional branch G27 Undconditional branch G60 Cancel G61,G62
G120 Contour data (applies to G121 to G124) G120 Contour data (applies to G121 to G124) G13 Circular interpolation, polar coordinates, counterclockwise G19 YZ plane selection G28 Set system or user devined variable to value G28 Set system or user devined variable to value G61 Positioning mode
G121 Pilot drilling G121 Pilot drilling G15 Circular interpolation, polar coordinates, no direction of rotation defined G20 Select inches G70 Set inch programming (default) G33 Canned threading cycle G62 Wait for spindle stop
G122 Rough-out G122 Rough-out G16 Circular interpolation, polar coordinates, tangential connection G21 Select metric G71 Set metric programming G70 Set inch programming (default) G70 Inch dimensions
G123 Floor finishing G123 Floor finishing G17 Select plane XY, tool axis Z G28 Return to reference point G72 Set rotary table scaling G71 Set metric programming G71 Metric dimensions
G124 Side finishing G124 Side finishing G18 Select plane ZX, tool axis Y G29 Return from reference point G74 Set single quadrant arc mode   G80 Canned cycles off
G125 Contour train (machining open contour) G125 Contour train (machine open contour) G19 Select plane YZ, tool axis X G31 Automatic tool diameter measurement (optional) G75 Set multiple quadrant arc mode G74 Set single quadrant arc mode G81 Canned turning cycle
G127 Cylinder surface G127 Cylinder surface G20 Tool axis IV G36 Automatic work offset measurement (optional) G79 Canned cycle for milling a deep channel G75 Set multiple quadrant arc mode G82 Canned facing cycle
G13 Circular interpolation, polar coordinates, anticlockwise G13 Circular interpolation, polar coordinates, counterclockwise G24 Chamfer with chamfer length R G37 Automatic tool offset measurement (optional) G80 Cancel canned cycle   G83 Canned deep hole cycle with chip break
G15 Circular interpolation, polar coordinates, without indication of direction G15 Circular interpolation, polar coordinates, no direction of rotation G25 Corner rounding with radius R G40 Cutter compensation cancel G81 Canned cycle for drilling a hole G80 Cancel canned cycle G84 Canned thread cutting cycle
G16 Circular interpolation, polar coordinates, tangential contour approach G16 Circular interpolation, polar coordinates, tangential contour transition G26 Smooth approach of a contour with radius R G41 2D cutter compensation Left G82 Canned cycle for spot facing G81 Canned cycle for turning down outside diameter G85 Canned paraxial roughing cycle
G17 Working plane: X/Y; tool axis: Z G17 Working plane: X/Y; tool axis: Z G27 Smooth departure from a contour with radius R G42 2D cutter compensation Right G83 Canned cycle for deep hole drilling G82 Canned cycle for reducing part length (part facing) G86 Canned contour parallel roughing cycle
G18 Working plane: Z/X; tool axis: Y G18 Working plane: Z/X; tool axis: Y G28 Mirror image G43 Tool length compesation + G85 Canned boring cycle   G87 Canned contour finishing cycle
G19 Working plane: Y/Z; tool axis: X G19 Working plane: Y/Z; tool axis: X G29 Define the last programmed position as a pole G44 Tool length compensation - G87 Canned drilling cycle with chip break   G88 Canned diameter grooving cycle
G20 Tool axis IV G20 Tool axis: IV G30 Define the blank form for graphic simulation, MIN point G47 Text engraving G89 Canned boring cycle with dwell   G89 Canned face grooving
G200 Drilling G24 Chamfer with length R * G31 Define the blank form for graphic simulation, MAX point G49 G43/G44/G143 cancel G90 Set absolute programming mode    
G201 Reaming G25 Corner rounding with radius R * G36 Oriented spindle stop G50 G51 cancel G91 Set incremental programming mode G90 Set absolute programming mode  
G202 Boring G26 Tangential contour approach with radius R * G37 Definition of the pocket contour G51 Scaling (optional) G92 Set current tool position counters to zero G91 Set incremental programming mode  
G203 Universal drilling G27 Tangential contour departure with radius R * G38 Stop program run G52 Set work coordinate system G52 (Yasnac) G95 Chain to next part program G92 Set current tool position counters to zero  
G204 Back boring G28 Mirror image G39 Cycle for program call, cycle call with G79 G52 Set local coordinate coordinate system (Fanuc)   G95 Chain to next part program  
G210 Slot milling with reciprocating plunge G29 Transfer the last nominal position value as a pole (circle center) G40 No tool compensation (R0) G52 Set local coordinate coordinate system (HAAS)      
G211 Round slot with reciprocating plunge G30 (G17/G18/G19) MIN point G41 Tool radius compensation, tool traverse to the left of the contour (RL) G53 Non-modal machine coordinate selection      
G212 Rectangular pocket finishing G31 (G90/G91) MAX point G42 Tool radius compensation, tool traverse to the right of the contour (RR) G54 Select work coordinate system 1      
G213 Rectangular stud finishing G36 Oriented spindle stop G43 Lengthening single-axis movements (R+) G55 Select work coordinate system 2      
G214 Circular pocket finishing G37 Contour geometry, list of subcontour program numbers G44 Shortening single-axis movements (R-) G56 Select work coordinate system 3      
G215 Circular stud finishing G37 Contour geometry, list of subcontour program numbers G50 Edit protection at the beginning of a program G57 Select work coordinate system 4      
G220 Circular pattern G38 Stop program run G51 Next tool number (with central tool memory) G58 Select work coordinate system 5      
G221 Linear pattern G39 Program call * G54 Datum shift in a part program G59 Select work coordinate system 6      
G230 Multipass milling of smooth surfaces G40 No tool radius compensation G55 Touch probe function G60 Unidirectional positioning      
G231 Multipass milling of tilted surfaces G41 Tool radius compensation, left of the contour G56 Pilot drilling contour pockets (combined with G37) G61 Exact stop modal      
G24 Chamfer with length R * G42 Tool radius compensation, right of the contour G57 Roughing out contour pockets (combined with G37) G64 G61 cancel      
G25 Corner rounding with radius R * G43 Paraxial compensation for G07, lengthening G58 Contour milling, clockwise (combined with G37) G65 Macro subroutine call (optional)      
G26 Tangential contour approach with radius R * G44 Paraxial compensation for G07, shortening G59 Contour milling, counterclockwise (combined with G37) G68 Rotation (optional)      
G27 Tangential contour departure with radius R * G51 Next tool number (with central tool file) * G70 Unit of measurement: Inches (at beginning of program) G69 G68 cancel (optional)      
G28 Mirror image G53 Datum shift in datum table G71 Unit of measurement: Millimeters (at beginning of program) G70 Bolt hole circle (Yasnac)      
G29 Transfer the last nominal position value as a pole (circle center) G54 Datum shift in program G72 Scaling factor G71 Bolt hole arc (Yasnac)      
G30 (G17/G18/G19) min. point G55 Probing function G73 Rotation of the coordinate system        
G31 (G90/G91) max. point G56 Pilot drilling G74 Slot milling        
G36 Oriented spindle stop G57 Rough-out G75 Rectangular pocket milling, clockwise        
G37 Contour geometry, list of subcontour program numbers G58 Contour milling, clockwise (finishing) G76 Rectangular pocket milling, counterclockwise        
G37 Contour geometry, list of subcontour program numbers G59 Contour milling, counterclockwise (finishing) G77 Circular pocket milling, clockwise        
G38 Program run STOP G70 Inches (define at start of program) G78 Circular pocket milling, counterclockwise        
G39 Program call * G71 Millimeters (define at start of program) G79 Cycle call        
G40 No tool radius compensation G72 Scaling factor (reduce or enlarge contour) G83 Pecking        
G41 Tool radius compensation, left of the contour G73 Rotation of the coordinate system G84 Tapping with a floating tap holder        
G42 Tool radius compensation, right of the contour G74 Slot milling G85 Rigid tapping        
G43 Paraxial compensation for G07, lengthening G75 Rectangular pocket milling, clockwise G90 Absolute workpiece positions        
G44 Paraxial compensation for G07, shortening G76 Rectangular pocket milling, counterclockwise G91Incremental workpiece positions        
G51 Next tool number (with central tool file) * G77 Circular pocket milling, clockwise G98 Assigning a label number        
G53 Datum shift in datum table G78 Circular pocket milling, counterclockwise G99 Tool definition        
G54 Datum shift in program G79 Cycle call *          
G55 Programmable probing function G80 Working plane (except TNC 407)          
G56 Pilot drilling G83 Pecking          
G57 Rough-out G84 Tapping with floating tap holder          
G58 Contour milling in clockwise direction (finishing) G85 Rigid tapping          
G59 Contour milling in anticlockwise direction (finishing) G86 Thread cutting          
G60 Running point tables (not TNC 410) G98 Set label number *          
G62 Tolerance deviation for fast contour milling (not TNC 410) G99 With tool number T, length L, radius R *          
G70 Inches (set at start of program)            
G71 Millimeters (set at start of program)            
G72 Scaling factor (reduce or enlarge contour)            
G73 Rotation of the coordinate system            
G74 Slot milling            
G75 Rectangular pocket milling in clockwise direction            
G76 Rectangular pocket milling in anticlockwise direction            
G77 Circular pocket milling in clockwise direction            
G78 Circular pocket milling in anticlockwise direction            
G79 Cycle call *            
G80 Tilting the working plane            
G83 Pecking            
G84 Tapping with a floating tap holder            
G85 Rigid tapping            
G86 Thread cutting (not TNC 410)            
G90 Absolute dimensions            
G91 Incremental dimensions            
G98 Set label number *            
G99 With tool number T, length L, radius R *            
             
             
             
             
             
             
             
             
             
             
M00 Stop program run/Spindle STOP/Coolant OFF M05 Spindle stop M00 Stop program run / Spindle stop / Coolant off M00 Stop program M00 Temporary stop M00 Temporary stop M00 Intermediate stop. Require pressing the start button the start button to continue
M01 Optional program run interruption M06 Tool change/spindle stop (depending on machine parameter)/Stop program run M02 Stop program run / Spindle stop / Coolant off. Clear the status display (de-pending on machine parameter) / Return to block 1 M01 Optional program stop M02 End of program stop M02 End of program stop M01 Optional intermediate stop
M02 Stop program run/Spindle STOP/Coolant OFF/Clear status display (depending on machine parameter)/Go to block 1 M08 Coolant ON M03 Spindle on clockwise M02 Program end M03 Spindle ON CW M03 Spindle ON CW M02 Program end
M03 Spindle ON clockwise M09 Coolant OFF M04 Spindle on counterclockwise M03 Spindle forward M04 Spindle ON CCW M04 Spindle ON CCW M03 Spindle clockwise
M04 Spindle ON counterclockwise M101 Automatic tool change with sister tool if maximum tool life has expired M05 Spindle stop M04 Spindle reverse M05 Spindle OFF M05 Spindle OFF M04 Spindle anti-clockwise
M05 Spindle STOP M102 Reset M101 M06 Tool change / Stop program run (depending on machine parameter) / Spindle stop M05 Spindle stop M06 Tool change M06 Tool change M05 Spindle stop
M06 Tool change/Stop program run (depending on machine parameter)/Spindle STOP M103 Reduce plunging rate to factor F (percent) M08 Coolant on M06 Tool change M08 Coolant on M08 Coolant on M06 Tool change
M08 Coolant ON M104 Reserved M09 Coolant off M08 Coolant on M09 Coolant off M09 Coolant off M08 Coolant on
M09 Coolant OFF M105 Machining with first Kv factor M13 Spindle on clockwise / Coolant on M09 Coolant off M10 Vacuum on M10 Vacuum on M09 Coolant off
M101 Automatic tool change with replacement tool if maximum tool life has expired M106 Machining with second Kv factor M14 Spindle on counterclockwise / Coolant on M10 Engage 4th axis brake M11 Vacuum off M11 Vacuum off M30 Program end as M02 but resets control to start at begin of program
M102 Reset M101 M109 Constant contouring speed at the tool cutting edge on inside and outside corners M30 Same function as M02 M11 Release 4th axis brake M12 Auxiliary output on M12 Auxiliary output on  
M103 Reduce feed rate during plunging to factor F (percentage) M110 Constant contouring speed at the tool cutting edge on inside corners   M12 Engage 5th axis brake M13 Auxiliary output off M13 Auxiliary output off Other M functions can be programmed into the control - Consult machine tool builder for further information.
M105 Machining with first kv factor M111 Feed rate refers to the tool path center (standard setting)   M13 Release 5th axis brake M17 Return from subroutine M17 Return from subroutine  
M106 Machining with second kv factor M112 Insert rounding arc between two straight lines, enter tolerance E   M16 Tool change (same as M06) M25 Rapide traverse to home position M25 Rapide traverse to home position  
M107 Suppress error message for replacement tool with oversize M113 Reset M112   M19 Orient spindle M39 chuck close M39 chuck close  
M108 Reset M107 M114 Automatic compensation of the machine geometry when working with tilting axes   M21-M28 Optional pulsed M function M40 Chuck open M40 Chuck open  
M109 Constant contouring speed at tool cutting edge on circular arcs (increase and decrease feed rate) M115 Reset M114   M30 Program end and rewind M94 Issue controller literal command    
M110 Constant contouring speed at tool cutting edge on circular arcs (feed rate decrease only) M116 Feed rate for rotary axes in mm/min   M31 Chip conveyor forward M97 Wait for true input state then continue M97 Wait for true input state then continue  
M111 Reset M109/M110 M126 Optimized traverse of rotary axes   M32 Chip conveyor reverse M99 Restart part program from beginning M99 Restart part program from beginning  
M112 Enter contour transition between two contour elements; Enter contour deviation tolerance via T M127 Reset M126   M33 Chip conveyor stop      
M113 Reset M112 M13 Spindle ON clockwise/Coolant ON   M34 Increment coolant spigot position      
M114 Automatic compensation of machine geometry during operation with tilting axes M14 Spindle ON counterclockwise/Coolant ON   M35 Decrement coolant spigot position      
M115 Reset M114 M30 Same as M02   M36 Pallet rotate      
M116 Feed rate for angular axes in mm/min M89 Vacant miscellaneous function or Cycle call, modal   M39 Rotate tool turet      
M118 Superimpose handwheel positioning during program run M90 Constant contouring speed at inside corners and uncompensated corners   M41 Low gear override      
M120 Pre-calculate radius-compensated contour (LOOK AHEAD) M91 Coordinates in positioning block are referenced to the machine datum   M42 high gear override      
M124 Contour filter M92 Coordinates in positioning block are referenced to a position defined by the machine builder   M51-M58 Set optional user M function      
M126 Shorter-path traverse of rotary axes M93 Reserved   M61-M68 Clear optional user M function      
M127 Reset M126 M94 Reduce display of rotary axis to value under 360°   M75 set measure point      
M128 Maintaining the position of the tool tip when positioning with tilted axes (TCPM) M95 Reserved   M76 Disable displays      
M129 Reset M128 M96 Reserved   M77 Enable displays      
M13 Spindle ON clockwise/Coolant ON M97 Path compensation on outside corners: points of intersection instead of transition arc   M78 Alarm if skip signal found      
M130 Moving to position in an untilted coordinate system with a tilted working plane M98 End of path compensation, non-modal   M79 Alarm if skip signal not found      
M14 Spindle ON counterclockwise/Coolant ON M99 Cycle call, non-modal   M82 Tool unclamp      
M200 Laser cutting: Output programmed voltage directly Other G functions   M86 Tool clamp      
M201 Laser cutting: Output voltage as function of distance Simple fixed cycles   M88 Though spindle coolant on      
M202 Laser cutting: Output voltage as function of speed SL cycles, group 1   M89 Through spindle coolant off      
M203 Laser cutting: Output voltage as function of time (ramp) SL cycles, group 2   M95 Sleep mode      
M204 Laser cutting: Output voltage as function of time (pulse) Special cycles   M96 Jump if no input      
M30 Same function as M02 Tool definition   M97 Local sub-program call      
M89 Vacant miscellaneous function or Cycle call, modally effective (depending on machine parameter) Tool movement   M98 Sub program call      
M90 Only in lag mode: Constant contouring speed at corners Tool radius compensation   M99 Sub program return or loop      
M91 Within the positioning block: Coordinates are referenced to machine datum            
M92 Within the positioning block: Coordinates are referenced to position defined by machine tool builder, such as tool change position            
M94 Reduce display of rotary axis to value less than 360°             
M97 Machine small contour steps             
M98 Completely machine open contours             
M99 Blockwise cycle call            
             

Last Updated on 08/09/00
By PC