FANUC M-Code/G-Code List

M Code/G Code List

Below you will find a list of common codes many builders use. Please remember, all machines may be configured differently and the list below may not match your machine perfectly. In fact, virtually all M-Codes above M79 will vary from builder to builder. Please make sure to contact your machine tool builder to be sure.

Typical G Command for a Machining Center

  • (G – Codes are written by Fanuc)
  • G00 Moves the tool in rapid travel (not necessarily a straight line)
  • G01 Moves the tool using a set feedrate
  • G02 Moves the tool along a clockwise arc path
  • G03 Moves the tool along a counter-clockwise path
  • G04 Sets a dwell time in seconds or revolutions of the spindle
  • G10 Data setting
  • G11 Data setting mode cancel
  • G17 Establishes axis movement in the X and Y axis planes
  • G18 Establishes axis movement in the X and Z axis planes
  • G19 Establishes axis movement in the Y and Z axis planes
  • G20 Values are in Inches
  • G21 Values are in millimeters
  • G28 Return to reference position
  • G30 Second reference position
  • G33 Thread cutting
  • G40 Cancel cutter compensation
  • G41 Cutter compensation left
  • G42 Cutter compensation right
  • G43 Tool length compensation positive
  • G44 Tool length compensation negative
  • G49 Tool length compensation cancel
  • G53 Machine Coordinate move
  • G54 Use workshift offset #1
  • G55 Use workshift offset #2
  • G56 Use workshift offset #3
  • G57 Use workshift offset #4
  • G58 Use workshift offset #5
  • G59 Use workshift offset #6
  • G60 Single direction positioning
  • G65 Macro call
  • G66 Macro modal call
  • G67 Macro modal call cancel
  • G73 Peck drilling cycle
  • G76 Fine boring cycle
  • G80 Canned cycle cancel
  • G81 Drilling cycle or spot boring cycle
  • G82 Drilling cycle or counter boring cycle
  • G83 Peck drilling cycle
  • G84 Tapping cycle
  • G85 Boring cycle
  • G86 Boring cycle
  • G87 Back boring cycle
  • G88 Boring cycle
  • G89 Boring cycle
  • G90 Absolute measurements
  • G91 Incremental measurements
  • G94 Feed per minute
  • G95 Feed per revolution of the spindle
  • G96 Constant surface speed control
  • G97 Constant surface speed control cancel
  • G98 Return to initial point in canned cycle
  • G99 Return to R point is canned cycle

Typical M Commands for a Machining Center

  • M00 Program stop
  • M01 Optional stop
  • M02 End of program
  • M03 Spindle on Clockwise
  • M04 Spindle on Counter-clockwise
  • M05 Spindle stop
  • M06 Tool change
  • M08 Coolant on
  • M09 Coolant off
  • M10 Clamp
  • M11 Unclamp
  • M30 End of program and rewind to beginning of program
  • M98 Call subprogram
  • M99 End subprogram

Typical MDI Commands

M06 T12; Performs a tool change to tool number 12
S1000 M03; Turns spindle on clockwise to 1000 rpm
G01 X10.5 F10.0: Moves the X axis to position 10.5 at a feedrate of 10.0

G00 X……. Y…….. Z…….. ;
G00 Move in rapid travel
X….. X axis address
Y….. Y axis address
Z….. Z axis address


G01 X……. Y…….. Z…….. F……. ;
G01 Move in a straight line
X….. X axis address
Y….. Y axis address
Z….. Z axis address
F….. Feedrate


G02 X……. Y…….. Z…….. I……. J…….. K…….. F……. ;
G02 Move along a clockwise circular path
X….. X axis address
Y….. Y axis address
Z….. Z axis address
I ….. I axis address
J….. J axis address
K….. K axis address
F….. Feedrate


G03 X……. Y…….. Z…….. I……. J…….. K…….. F……. ;
G03 Move along a counter-clockwise circular path
X….. X axis address
Y….. Y axis address
Z….. Z axis address
I ….. I axis address
J….. J axis addressK….. K axis address
F….. Feedrate


G04 X….… ;
G04 Pause machine operation
X….… ( Specify a time/spindle speed with decimal point)


G04 P….… ; ( Specify a time without decimal point)
G04 Pause machine operation
P….… ( Specify a time/spindle speed without decimal point)


G28 G90 X10.0 Y3.0 ;
G28 Return to reference point
G90 Absolute positioning
X10.0 X axis location
Y3.0 Y axis location


This command sequence can be used to move the tool from point A to an ABSOLUTE Coordinate first, then move the tool to the Reference Point Zero.
G28 G91 X-4.0 Y-3.0 ;
G28 Return to reference point
G91 Incremental positioning
X-4.0 X axis location
Y-3.0 Y axis location


This command sequence can be used to make an incremental move from point A then move the tool to the Reference Point Zero
G28 G91 X0.0 Y0.0 ;
This line will take the tool back to the reference position direct from the current location.
G41 D…. X …… ;
G41 Cutter Comp Left
D….. Assigns Radius Offset number
X…. X axis movement

G42 D….… X …… ;
G42 Cutter Comp Right
D….. Assigns Radius Offset number
X…. X axis movement


G40 X….. ;
G40 Cancel Cutter Comp
X….. Cancels comp on way to Here


G43 H…. Z …… ;
G43 Add offset amount
H….. Offset number
Z…. Z axis movement


G44 H… Z …… ;
G44 Subtract offset amount
H….. Offset number
Z…. Z axis movement


G49 H….. Z…… ;
G49 Cancel Offset
H13 Assigns Offset Number 13
Z0.0 Z axis movement to Zero


G65 P……. L…….. ;
G65 Macro call (Modal)
P….. Macro program Number
L….. Number of repetitions


G66 P……. ;
G66 Macro call (Non-Modal)
P….. Macro program Number

G73 X……. Y…….. Z…….. R……. Q…….. F…….. K……. ;
G73 High speed peck drilling cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R ….. Retract plane
Q….. Distance for each peck stroke
F….. Feedrate
K….. Number of repeats


G74 X……. Y…….. Z…….. R……. P…….. F…….. K……. ;
G74 Left handed tapping cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R …. Retract plane
F….. Feedrate
K….. Number of repeats


G76 X……. Y…….. Z…….. R……. Q…….. P…….. F…….. K……. ;
G76 Fine boring cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R ….. Retract plane
Q….. Distance for each peck stroke
P….. Dwell time at bottom of bore
F….. Feedrate
K….. Number of repeats

G81 X……. Y…….. Z…….. R……. F…….. K……. ;
G81 Spot drilling cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R ….. Retract plane
F….. Feedrate
K….. Number of repeats


G82 X……. Y…….. Z…….. R……. P…….. F…….. K……. ;
G82 Drilling cycle counter boring cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R ….. Retract plane
P….. Dwell time at bottom of bore
F….. Feedrate
K….. Number of repeats


G83 X……. Y…….. Z…….. R……. Q…….. F…….. K……. ;
G83 Peck drilling cycle
X….. X axis address
Y….. Y axis address
Z….. Z address location of bottom of hole
R ….. Retract plane
Q….. Distance for each peck stroke
F….. Feedrate
K….. Number of repeats

Leave a Reply