M04

Machining center, Lathe

Spindle on, counterclockwise (CCW)

Format and notes

S_ M04

Most M codes are assigned by the machine builder (the Siemens ISO dialect manual leaves M00–M89 to the machine tool maker). The same number can mean different things on different machines, so always check your machine’s manual.

Try it in the simulator (machining center)

Cutting without M03 (spindle forward) gives a warning. Add S3000 M03 to line 2 and run again.

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

      Frequently asked questions about M04

      What is M04 (Spindle on, counterclockwise (CCW)) used for and how is it formatted in a CNC program?
      M04 commands "Spindle on, counterclockwise (CCW)" on Machining center, Lathe. The standard program format is "S_ M04". Left-hand (reverse) tapping (G74) cuts in with the spindle in reverse
      Is M04 a modal code or a one-shot (non-modal) code?
      Whether M04 acts modally or as a single-block command depends on the CNC control and the machine builder’s PLC ladder implementation. Check your machine’s active modal status screen and programming manual before running in auto mode.
      Does M04 work differently on machining centers (mills) versus CNC lathes?
      M04 is primarily used on Machining center, Lathe. Depending on the machine type and the lathe G-code system (System A, B, or C), this code may be unavailable or assigned to a different function, so verify against your machine tool manual.
      Are there differences in M04 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
      While the core behavior of M04 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. Mitsubishi Electric — The Basics of CNC Machining Programming (for Machining center) e-Learning material (PDF) mitsubishielectric.com
      2. Mitsubishi Electric — The Basics of CNC Machining Programming (for Lathe) e-Learning material (PDF, BNP-C8027-688) mitsubishielectric.com
      3. Haas Automation, Inc. — Mill Operator's Manual – 18 Mill M-Codes (online version) haascnc.com
      4. Haas Automation, Inc. — Lathe Operator's Manual – 17 Lathe M-Codes (online version) haascnc.com
      5. National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
      6. 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