FANUC G and M Code List: Lathe (Systems A/B/C) and Machining Center Full Reference

27 August 2026

Mentor CNC Editör Ekibi

What do G codes and M codes actually do on a FANUC?

An NC program contains two different families of command. G codes (preparatory function) tell the control how to move: rapid or feed, linear or circular interpolation, which plane to work in, which compensation to apply. M codes (auxiliary function) command the machine itself: start the spindle, turn the coolant on, change the tool, end the program.

The difference matters: FANUC defines what a G code means, while the machine tool builder defines most of what an M code means. The source manual states it plainly — which M code corresponds to which machine function is determined by the machine tool builder. That is why M19 orients the spindle on one machine and does something entirely different on another.

What this page coversThe lists below are taken from the official FANUC Series 0i-MODEL F operator’s manual. Separate lists are given for the machining center system and the lathe system. Older series (0, 0-MC, 16/18/21i) may not have some codes, and optional functions may not have been purchased for your machine.

The detail that catches people out on lathes: three G code systems (A, B, C)

This is the single biggest source of confusion on the shop floor. On FANUC lathe controls, the same operation is written with a different number depending on the machine’s G code system. There are three: A, B and C. Which one is active is selected by the machine tool builder via parameter.

System ASystem BSystem CFunction
G20 / G21G20 / G21G70 / G71Inch / mm input
G50G92G92Coordinate system setting or max spindle speed clamp
G32G33G33Threading
G70G70G72Finishing cycle
G71G71G73Stock removal in turning
G72G72G74Stock removal in facing
G73G73G75Pattern repeating cycle
G74G74G76End face peck drilling cycle
G75G75G77OD / ID grooving cycle
G76G76G78Multiple-thread cutting cycle
G90G77G20OD / ID single turning cycle
G92G78G21Threading cycle
G94G79G24End face turning cycle
G98 / G99G94 / G95G94 / G95Feed per minute / feed per revolution
G50.3G92.1G92.1Workpiece coordinate system preset
Why it mattersIn System A, G90 is a single turning cycle. On a milling machine, G90 is absolute programming. Same number, completely different job. Before copying a program from another machine, find out which G code system yours is running.

Most lathes in service run System A. All three systems are shown side by side in the lathe table below.

FANUC Machining Center (Milling) G Code List

Series 0i-MODEL F machining center system. Codes in brackets are alternative notations.

G codeFunction
Motion and interpolation
G00Positioning (rapid traverse)
G01Linear interpolation (cutting feed)
G02Circular interpolation CW or helical interpolation CW
G03Circular interpolation CCW or helical interpolation CCW
G04Dwell
G04.1G code preventing buffering
G05.1AI advanced preview control / AI contour control / nano smoothing
G05.4HRV3 on/off
G07.1 (G107)Cylindrical interpolation
G08AI advanced preview control
G09Exact stop
G31Skip function
G31.8EGB axis skip
G33Threading
Data input, plane and units
G10Programmable data input
G10.6Tool retract and recover
G11Programmable data input mode cancel
G15 / G16Polar coordinates command cancel / on
G17XpYp plane selection
G18ZpXp plane selection
G19YpZp plane selection
G20 (G70)Input in inch
G21 (G71)Input in mm
G22 / G23Stored stroke check on / off
Reference position and coordinate systems
G27Reference position return check
G28Automatic return to reference position
G28.2In-position check disable reference position return
G29Movement from reference position
G302nd, 3rd and 4th reference position return
G30.2In-position check disable 2nd/3rd/4th reference return
G52Local coordinate system setting
G53Machine coordinate system setting
G53.1Tool axis direction control
G54 (G54.1)Workpiece coordinate system 1 selection
G55Workpiece coordinate system 2 selection
G56Workpiece coordinate system 3 selection
G57Workpiece coordinate system 4 selection
G58Workpiece coordinate system 5 selection
G59Workpiece coordinate system 6 selection
G92Workpiece coordinate system setting or max spindle speed clamp
G92.1Workpiece coordinate system preset
Tool compensation
G37Automatic tool length measurement
G38Tool radius compensation: preserve vector
G39Tool radius compensation: corner circular interpolation
G40Tool radius / tool nose radius compensation cancel
G41Tool radius compensation left
G42Tool radius compensation right
G40.1 / G41.1 / G42.1Normal direction control cancel / left / right
G43Tool length compensation +
G44Tool length compensation −
G43.7Tool offset
G45 / G46Tool offset: increase / decrease
G47 / G48Tool offset: double increase / double decrease
G49 (G49.1)Tool length compensation cancel
Scaling, mirroring, rotation
G50 / G51Scaling cancel / on
G50.1 / G51.1Programmable mirror image cancel / on
G68 / G69Coordinate system rotation or 3-D coordinate conversion on / off
G68.2Tilted working plane indexing
G68.3Tilted working plane indexing by tool axis direction
G72.1 / G72.2Figure copying (rotary / linear)
Motion mode and macro
G60Single direction positioning
G61Exact stop mode
G62Automatic corner override
G63Tapping mode
G64Cutting mode (continuous path)
G65Macro call
G66 / G66.1Macro modal call A / B
G67Macro modal call cancel
Canned cycles for drilling
G73High-speed peck drilling cycle
G74Left-handed tapping cycle
G76Fine boring cycle
G80Canned cycle cancel
G81Drilling / spot drilling cycle
G82Drilling or counter boring cycle
G83Peck drilling cycle
G84Tapping cycle
G84.2 / G84.3Rigid tapping / left-handed rigid tapping (FS10/11 format)
G85Boring cycle
G86Boring cycle
G87Back boring cycle
G88 / G89Boring cycles
G98 / G99Canned cycle return: initial level / R point level
Programming mode, feed and spindle
G90Absolute programming
G91Incremental programming
G91.1Checking the maximum incremental amount specified
G93Inverse time feed
G94Feed per minute
G95Feed per revolution
G96Constant surface speed control
G97Constant surface speed control cancel
G160 / G161In-feed control cancel / on (grinding)
G75, G77, G78, G79Grinding cycles (plunge, direct sizing, surface)
G50.4 / G51.4Cancel / start synchronous control
G50.5 / G51.5Cancel / start composite control
G50.6 / G51.6Cancel / start superimposed control
G80.4 / G81.4Electronic gear box: synchronization cancel / start

FANUC Lathe G Code List (Systems A / B / C)

The three columns show the three G code systems. Read the column that matches your machine.

ABCFunction
Motion and interpolation
G00G00G00Positioning (rapid traverse)
G01G01G01Linear interpolation
G02G02G02Circular interpolation CW
G03G03G03Circular interpolation CCW
G04G04G04Dwell
G05.1G05.1G05.1AI contour control
G07.1G07.1G07.1Cylindrical interpolation
G09G09G09Exact stop
G12.1 / G13.1G12.1 / G13.1G12.1 / G13.1Polar coordinate interpolation on / off
G31G31G31Skip function
Threading
G32G33G33Threading (constant lead)
G34G34G34Variable lead threading
G35G35G35Circular threading CW
G36G36G36Circular threading CCW or automatic tool offset (parameter dependent)
Units, plane, stroke
G20G20G70Input in inch
G21G21G71Input in mm
G17 / G18 / G19samesameXpYp / ZpXp / YpZp plane selection
G22 / G23samesameStored stroke check on / off
G25 / G26samesameSpindle speed fluctuation detection off / on
Reference position and coordinate systems
G27G27G27Reference position return check
G28G28G28Return to reference position
G29G29G29Movement from reference position
G30G30G302nd, 3rd, 4th reference position return
G50G92G92Coordinate system setting / max spindle speed clamp
G50.3G92.1G92.1Workpiece coordinate system preset
G52G52G52Local coordinate system setting
G53G53G53Machine coordinate system setting
G54…G59samesameWorkpiece coordinate system 1…6
Tool compensation
G40G40G40Tool nose radius compensation cancel
G41G41G41Tool nose radius compensation left
G42G42G42Tool nose radius compensation right
G38 / G39samesameCompensation with vector held / corner circular
G43.7G43.7G43.7Tool offset
G49G49G49Tool length compensation cancel
G50.1 / G51.1samesameProgrammable mirror image cancel / on
G68 / G69samesameMirror image for double turret or balance cutting mode on / off
Multiple repetitive turning cycles
G70G70G72Finishing cycle
G71G71G73Stock removal in turning
G72G72G74Stock removal in facing
G73G73G75Pattern repeating cycle
G74G74G76End face peck drilling cycle
G75G75G77OD / ID grooving and cut-off cycle
G76G76G78Multiple-thread cutting cycle
Single turning cycles
G90G77G20OD / ID single turning cycle
G92G78G21Threading cycle
G94G79G24End face turning cycle
Drilling cycles (live tooling)
G80G80G80Canned cycle cancel for drilling
G83G83G83Cycle for face drilling
G83.5 / G83.6samesameHigh-speed peck drilling / peck drilling
G84G84G84Cycle for face tapping
G84.2G84.2G84.2Rigid tapping cycle (FS10/11-T format)
G85G85G85Cycle for face boring
G87G87G87Cycle for side drilling
G88G88G88Cycle for side tapping
G89G89G89Cycle for side boring
Feed, spindle and macro
G96G96G96Constant surface speed control
G97G97G97Constant surface speed control cancel
G98G94G94Feed per minute
G99G95G95Feed per revolution
G61 / G64samesameExact stop mode / cutting mode
G63G63G63Tapping mode
G65G65G65Macro call
G66 / G66.1 / G67samesameMacro modal call A / B / cancel
G10 / G11samesameProgrammable data input on / cancel
Note for grinding machinesIn the lathe system G71–G74 can also be defined as grinding cycles (traverse grinding, oscillation grinding). Which set applies depends on the machine type and the builder’s configuration.

FANUC M code list — and why there is no such thing as a “standard” one

Most of the “FANUC M code list” tables circulating online are misleading. The source manual is explicit: when a number is specified after address M, a code signal and a strobe signal are sent to the machine. Which M code corresponds to which machine function is determined by the machine tool builder.

In other words, the great majority of M codes are defined not by FANUC but by the company that built the machine. The authoritative list is always in the machine tool builder’s manual.

The M codes FANUC itself fixes

These are handled by the control and are not left to the builder:

M codeFunctionBehaviour
M00Program stopAutomatic operation stops after the block is executed. All modal information remains unchanged. Restarted with cycle start.
M01Optional stopLike M00, but only effective when the Optional Stop switch on the operator’s panel is on.
M02End of programIndicates the end of the main program. Automatic operation stops and the CNC is reset.
M30End of programLike M02; control returns to the start of the program after the block is executed.
M98Subprogram callCode and strobe signals are not sent to the machine; handled inside the control.
M99End of subprogramReturns control to the main program. No signal is sent.
M198Subprogram call from an external deviceHandled by the control.
CautionWhether M02 and M30 return control to the start of the program is parameter dependent and differs from machine to machine. The manual states this explicitly.

Widely used but builder-defined M codes

The following mean the same thing on most machines, but that is not guaranteed. Verify against your own machine’s manual:

M codeCommon meaning
M03 / M04Spindle on clockwise / counter-clockwise
M05Spindle stop
M06Tool change
M08 / M09Coolant on / off
M19Spindle orientation
M29Rigid tapping mode (on most milling machines, before G84)
M10 / M11Clamp / unclamp (indexer, chuck, tailstock — varies by builder)
M07Mist coolant
M48 / M49Feedrate override enable / disable

How many M codes can go in one block?

By default only one. Parameters extend this:

  • Parameter 3404 bit 7 (M3B) = 1 → up to three M codes per block
  • Parameter 11630 bit 5 (M5B) = 1 → up to five M codes per block

M codes written in one block are output to the machine at the same time, which reduces cycle time.

Modal and one-shot G codes

G codes are organised into groups and behave in two ways:

  • Modal codes take effect in the block where they are written and stay in effect until another code from the same group is written. Once G01 is commanded, it does not have to be repeated on the following lines.
  • One-shot codes (group 00) are effective only in the block where they appear: G04 dwell, G28 reference return, G65 macro call.

If two codes from the same group appear in one block, the last one wins. Codes from different groups can be combined freely — G90 G54 G00 X0 Y0 is a valid line.

The codes most often confused on the shop floor

G90 on a mill is not G90 on a lathe

On a milling machine G90 is absolute programming. On a System A lathe control G90 is the single turning cycle. This is the single most common mistake when moving a program between machines.

G98 / G99 mean two different things

On a mill, G98/G99 set the return level of a drilling cycle (initial level / R point). On a System A lathe, G98/G99 are the feed units (per minute / per revolution).

The G20/G21 versus G70/G71 trap

In systems A and B, G20/G21 select inch/mm. In system C the same job is done by G70/G71 — whereas in system A G70/G71 are the finishing and roughing cycles. One line written in the wrong system makes the machine do something entirely different.

Mixing up the H number with the D number on G43

G43 H.. is tool length compensation; G41/G42 D.. is tool radius compensation. Writing D where H belongs produces an unexpected plunge in Z.

Using G96 without a G50 / G92 speed clamp

Under constant surface speed (G96) the spindle speeds up as the diameter falls. Facing towards centre, the speed runs into the machine’s limit. Clamp the maximum with G50 S.... in system A, or G92 S.... in systems B and C.

Frequently asked questions

Are FANUC G codes the same on every series?

The core codes (G00, G01, G02, G03, G04, G17–G19, G40–G43, G54–G59, G80–G89, G90/G91) are the same across all series. The differences are in the advanced and optional codes: G05.1 AI contour control, G68.2 tilted working plane indexing, G51.4 synchronous control and similar are absent on older series or may not have been purchased as options. The lists on this page are based on Series 0i-MODEL F.

How do I find out which G code system my lathe uses?

The practical way is to look at an existing program. If threading is written with G32 it is System A; if it is written with G33 it is System B or C. If the feed unit is set with G99 per revolution it is System A; with G95 it is B or C. The definitive answer is in the machine tool builder’s manual — the system is selected by parameter.

Where do I find the complete M code list?

There is no complete M code list in the FANUC manual, because most M codes are defined by the machine tool builder. The codes handled by the control itself are only M00, M01, M02, M30, M98, M99 and M198. For everything else you need your machine builder’s manual. General M code lists online show common usage only; they are not binding.

Can I write more than one M code in a block?

By default no — one M code per block. With bit 7 (M3B) of parameter 3404 set, three M codes are allowed; with bit 5 (M5B) of parameter 11630 set, five. They are output to the machine simultaneously, which shortens cycle time.

What is the difference between G54 and G92?

G54G59 select workpiece coordinate systems stored in the offset table; the values are entered on screen and persist. G92 on a mill (G50 on a System A lathe) sets the coordinate system from within the program, relative to the tool’s current position. Modern practice favours G54G59; G92/G50 is mostly used for the maximum spindle speed clamp.

What does modal mean?

A modal code takes effect where it is written and stays in effect until another code from the same group replaces it. Once G01 is commanded it does not need repeating on the following lines. Group 00 codes are one-shot: G04, G28, G65 and similar.

What is the difference between G81 and G83?

G81 drills in a single pass and retracts — for shallow holes and spot drilling. G83 is the peck drilling cycle: it advances by the Q depth, retracts, breaks the chip and plunges again. Use G83 for deep holes where chip evacuation and drill life matter. G73 is high-speed peck drilling; it does not fully retract from the hole, only backs off a short distance.

Which G codes should go at the top of a program?

A safety line puts the modal state into a known condition. Common on milling: G17 G21 G40 G49 G80 G90 G54. On a lathe (System A): G21 G40 G97 G99 plus G50 S.... for a speed clamp where needed. This prevents a compensation or cycle mode left over from the previous program from carrying across.

Safety warningThis page is a reference list, not a substitute for program verification. Every newly written program, and every program carried over from another machine, should first be checked with graphics or dry run, then tried in single block with a low feedrate override. The collision risk is real when the G code system (A/B/C) differs between machines.
Mentor CNC note: The G code lists on this page are based on FANUC’s official Series 0i-MODEL F Operator’s Manual (B-64604EN/01). Which codes exist on your machine depends on the control version, the options purchased and the machine tool builder’s configuration. Most M codes are defined by the machine tool builder. The machine tool builder’s documentation always takes precedence. This page is for training purposes and does not replace the official manual.

Sources

  • FANUC — Series 0i-MODEL F, Common to Lathe System / Machining Center System, OPERATOR’S MANUAL, document no. B-64604EN/01: Section 3.1 G code list in the machining center system, Section 3.2 G code list in the lathe system (Systems A/B/C), Section 11.1 Auxiliary function (M function), Section 11.2 Multiple M commands in a single block, Section 13.3 Subprogram (M98, M99)
  • FANUC — Series 0i-MODEL F For Lathe System OPERATOR’S MANUAL, B-64604EN-1/01
  • FANUC — Series 0i-MODEL F For Machining Center System OPERATOR’S MANUAL, B-64604EN-2/01