Fanuc G-Codes List and Reference for Fanuc Controls

Fanuc G-Codes List and Reference for Fanuc Controls
— · 0 votes

A Fanuc G-code list groups the address words a Fanuc control uses to command motion, feed, speed and machine functions, and it pairs each G-code with the M-codes that switch machine actions on and off. The list matters because the same G-code number can mean different things on a mill and on a lathe, and because some codes stay active until another one replaces them. This page explains how to read the list, how the modal groups behave, which codes differ between machine types, and how a program sends the machine home.

Reading a Fanuc G-code list

A Fanuc G-code list is only useful when you read it as grouped families rather than as one long column of numbers. Motion codes cover rapid, linear and circular moves, while other families cover plane selection, units, offsets, canned cycles and coordinate systems. On a Fanuc control the numbers follow a usual pattern, but the machine builder decides which ones the machine actually supports. Check the builder's manual for your machine before you trust any list, including this page.

Modal codes stay in effect

Most Fanuc G-codes are modal, so they stay active until another code in the same group replaces them. You set a feed mode once and the following blocks keep it, which is why a missing code can carry over from an earlier block. Canceling a cycle or returning to a safe state needs the cancel code for that group, not just a new move. Writing the cancel code explicitly in the block makes the program easier to read and safer to restart.

Lathe and mill codes differ

A Fanuc CNC lathe and a machining center share many codes but not all of them, so a list written for one machine can mislead on the other. Lathe work leans on canned cycles for turning, facing, grooving and threading, while mill work leans on drilling and milling cycles and work coordinate selection. G-codes for tool radius compensation and for constant surface speed also behave differently between the two machine types. Keep a separate reference for each machine type you run.

M-codes and the machine home

Fanuc M-codes control machine functions that are not axis motion, such as spindle direction, coolant and program stop. The M-code list belongs beside the G-code list because a program pairs spindle and coolant commands with the motion that needs them. Sending a machine home is done with a reference return command, and its exact behavior depends on the machine builder and the axis setup. Confirm the return sequence in the builder documentation before you run it near a fixture or a part.

Fanuc G-code questions

What is the difference between G-codes and M-codes on a Fanuc control?

G-codes command the control to perform motion, feed, speed and cycle functions, while M-codes switch machine actions such as spindle rotation, coolant and program stop. A Fanuc program uses both together, since a cut needs the right motion code and the right spindle and coolant state. The two lists are read side by side, not as separate subjects.

Which G-codes send a Fanuc machine home?

A Fanuc control returns an axis to machine home with a reference return command, and the axis moves to the position the builder set as reference. The exact address and the order of axes depend on the machine builder and on how the reference points were set. Read the builder manual for your machine, and keep the travel path clear before you run it.

Do Fanuc lathe and mill G-codes use the same numbers?

Fanuc lathe and mill controls share many G-code numbers but assign different meanings to some of them, so one list does not fit both machines. Cycles for turning and threading belong to the lathe, while milling and drilling cycles belong to the machining center. Always match the list to the machine type in front of you.

Where do I find the M-code list for a Fanuc controller?

The M-code list for a Fanuc controller is published in the machine builder's documentation, because the builder assigns many M-codes to the machine's own functions. Standard codes for spindle and program control appear in the control manual, but the rest vary by machine. Keep the builder list with the machine and update it when the machine is modified.

Read next

Advanced CNC Programming

Latest articles