top of page

How the Heck Does G28 Work?

G28, FANUC's zero return command, tends to be one of the more misunderstood Fanuc programming words. The zero return position is, of course, the machine's reference position. A light (axis origin light) will come on for each axis that is sent to the zero return position. The zero return position is quite important: most programs begin from this location, most machines require that you (manually) send the machine to this position as part of powering up, and it's a point of reference for fixture offset (machining centers) and geometry offset (turning centers) entries. Admittedly, G28 is among the most complicated programming words. Here we attempt to clear up the confusion.


G28 is a two-step command. In a way, it's like a canned cycle. Two things will happen whenever a G28 is commanded. First the machine will move (at rapid) the axis or axes included in the G28 command to an intermediate position. Then the machine will rapid the axis or axes to the zero return position. At this point the related axis origin light/s will come on. By the way, if you have the single block switch on, you actually have to press the cycle start button twice to complete the G28 command - once for the intermediate position move, and a second time for the move to the zero return position.


The intermediate position is what confuses most people. In absolute mode, which most programmers prefer for general purpose programming, the intermediate position is specified relative to program zero. In incremental mode, it is specified relative to the tool's current position. Maybe the best way to gain an understanding is to give a few examples.


For machining centers:

Consider this command.


  • G91 G28 Z0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in Z. In step two, it will go to the zero return position in Z (only). Note that X and Y will not move. For all intents and purposes, we're telling the machine to move the tool straight to its zero return position in Z.


  • G91 G28 X0 Y0 Z0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in X, Y, and Z. In step two, it will go to the zero return position in X, Y, and Z (together). For all intents and purposes, we're telling the machine to move the tool straight to its zero return position in X, Y, and Z.


G91 G28 X0 Y0 Z3.0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in X, Y. But in Z, it will move up three inches. Maybe the tool is in a pocket you need to clear before moving in X and Y. In step two, it will go to the zero return position in X, Y, and Z (together).


Watch out! Here's what can happen in absolute mode. Consider this command.


  • G28 X0 Y0 Z0


Assuming the machine is currently in absolute mode (G90), step one of G28 tells the machine to move to the program zero point (probably a crash). Then, in step two, the machine will move to the zero return position (if it still can).


Some programmers don't like to program (ever) in incremental mode. While I don't consider using the incremental mode with G28 to be straying too far from absolute programming, there is a way to stay in the absolute mode when using G28. Consider these commands:

  • G90 G00 X1.0 Y1.0 (Rapid to hole position)

  • G01 Z-0.5 F5.0 (Drill hole)

  • G00 Z0.1 (Rapid out of hole)

  • G28 Z0.1 (First, stay right where you are in Z, then go to the zero return position in Z).

While this works, I don't like it. I show it just for the sake of explanation. Essentially, we're looking back in the program to the tools last absolute position so we can include it in the G28 command. Again, this does work, but someday you'll probably change a tool's last position. In this case you better also remember to change the related G28 command or you'll be in for a big surprise!


For turning centers:

Consider this command.


  • G28 W0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in Z. In step two, it will go to the zero return position in Z (only). Note that X will not move. For all intents and purposes, we're telling the machine to move the tool straight to its zero return position in Z.


  • G28 U0 W0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in X and Z. In step two, it will go to the zero return position in X Z (together). For all intents and purposes, we're telling the machine to move the tool straight to its zero return position in X and Z.


  • G28 U3.0 Z0


In step one of G28, the tool will move to an intermediate position that is incrementally nothing (zero) from its current position in Z. But in X, it will increase in diameter by three inches (1.5 inch move). Maybe the tool is below an obstruction (like a tailstock) you need to clear before moving in Z. In step two, it will go to the zero return position in X Z (together).

Watch out! Here's what can happen in absolute mode. Consider this command:


  • G28 X0 Z0


Note that now we're commanding G28 in absolute mode. Step one of G28 tells the machine to move to the program zero point (probably a crash). Then, in step two, the machine will move to the zero return position (if it still can).


Some programmers don't like to program (ever) in incremental mode. While I don't consider using the incremental mode for G28 to be straying too far from absolute programming, there is a way to stay in the absolute mode when using G28. Consider these commands.


G00 X3.2 Z0.005 (Rapid to facing position)G01 X-0.06 F0.012 (Face part)G00 Z0.1 (Retract in Z)X3.2 (Retract in X)G28 X3.2 Z0.1 (First, stay right where you are in X and Z, then go to the zero return position in X and Z)


While this works, I don't like it. I show it just for the sake of explanation. Essentially, we're looking back in the program to the tools last absolute position so we can include it in the G28 command. Again, this does work, but someday you'll probably change a tool's last position. In this case you better also remember to change the related G28 command or you'll be in for a big surprise!


What about G53?

Most current model Fanuc and Fanuc-compatible controls allow G53 - movement relative to the zero return position. For machining centers that allow G53, the command:


  • G53 X0 Y0 Z0


will send the machine (at rapid) straight to the zero return position in X, Y, and Z. Unfortunately, older controls do not allow G53. Since G28 works on all Fanuc and Fanuc-compatible controls, most programmers prefer to use the (complicated) G28 command so they can run their programs on all machines their company owns.

13,641 views0 comments

Recent Posts

See All

Which measurement system is initialized at power-up?

Actually, the choice between whether the Imperial measurement system or the Metric measurement system is initialized can be done on the Setting display screen page (though it is also a parameter setti

How does G66 work?

G66 is one of the more misunderstood custom macro B commands. Fanuc calls it a modal custom macro call. It looks just like a G65 command. Consider these two commands: N045 G65 P1000 X3.0 Y3.0 Z0 A45.0

What are directional vectors?

Current model CNC controls make it easy to create circular commands. You simply specify the direction (G02: clockwise or G03: counter clockwise), the end point (usually X and Y), and the radius (with

bottom of page