Fanuc M-Code G-Code list

M-CODE

Introduction to G Codes and M Codes

Fanuc M-Code G-Code, G codes (preparatory commands) and M codes (auxiliary commands) are essential instructions used to control machine tools.

  • G codes govern motion, positioning, and machining operations (e.g., linear interpolation, circular movements, tool compensation).
  • M codes manage auxiliary functions (e.g., spindle control, coolant activation, tool changes).

These Fanuc M-Code G-Code vary slightly depending on the machine type (lathe, mill, etc.) and Fanuc control version. Always consult your machine’s manual for specifics.


Common Fanuc G Codes

Machining Centers

CodeDescription
G00Rapid positioning (fast traverse)
G01Linear interpolation (straight-line motion)
G02Circular interpolation (clockwise)
G03Circular interpolation (counterclockwise)
G04Dwell (pause)
G05non standard g-code
G17XY plane selection
G18XZ plane selection
G19YZ plane selection
G20Programming in inches
G21Programming in millimeters
G22
G28Return to reference position (home)
G29Return from reference point
G30Return to secondary reference position
G40Cancel tool radius compensation
G41Tool radius compensation left
G42Tool radius compensation right
G43Tool length compensation (positive)
G44Tool length compensation (negative)
G49Cancel tool length compensation
G54–G59Work coordinate system (WCS) selection
G61Exact stop check (precision mode)
G90Absolute programming
G91Incremental programming
G92Set position by programming
G94Per-minute feedrate mode
G95Per-revolution feedrate mode
G100–G199Macro programs (varies by configuration)

LATHES

Some G codes are not avialable depending on kind of CNC

CodeDescription
G00Rapid positioning (fast traverse)
G01Linear interpolation (straight-line motion)
G02Circular interpolation (clockwise)
G03Circular interpolation (counterclockwise)
G04Dwell (pause)
G05High-speed cycle machining
G09Exact stop
G10Data setting
G11Data setting mode cancel
G15Polar coordinates command cancel
G16Polar coordinates command
G17XY plane selection
G18XZ plane selection
G19YZ plane selection
G20Programming in inches
G21Programming in millimeters
G22Stored stroke check function on
G23Stored stroke check function off
G27Reference point return check
G28Return to reference position (home)
G29Return from reference position
G30Return to secondary reference position
G31Skip fonction
G33Treading
G39Corner offset circular interpolation
G40Cancel tool radius compensation
G41Tool radius compensation left
G42Tool radius compensation right
G43Tool length compensation (positive)
G44Tool length compensation (negative)
G45Tool offset extension
G46Tool offset reduction
G47Double extension of tool offset
G48Tool offset reduction by half
G49Cancel tool length compensation
G50Scaling cancel
G51Scaling
G52Local coordinate system setting
G53selection of machine coordinate system
G54–G59Work coordinate system (WCS) selection
G60Unidirectional positioning
G61Exact stop check (precision mode)
G62automatic corner override
G63Tapping mode
G64Cutting mode
G65Macrocommand, macro call
G66Custom macro modal call
G67Custom macro modal call cancel
G68Coordinate rotation
G69Coordinate rotation cancel
G70Finish cycle
G71Rough cutting cycle of outer diameter
G72Rough cutting cycle end face
G73Peck drilling cycle
G74Counter tapping cycle
G75Outer inner diameter cutting off cycle
G76multiple threading cycle
G80Canned cycle cancel
G81Drilling cycle, spot boring
G82Drilling cycle, counter boring
G83Peck drilling cycle
G84Tapping cycle
G85Boring cycle
G86Boring cycle
G87Back boring cycle
G88Boring cycle
G89Boring cycle
G90Absolute programming
G91Incremental programming
G92Set coordinate system by programming
G94Per-minute feedrate mode
G95Per-revolution feedrate mode
G96Constant surface speed control
G97Constant surface speed control cancel
G98Return to initial point
G99Return to R point
G100–G199Macro programs (varies by configuration)

Common Fanuc M Codes

CodeDescription
M00Program stop
M01Optional stop
M02Program end
M03Spindle on (clockwise)
M04Spindle on (counterclockwise)
M05Spindle stop
M06Tool change
M07Mist coolant on (air cooling)
M08Flood coolant on
M09Cooling (air cooling, water cooling, central outlet) OFF
M10Chuck CLAMP
M11Chuck UNCLAMP
M12QUILL OUT
M13 QUILL IN / 4th axls clamp
M14 4th axls unclamp
M15 5th axls clamp
M16 5th axls unclamp
M17AUTO DOOR CLOSE
M18AUTO DOOR OPEN
M19Spindle orientation
M20Open tool magazine door
M21Close tool magazine door
M23 CHAMFERING ON / Main shaft center water opening
M24CHAMFERING OFF / Main shaft center water outlet is closed
M25LNS BAR FEEDER EXTEND
M26BAR FEEDER ON
M27BAR FEEDER OFF
M28PART CATCHER EXTEND / Enable external data input
M29PART CATCHER RETRACT / Disable external data input
M30Program end and return to start
M31CHUCK BYPASS ON
M32CHUCK BYPASS OFF
M37CHIP CONVEYOR CW
M38CHIP CONVEYOR STOP
M43SETTER DOWN
M44SETTER UP
M47SOFT LIMIT 2 VALID
M48SOFT LIMIT 3 VALID
M49SOFT LIMIT 2/3 UNVALID
M41–M49Tool changer preparation
M51ERROR DETECT OFF
M52ERROR DETECT ON
M53STEADY CLAMP
M54STEADY UNCLAMP
M55TAIL STOCK CLAMP
M56TAIL STOCK UNCLAMP
M61–M69Tool selection (machine-specific)
M79 Tool reset (suitable for arm type tool store)
M97PARTS COUNTED
M98Subprogram call
M99Subprogram return
M100–M199Customizable codes (user-defined)

Notes

  1. Variations: Codes may differ by machine manufacturer or Fanuc control version.
  2. Documentation: Always refer to your machine’s manual for exact code definitions.
  3. Compatibility: Codes depend on the machine type (e.g., lathe vs. mill).

For exhaustive lists of Fanuc M-Code G-Code, consult Fanuc technical manuals or your machine’s programming guide.

Leave a Comment

Scroll to Top