G40

Machining center, LatheModal, group 07

Cutter radius compensation cancel

Format and notes

G40 G01 X_ Y_ (cancel in a block that includes a move)

Diagram: Cutter radius compensation: left (G41) and right (G42) of travel direction

Programmed pathG41 (left)G42 (right)Tool center path (dotted)Facing the traveldirection (arrow):Tool on left → G41Tool on right → G42No compensation → G40With spindle CW (M03):G41 = climb millingG42 = conventional millingOffset amount is thetool radius under the D no.
When canceled with G40, the tool center runs on the programmed path (the contour is undercut by the tool radius). Cancel with a straight lead-out move, not an arc.

Try it in the simulator (machining center)

G41 offsets the tool to the left of the travel direction by its radius, leaving X10–70, Y10–50. Remove D1 or change to G42 and watch the shape change.

    X—
    Y—
    Z—
    T—
    S0
    F0
    —0:00

      On lathes: Tool nose radius compensation cancel

      On lathes (FANUC-type G-code system A) the code does the same job. Group 07.

      Diagram (lathe): tool nose radius compensation, imaginary tip and nose center

      ZXG42 nose-center pathImaginary tipWithout compensation, tapers and arcsare left undercut (orange)OD toward Z− (tool on the right) → G42ID toward Z−, face toward X− → G41
      With G40 (no compensation) the imaginary tip follows the program path. Faces parallel to X and Z come out to size, but tapers and arcs are left uncut as shown in orange (overcut on the inside).

      Frequently asked questions about G40

      What is G40 (Cutter radius compensation cancel) used for and how is it formatted in a CNC program?
      G40 commands "Cutter radius compensation cancel" on Machining center, Lathe. The standard program format is "G40 G01 X_ Y_ (cancel in a block that includes a move)". Do not cancel in an arc block. Cancel with a straight-line move-away
      Is G40 a modal code or a one-shot (non-modal) code?
      G40 is a modal code (Group 07). Once commanded, it remains active across subsequent blocks until another code from the same modal group overrides it or the control is reset. Always state or cancel modal states explicitly in your safety block and at the end of a tool operation so residual modes do not cause unexpected motion when restarting mid-program.
      Does G40 work differently on machining centers (mills) versus CNC lathes?
      On both machining centers and CNC lathes (G-code System A), G40 performs the same function ("Cutter radius compensation cancel"). However, valid axis addresses (such as X/Y/Z versus diameter/incremental U/W) and parameter numbers can still differ between mill and lathe controls.
      Are there differences in G40 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
      While the core behavior of G40 is shared across most ISO-compatible CNC controls (FANUC, Mitsubishi Electric, Haas), controls using native conversational or proprietary dialects (such as Okuma OSP, Siemens native mode, or Heidenhain) or machine-specific M-code tables may use different syntax. Always verify with single-block execution and distance-to-go display on a new machine.

      Sources

      The meaning of this code agrees in two or more sources from different publishers. Explanations are written in our own words.

      1. 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
      2. Haas Automation, Inc. — Mill Operator's Manual – 17 Mill G-Codes (online version) haascnc.com
      3. National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
      4. Saitama University, Faculty of Engineering, Department of Mechanical Engineering, practical training — Machining center program 2019 (training NC program O19-0101, with comments) jisshu.mech.saitama-u.ac.jp
      5. Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition cache.industry.siemens.com
      6. Haas Automation, Inc. — Lathe Operator's Manual – 16 Lathe G-Codes (online version) haascnc.com
      7. 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