Printed from Kezuriba (kezuriba.net/en/nc/g28/)
G28
Machining center, LatheOne-shot, group 00Automatic return to reference point (zero return)
Format and notes
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
- Writing G28 X0 Y0 Z0 under G90 passes through the work origin. To avoid creating an intermediate point, use G91 G28 Z0 (U0/W0 on lathes)
- On machining centers it is safer to raise Z first, then return X and Y (Mitsubishi machining center material)
- On lathes, returning X(U) and Z(W) one after the other in separate blocks reduces the risk of interference (Mitsubishi lathe material)
- Axes that are not written do not return
Diagram: G28: return to reference point via intermediate point
Full guide with examples: Machining center programming basics (practise G54, G43 and G41 in a simulator)
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
Simulator with exercises: Machining center page
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.
| Source | Machine | Item | Detail |
|---|---|---|---|
| Haas | — | Notes | G28 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.
- Mitsubishi Electric — The Basics of CNC Machining Programming (for Machining center) e-Learning material (PDF) mitsubishielectric.com
- Mitsubishi Electric — The Basics of CNC Machining Programming (for Lathe) e-Learning material (PDF, BNP-C8027-688) mitsubishielectric.com
- 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
- Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition cache.industry.siemens.com
- Haas Automation, Inc. — G-code, M-code, and Setting (per-code explanation pages) haascnc.com
- National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
- 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