GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

CNC mill homing guide

How to Send a Home Zero CNC Mill With G-Code

Reference return is the first move of every safe program. This guide shows the exact G-code sequence, the parameters you must set first, and the errors that turn a homing move into a crash. Written for operators and engineers running Fanuc, Haas, Siemens or LinuxCNC controls.

G28 vs G53Soft limitsFeed 25–50%Reference return
how to send machine to home zero cnc mill gcode
Quick answer

Key takeaways

G28 is a move, not a switchG28 X0 Y0 Z0 tells the control to move through an intermediate point to the reference position. Skip the intermediate point and the machine takes the shortest path, which may be through the vise.
G53 works only in machine coordinatesG53 is a one-block command. It must sit on the same line as the axis move, and it ignores work offsets. G53 G0 Z0 lifts Z to machine zero.
Home the Z axis first, alwaysLifting Z before X and Y clears the tool from the stock and the clamps. Homing X and Y first drags a cutter sideways through whatever is in the way.
A nonzero readout after homing is normalMany controls park the reference position a few millimeters off the switch trip point. The value is a parameter, not an error.
Set soft limits before the first G28Soft limits are software travel boundaries. Without them, a wrong sign in the intermediate point sends the axis into the hard stop at full rapid.
Background

What home zero means on a CNC mill

Home zero is the fixed machine reference. Every work offset, every tool length, and every G54 through G59 value is measured from it. The control does not know where the table is when you power up, because most mills use incremental encoders. Homing drives each axis until a limit switch or an absolute encoder reference mark trips, then the control assigns that point a known machine coordinate.

That assignment is why homing matters more than most operators think. If the reference is off by 0.05 mm, every part on that setup shifts by 0.05 mm. On a home zero cnc mill running a ±0.005 mm tolerance, that error is ten times the allowed band. You cannot inspect your way out of a bad reference.

Older mills use mechanical limit switches with a repeatability of roughly 0.01 mm. Better machines use inductive proximity switches or glass-scale reference marks, which hold closer. The axis decelerates, trips the switch, backs off, then approaches at a slow feed. That final slow approach is what gives you repeatability. If your machine slams into the switch at rapid, the reference point will drift part to part.

  • 1
    Machine zeroThe controller's fixed origin. Set by homing, not by the operator.
  • 2
    Work zeroYour part origin, stored in G54–G59 offsets relative to machine zero.
  • 3
    Reference returnThe axis move itself, usually G28 or a controller-specific button.
Before you press cycle start

Pre-checks before you send the machine home

Do these checks with the machine stopped. A homing move at rapid into a fixture is the most expensive mistake in this whole procedure, and it takes about forty seconds to prevent.

Clear the envelope. Remove the vise handle, the indicator arm, the chuck key, and any parallel left on the table. Swing the spindle by hand if the control allows a handwheel mode. Anything within the axis travel will be hit.

Check the feedrate override. Set it to 25–50% for the first homing move after a crash, a battery change, or a controller parameter edit. Once the sequence proves repeatable, run at 100%. There is no prize for homing at full rapid.

Confirm the soft limit parameters and the grid shift values are the ones you expect. If someone zeroed the absolute encoder on the wrong side of the switch, homing will drive the axis the wrong way and trip a hard limit. That stops the machine but usually bends nothing. Usually.

  • 1
    Envelope clearNo tooling, clamps or handles inside the travel envelope.
  • 2
    Override 25–50%First homing move after any service or parameter change.
  • 3
    Air and hydraulics onSome machines refuse to home without clamp pressure present.
  • 4
    E-stop within reachHand on the button for the first move, not on the keyboard.
Control differences

Homing behavior on Fanuc, Haas, Siemens and LinuxCNC

Fanuc controls use G28 with an intermediate point stored by G28.1. Absolute encoder machines may not need a reference return at all after a power cycle, but they still need a manual reference once after a battery change. Check parameter 1815 or the equivalent for the absolute position bit.

Haas mills accept G28 and also have a dedicated Zero Return button. Haas machines home Z first by default, then X and Y. The order is set in settings and should not be changed without reason.

Siemens 828D and 840D controls use G74 for reference approach, not G28. Running a Fanuc-style G28 on a Siemens control will either alarm out or do something unexpected. Read the control family before you type anything.

LinuxCNC and Mach3 use G28 and G28.1 in a way that is close to Fanuc, but the homing sequence itself is defined in the configuration file, not in G-code. On those controls, the reference switches and the homing order live in the .hal or .ini file, and the G-code only calls the result.

  • 1
    FanucG28 plus G28.1. Check parameter 1815 for absolute encoders.
  • 2
    HaasG28 or the Zero Return key. Z homes first by default.
  • 3
    SiemensG74, not G28. Verify the control family first.
  • 4
    LinuxCNCG28 calls a sequence defined in the config file.
Troubleshooting

Common homing problems and what causes them

Axis runs the wrong way. The axis direction parameter or the encoder polarity is inverted. Stop the move, fix the parameter, and re-home. Do not let it reach the hard stop; a hard limit trip on a ballscrew can damage the coupling.

Machine homes to a different point every cycle. The switch is loose, contaminated with chips, or the slow approach feed is too fast. Clean the switch, check the mounting, and reduce the final approach feed to 50–100 mm/min. Repeatability should improve to within a few hundredths of a millimeter.

Control alarms out mid-homing with an overtravel or servo error. The grid shift or the soft limit is set inside the physical travel. On Fanuc, check the grid shift parameter. On other controls, check the reference position offset. The axis should reach the switch before the soft limit trips.

Z does not lift before X and Y. The G28 block order is wrong, or the intermediate point was stored below the current position. Re-store the intermediate point at a safe height, well above the tallest fixture in the cell. Keep it clear of the tool changer arc as well.

  • 1
    Wrong directionAxis direction parameter inverted. Fix before re-homing.
  • 2
    Repeatability driftLoose or dirty switch, or approach feed too fast.
  • 3
    Overtravel alarmGrid shift or soft limit set inside physical travel.
  • 4
    Crash on the way to referenceIntermediate point stored below the fixture.
Procedure

Step-by-step: send the mill to home zero

Run this in MDI or single block the first time. Keep the feed override low until the sequence repeats.

  • 1
    Power up and release the E-stopEnergize the control, release the E-stop, and reset any alarm. Do not jog yet. Many controls ignore a homing call while an alarm is active, and a few will move anyway. Confirm the axis position display is blinking or marked as unreferenced.
  • 2
    Lift Z clear with G53Enter G53 G0 Z0 in MDI at 25% override. This moves Z to machine zero in one block, ignoring the work offset. If the machine is already near the top, it will barely move. If it moves down, stop immediately; the axis direction parameter is wrong.
  • 3
    Home Z with G28Enter G91 G28 Z0. The G91 makes the intermediate point incremental, so the machine goes straight up to the Z reference. Listen for the deceleration and the slow re-approach. A single hard hit with no slow approach means the switch or the grid shift needs attention.
  • 4
    Home X and Y togetherEnter G91 G28 X0 Y0. Both axes travel to their reference positions. Keep the override at 25–50%. On a knee mill or a machine with a quill, confirm the quill is retracted before this move.
  • 5
    Verify the machine position readoutCheck the machine coordinate display. Most controls show a small nonzero value because the reference sits slightly off the switch trip point. Compare against the value recorded after the last successful homing. It should repeat within the switch repeatability, roughly 0.01 mm on mechanical switches.
  • 6
    Re-establish the work offsetAfter homing, the G54–G59 values are still valid only if they were set from the same reference. Touch off again if the machine lost position, changed batteries, or was crashed. Re-check tool length offsets on at least the first tool.
  • 7
    Run a dry pass above the partLoad the program, raise Z by 50 mm in the offset, and run at rapid with the spindle off. Watch the first approach move. If the tool dives toward the part before the first cutting move, the work offset or the G28 intermediate point is wrong.
Command reference

G-code and M-code commands used for homing

Behavior differs by control. Verify against the machine builder's manual before running any of these.

CommandWhat it doesTypical useWatch out for
G28Reference return through an intermediate pointG28 G91 Z0 then G28 X0 Y0Without G91 the intermediate point is absolute and may be unsafe
G28.1Stores the current point as the G28 intermediate positionSet once, then reuseStored value may sit inside the fixture after a job change
G53One-block move in machine coordinatesG53 G0 Z0 to lift Z clearMust be on the same block as the move, never modal
G30Second reference return pointTool change or pallet positionOnly exists if the builder defined it in parameters
G91 G28 Z0Incremental zero return on Z onlyLift Z before any X Y motionG91 stays active until G90 cancels it
M91 / M92Controller-specific axis homing callsOlder Fanuc and some routersNot universal; wrong M-code can call a tool change instead
M19Spindle orientationPre-homing on machines with a spindle clampOrientation must finish before Z is released

Home Z first, every time

If you take one rule from this page: lift Z to machine zero before any X or Y move, and keep the feed override at 25–50% until the sequence repeats. A homing move is the cheapest place to be careful and the most expensive place to guess.

FAQs

Frequently asked questions

Do I have to home the mill every time I start it?

On a machine with incremental encoders, yes. The control has no position data until each axis trips its reference. Without homing, the work offsets and tool lengths mean nothing.

On a machine with absolute encoders, the position survives a power cycle as long as the backup battery holds. You still need to home once after a battery change, a servo swap, or a parameter edit.

Can I home one axis instead of all three?

Yes. G91 G28 Z0 homes Z alone, and G91 G28 X0 homes X alone. This is useful when you only lost one axis, or when a fixture blocks travel on another axis.

The risk is forgetting which axes are referenced. Most controls will not let a program run until every axis shows a reference, but some will. Check the position display before you trust it.

What is the difference between G28 and G28.1?

G28 is the reference return move. G28.1 stores the current point as the intermediate point that G28 passes through on the way to the reference.

The intermediate point is a safety position. Set it once, well above the tallest fixture, and it protects you every time G28 runs.

Why does the display show a nonzero value after homing?

Most controls assign the reference position a value that sits a short distance off the switch trip point. That offset is a parameter, and it exists so the switch does not have to trip at the exact machine origin.

A value that changes every cycle is a different problem. That points to switch repeatability, a loose mount, or an approach feed that is too fast.

Can homing damage the machine?

Homing itself is gentle when the switch and the grid shift are set correctly. Damage happens when the axis runs the wrong way, when the intermediate point sits inside a fixture, or when the override is at 100% after a service.

Set the override to 25–50%, keep a hand on the E-stop, and verify the direction on the first move.

Does GreatLight home machines the same way on the shop floor?

Our 127 CNC machines follow the same reference-return discipline described here, with documented warm-up and re-reference points between setups. Process control is part of how we hold ±0.005 mm across a production run.

If a part needs a specific setup or an unusual fixture, send the drawing and we will review the machining plan before quoting.

Need parts machined to a repeatable reference?

Upload your drawing and we will return a quotation with a DFM review within 12 hours. No minimum order quantity, from one prototype to 10,000+ parts.

12-hour quote100% inspection±0.005 mmNDA on request

Follow GreatLight

More machining notes from the shop floor

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC