G-code reference

G28: Return to reference position

G28 is return to reference position. Sends the named axes home, by way of an intermediate point. It is non-modal, so it acts only on the line it is written on.

What G28 does

G28 moves the named axes to the machine reference (home) position at rapid, passing first through the point given on the line. That intermediate point is why G28 is usually written with G91 and zero values, such as G91 G28 Z0: it means go straight up from where you are, then home. Written in G90 with Z0, the tool would first rapid down to work Z0.

TypeG-code
MachineMill and lathe
GroupNon-modal
ModalNo: acts only on its own line

G28 example

G91 G28 Z0.

Go home in Z straight from the current position.

WordWhat it means here
G91Incremental positioning
G28Return to reference position
Z0.Z axis target or depth

Codes people confuse with G28

CodeWhat it does instead
G30 Return to second reference position. Like G28, but to a second stored position, often the tool-change point.
G53 Machine coordinate move. Moves to a position in machine coordinates for this one line.

Memory hook: Always read G28 with the G90/G91 that is active on the same line.

Where controls differ

  • Lathes (system A): Written G28 U0. W0. because U and W are the incremental axes.

Other codes in the non-modal group

These also act only on their own line.

  • G04 Dwell
  • G09 Exact stop (one block)
  • G10 Programmable data input
  • G30 Return to second reference position
  • G50 Maximum spindle speed (lathe)
  • G52 Local coordinate system
  • G53 Machine coordinate move
  • G65 Macro call
  • G92 Set coordinate system (shift)

Meanings follow the common Fanuc-style standard that Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls share for this code. Options and parameters change details from machine to machine, so check the manual for your control.

Quick check: G28

  1. What does G28 do? (Mill and lathe)

  2. Which code: Sends the named axes home, by way of an intermediate point.(Mill and lathe)

  3. What does G30 do? (Mill and lathe)

Show the answers
  1. Sends the named axes home, by way of an intermediate point.
  2. G28
  3. Like G28, but to a second stored position, often the tool-change point.

Drill this code with the rest of the core set

More practice hubs

Frequently asked questions

What does G28 mean in CNC programming?
Return to reference position. Sends the named axes home, by way of an intermediate point.
Is G28 modal?
No. G28 acts only on the line where it is written; the next line goes back to whatever modal codes were already active.
What is the difference between G28 and G30?
G28 (return to reference position): sends the named axes home, by way of an intermediate point. G30 (return to second reference position): like G28, but to a second stored position, often the tool-change point. A way to remember it: always read G28 with the G90/G91 that is active on the same line.
What is the difference between G28 and G53?
G28 (return to reference position): sends the named axes home, by way of an intermediate point. G53 (machine coordinate move): moves to a position in machine coordinates for this one line. A way to remember it: always read G28 with the G90/G91 that is active on the same line.

G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.

Free preview · no card Try G-Code Sprint