How Does a CNC Machine Know Where to Start?
A CNC machine starts from a work offset, not from a guess. This guide explains how the control turns program zero into real axis motion, and how setup people establish that zero on the machine. Read it if you program, set up, or quote machined parts and need to judge whether a shop can hold position from the first cut.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Short answers first
How a CNC machine knows where to start
Every CNC control keeps a machine coordinate system that never changes. The X, Y, and Z numbers on the position display refer to that fixed frame, whose origin sits at the machine reference point set by the home switch or absolute encoder. When you press Zero Return, the machine moves to that point and the control knows exactly where the slide is. No part geometry is involved yet.
A program is written around a different origin: program zero, also called part zero or W. The control converts program coordinates into machine motion by adding the active work offset. If G54 holds X = -320.500 mm, then program X0 means machine X -320.500 mm. That single shift is the whole trick behind how does a cnc machine know where to start — it does not search for the part, it applies a stored offset to a known reference.
The practical consequence is that the offset values, not the program, decide where metal gets cut. Two identical programs run with different G54 values produce parts in two different places. So the setup person's real job is to measure the distance from the machine reference to the part datum and enter it accurately. Everything downstream depends on that measurement.
On multi-axis machines the chain grows. A rotary table adds A, B, or C axes and often a separate work offset for the tilted plane. A 5-axis job may combine G54 with G54.1 P1 through P48 for different part faces. Each one is still just a stored offset from the same machine reference.
- 1Machine zeroFixed by the builder, set once at home or by absolute encoder.
- 2Work offset (G54–G59)Your stored distance from machine zero to the part datum.
- 3Tool length offset (H)Distance from spindle gauge line to the cutter tip.
- 4Program zeroThe X0 Y0 Z0 the CAM post processor wrote the toolpaths around.
Choosing the datum the control will trust
Pick a datum the machine can find and the inspector can repeat. On a rectangular plate, a corner plus a top face works well. On a round housing, the main bore center is better because the bore controls the fit. On a part with a machined boss, use the boss. The rule is simple: pick a feature that exists in the drawing, is easy to touch off, and is stable after the first operation.
Think about the sequence before you choose. If operation one machines the datum face, then operation two can trust it. If you touch off on a raw casting surface, you inherit the casting tolerance, which may be ±0.5 mm or worse. That error goes straight into the finished part unless the program leaves enough stock.
The coordinate system itself is Cartesian: X, Y, and Z at right angles, with A, B, and C as rotations about each. On a mill, Z usually points along the spindle. On a lathe, Z runs along the bed and X is the cross slide, with the part rotating instead of the tool. Same math, different geometry.
Direction conventions matter for the offset sign. On most mills the tool moves in positive Z to retract. On most lathes X is a diameter, so a program X value is twice the radial distance. Mixing these up gives a first cut in the wrong direction, which is the most expensive kind of mistake.
- 1Stable over the runA machined face or bore will not shift as the batch heats up.
- 2Reachable by the probeIf the stylus cannot reach the feature, the operator has to touch off by hand.
- 3Repeatable for the next orderFixture stops and probe routines let the job restart without re-trimming.
Three ways operators establish the start point
Manual touch-off is still the most common method in job shops. The operator jogs the tool or an edge finder against the part, then stores the position into G54 using the control's Measure or Calculate function. With an edge finder of known Ø10 mm, you touch one side, touch the other, split the difference, and set the center. Accuracy lands near ±0.02 mm, which suits many jobs but not tight bores.
A touch probe removes the human feel from the loop. The probe stylus touches the surface, triggers, and the control writes the offset automatically. Renishaw-style routines find a corner, a bore center, or a boss in seconds, usually within ±0.005 mm. Probing also lets you re-check the datum after roughing, so thermal drift gets corrected before finishing.
MDI entry is the third route. The operator types a coordinate or a G10 line into the control and the offset updates. It suits quick corrections, fixtures that never move, or a machine that runs the same family of parts for months. The risk is transcription: one wrong digit moves the whole part. We keep a written offset sheet for every job so the numbers can be checked against the last run.
On lathes the sequence differs. The operator faces the part to establish Z0, then turns a diameter and measures it to set X, using the control's diameter-measure function. Tool nose radius compensation is stored separately in the offset table, so the same tool can rough and finish with different comp values.
Where each cutter actually touches
A work offset alone does not define the cut. The control also needs to know how long each tool is. Tool length offsets, stored in the H registers, record the distance from the spindle gauge line to the cutter tip. Set them with a tool presetter offline or with a touch-off block on the machine. A pre-setter keeps the spindle free and usually repeats within ±0.005 mm.
Diameter wear matters just as much. A Ø12 mm end mill that measures Ø11.96 mm after a few hours will cut a slot 0.04 mm undersize. Cutting parameters and tool wear values in the control let you compensate without rewriting the program. For critical bores, measure the first part and adjust the wear column, not the geometry.
The order of operations is fixed for a reason. Home the machine, load the part and fixture, set the work offset, set every tool length, then run a dry pass. Skipping a step means the first real cut happens with an unknown in the chain. On a 5-axis job we also verify the rotary center point, because a small error there turns into a large error at the part corner.
- 1Presetter over touch-offFaster on multi-tool jobs and it keeps the spindle cutting.
- 2Wear column, not geometryUse wear offsets for tool drift; reserve geometry for setup.
- 3Log every changeA written record makes the next run reproducible.
When the first cut lands in the wrong place
An offset in the wrong direction is the classic failure. If the part is shifted by roughly the stock thickness, check whether you touched off the raw face instead of the machined face, or entered the offset in the wrong G54 column. Compare the stored value against the setup sheet before changing the program.
A part that is correct on the first piece and drifts over the batch usually points to thermal growth or fixture movement. Check the coolant temperature, the spindle warm-up routine, and the clamping torque. On aluminium, a 5 °C shop swing can move a 300 mm part by more than 0.01 mm.
A single dimension out of tolerance while the rest are good suggests tool wear or a wrong wear offset, not a work offset problem. If the whole part is shifted, it is the work offset. If one feature is off, it is the tool.
On 5-axis work, an error that grows with tilt angle points to the rotary center point or the pivot distance, not to G54. Re-measure the rotary center with a test bar and update the machine parameters before touching the offsets.
- 1Whole part shiftedWork offset or program zero error.
- 2One feature offTool length or wear offset.
- 3Error grows with tiltRotary center point or pivot distance.
- 4Drift over the batchThermal growth or fixture clamping.
Step by step: establishing the start point
Follow this order on a 3-axis mill. Numbers are typical ranges, not promises.
- 1Home the machine and confirm referenceRun Zero Return on all axes and check that the position display reads the reference values. On absolute-encoder machines, verify the battery status instead. A machine that has lost reference will accept any offset you enter and cut in the wrong place.
- 2Clean the fixture and load the partWipe chips from the vise jaws, stops, and the part's locating faces. Seat the part against both stops and clamp it with even torque. A 0.05 mm chip under a jaw becomes a 0.05 mm tilt across the part.
- 3Decide and mark program zeroMatch the CAM setup sheet: corner, bore center, or boss. Confirm the Z datum is the top face or a specific step, not the raw stock. Write it on the setup sheet so the next operator reads the same thing.
- 4Set the work offset (G54)Probe or touch off X, Y, and Z. For a corner datum, touch both sides and split the difference. Store the values in G54 and re-read the display to confirm the numbers match the sheet.
- 5Set every tool length offsetMeasure each tool with a presetter or touch-off block, and enter the H values. Double-check the tool numbers against the program's T and H calls. A swapped H value drives the cutter into the vise.
- 6Verify with a dry runRaise Z 50 mm above the part, run with rapid override at 25%, and watch distance-to-go on every approach. Single block through the first tool change. Any unexpected move means stop and re-check the offset.
- 7Cut air, then cut the first partRun the finishing path in air to confirm the geometry, then take a light roughing pass at reduced feed. Measure the first part before releasing the run to the rest of the batch.
- 8Record and lock the offsetsWrite the final G54 and H values on the setup sheet, and use the control's offset lock or a program note. The next run then starts from numbers, not from memory.
Which start-point method fits the job
Pick by tolerance, batch size, and how often the setup repeats.
| Method | Typical accuracy | Best for | Watch out for |
|---|---|---|---|
| Manual touch-off | ±0.02 mm | One-offs, simple plates | Operator feel varies |
| Edge finder | ±0.01 mm | Corners and edges | Spindle speed must be right |
| Touch probe | ±0.005 mm | Bores, bosses, repeat runs | Stylus damage goes unnoticed |
| MDI / G10 entry | Depends on input | Fixed fixtures, long runs | Transcription errors |
| Preset tool lengths | ±0.005 mm | Multi-tool jobs | Needs a presetter or setter |
| Fixture hard stops | ±0.05 mm | Rough location only | Never use alone for finishing |
Questions engineers ask about setup zero
Does the CNC machine find the part by itself?
No. The control only knows its own machine coordinate system. It moves to program coordinates plus the work offset you stored.
A touch probe automates the measurement, but a person still decides which feature is the datum and which offset register holds it.
What is the difference between G54 and G92?
G54 is a stored work offset that stays in the control until you change it. G92 sets a temporary shift inside the program and is cleared or overwritten by later code.
For production work, G54 through G59 are safer because the values survive power cycles and can be checked before the run.
How tight can a probed datum be?
A clean surface and a calibrated stylus typically repeat within ±0.005 mm. Contaminated surfaces, chips, or a bent stylus will be worse.
We probe the datum again after roughing on tight jobs, which removes most of the thermal drift before finishing.
Why does the first part measure correctly but the tenth one drift?
Heat is the usual cause. The spindle, ballscrews, and coolant all warm up during the first hour, and the machine geometry moves with them.
A warm-up cycle, stable coolant temperature, and a mid-batch probe check keep the drift inside ±0.005 mm on most jobs.
Do you need a different offset for each part face on 5-axis work?
Often yes. Each face may use its own offset, or a G68 plane rotation combined with G54, so the CAM output stays readable.
The rotary center point is measured once and stored in the machine parameters, then reused across jobs on that machine.
What should be on a setup sheet?
The datum feature, the offset registers in use, every tool length value, the fixture stop positions, and the last measured first-part results.
With that record, a repeat job can be set up without re-trimming from scratch.
Send us the drawing and we will set the zero
Upload your CAD file and we return a quotation with DFM feedback within 12 hours. We machine from one prototype to 10,000+ parts, hold ±0.005 mm, and inspect 100% before shipment. Your files stay confidential, and an NDA is available on request.
12-hour quote and DFM±0.005 mm toleranceNo minimum order quantityISO 9001 / IATF 16949