G28

Machining center, LatheOne-shot, group 00

Automatic return to reference point (zero return)

Format and notes

G91 G28 Z0 (machining center) / G28 U0 W0 (lathe)

Diagram: G28: return to reference point via intermediate point

G28 motionStartIntermediate point(commanded coordinates)Reference pointReturning ZZ reference (machine)Workpiece (top = Z0)G91 G28 Z0Straight up from hereG90 G28 Z0Via Z0 (top face)
The coordinates commanded in G28 are the intermediate point on the way. The axes rapid to it first, then return to the reference point. Writing Z0 in G90 passes through the workpiece top, so return Z straight up with G91 G28 Z0.

Try it in the simulator (machining center)

G91 G28 Z0. is the standard way to send only Z home from the current position. With G90, G28 Z0. would pass through work Z0 first.

    X—
    Y—
    Z—
    T—
    S0
    F0
    —0:00

      Differences between controls and machines

      The same code can be written or assigned differently depending on the CNC control and the machine builder. Always check your machine’s manual.

      SourceMachineItemDetail
      Haas—NotesG28 with no axes returns all axes to the machine origin at onceHaas returns all axes when none is specified. On FANUC-type controls (Siemens ISO), only the specified axes return

      Frequently asked questions about G28

      What is G28 (Automatic return to reference point (zero return)) used for and how is it formatted in a CNC program?
      G28 commands "Automatic return to reference point (zero return)" on Machining center, Lathe. The standard program format is "G91 G28 Z0 (machining center) / G28 U0 W0 (lathe)". The commanded coordinate is an intermediate point: the machine first rapids there, then returns to the reference point
      Is G28 a modal code or a one-shot (non-modal) code?
      G28 is a one-shot (non-modal, Group 00) code. It acts only in the single block where it is written and does not carry over to the next block, so you must write G28 on every line where that action is required.
      Does G28 work differently on machining centers (mills) versus CNC lathes?
      G28 is primarily used on Machining center, Lathe. Depending on the machine type and the lathe G-code system (System A, B, or C), this code may be unavailable or assigned to a different function, so verify against your machine tool manual.
      Are there differences in G28 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
      Yes. Control builders such as FANUC, Mitsubishi Electric (M80/M800), Okuma (OSP), Haas, Mazak, Siemens (SINUMERIK ISO dialect), and Heidenhain can differ in argument letters, decimal-point rules, and optional parameters for G28. Review the control comparison table above and verify the exact syntax in your machine’s programming manual before proving out the program.

      Sources

      The meaning of this code agrees in two or more sources from different publishers. Explanations are written in our own words.

      1. Mitsubishi Electric — The Basics of CNC Machining Programming (for Machining center) e-Learning material (PDF) mitsubishielectric.com
      2. Mitsubishi Electric — The Basics of CNC Machining Programming (for Lathe) e-Learning material (PDF, BNP-C8027-688) mitsubishielectric.com
      3. Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0) cache.industry.siemens.com
      4. Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition cache.industry.siemens.com
      5. Haas Automation, Inc. — G-code, M-code, and Setting (per-code explanation pages) haascnc.com
      6. National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
      7. Ministry of Health, Labour and Welfare (MHLW), Human Resources Development Bureau, Office of the Councillor for Skills Evaluation — Human resource development manual using the practical exam tasks of the Grade 3 Skilled Worker Test: CNC lathe work (March 2018) waza.mhlw.go.jp