Fanuc CNC Milling Program G91 G41 G43
Here is a simple example of how G91, G41 and G43 work together in a Fanuc-compatible CNC milling program.
This is a standard Fanuc-style CNC milling program written in inches (G20) using absolute (G90) and incremental (G91) positioning modes. It performs a simple rectangular pocket or contour milling operation using cutter radius compensation (G41).

O1001
G17 G20 G40 G80 G90
T1 M06
G00 G90 X-1.0 Y-1.0
G43 Z1.0 H01 M03 S2000
Z0.1
G91
G01 G41 X1.0 Y0.0 D01 F10.0
Y2.0
X2.0
Y-2.0
X-2.0
G40 X-1.0 Y0.0
G90
G00 Z2.0
M30
- O1001: Program number.
- G17 G20 G40 G80 G90: Safety block setting the XY plane selection, inch units, cancellation of cutter compensation and canned cycles, and absolute positioning mode.
- T1 M06: Tool change to Tool 1.
- G00 G90 X-1.0 Y-1.0: Rapid traverse in absolute mode to the starting coordinates outside the target profile.
- G43 Z1.0 H01 M03 S2000: Applies tool length compensation using offset register H01, turns the spindle on clockwise at 2000 RPM, and positions the Z-axis at Z1.0.
- Z0.1: Moves the cutter down.
- G91: Switches to incremental positioning mode.
- G01 G41 X1.0 Y0.0 D01 F10.0: Engages cutter radius compensation left (G41) using offset D01, moving incrementally by X1.0 at a feed rate of 10.0 IPM.
- Contour Path (Y2.0, X2.0, Y-2.0, X-2.0): Cuts a rectangular path incrementally.
- G40 X-1.0 Y0.0: Cancels cutter compensation while stepping off the profile.
- G90: Switches back to absolute positioning mode.
- G00 Z2.0: Rapidly retracts the tool safely above the part.
- M30: Ends the program.
