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

Get Instant Quote

G-code basics

How to Use M3 in CNC Machine

M3 starts the spindle clockwise. Put it in the wrong block, or with the wrong S value, and you scrap the part or break the tool. This guide shows the block format, the RPM ranges we run for common materials, and the mistakes that show up most on the floor.

M3 = clockwiseS word in RPMStart before G01Stop with M5
how to use m3 in cnc machine
Quick answer

Key takeaways

M3 turns the spindle clockwiseIt is modal. It stays active until M4, M5, or a program reset.
Write the S word in the same blockM3 S8000 gives 8,000 rpm. No S value means the previous speed stays active.
Command it before the first G01 moveThe spindle needs to reach speed before the tool touches material.
M4 is the mirror imageUse M4 for left-hand tools, back-side lathe work, and rigid tapping on some controls.
M5 stops the spindleEnd every tool with M5, then M9, then a safe Z retract.
The command

What M3 does and where it belongs in the block

M3 is a preparatory command. It tells the spindle to rotate clockwise, which is the direction you want for right-hand tooling. The speed comes from the S word in the same block. M3 S8000 means 8,000 rpm clockwise. If you write M3 with no S, the control reuses the last S value it saw, which is rarely what you intended.

Placement matters more than most people expect. The spindle needs time to accelerate. If you command M3 in the same block as the first G01 feed move, the tool can enter the cut at 1,500 rpm when you asked for 10,000. On most controls, a short dwell or a separate block before the approach solves this: M3 S8000, then G04 P0.5, then the G01 line. Check your control manual, because some fanuc-style controls wait for the spindle-at-speed signal automatically and some do not.

The command is modal. Once M3 is active, it stays active through the rest of the program until an M4, an M5, or a reset. That is why a missing S word deep in a program can run a small Ø3 mm end mill at the 12,000 rpm you set for a Ø12 mm tool earlier. Keep one S value per tool, and re-state it in the tool-change block so there is no ambiguity.

  • 1
    Correct blockN120 T3 M6 / N130 S8000 M3 / N140 G04 P0.5 / N150 G00 Z25.0
  • 2
    Common errorM3 on the same line as the first G01, so the tool enters before the spindle reaches speed.
  • 3
    Also validG97 S8000 M3 on a lathe, which locks the spindle to a fixed rpm instead of constant surface speed.
Speed selection

Choosing the S value for M3 in CNC machine work

Spindle speed comes from surface speed, not from habit. The formula is rpm = (cutting speed × 1000) ÷ (π × tool diameter). For aluminium with a carbide cutter, 300–500 m/min is a reasonable starting band. A Ø10 mm tool at 400 m/min lands near 12,700 rpm, so a 12,000 rpm spindle is close to ideal. The same cutter in 4140 steel at 120 m/min drops to about 3,800 rpm.

That number is a ceiling, not a target. Depth of cut, radial engagement, and tool stick-out all pull the real value down. A Ø6 mm end mill hanging 60 mm out of the holder will chatter at the rpm the formula gives. Reduce speed 20–30% or shorten the stick-out. The parts that come off our 16 simultaneous 5-axis centers hold ±0.005 mm, and speed choice is one of the reasons.

Small tools have an upper limit that has nothing to do with material. A Ø1 mm carbide drill in aluminium may want 20,000 rpm by the formula, but tool life falls off sharply above 15,000 rpm on many spindles because of runout and heat. Start at the lower end of the band, listen to the cut, and check the chip color. Light straw chips in steel mean the speed is close. Blue or purple chips mean it is too hot.

  • 1
    Aluminium 6061300–500 m/min with carbide, 2-flute or 3-flute, air blast or mist.
  • 2
    Steel 1045 / 4140100–150 m/min with coated carbide, flood coolant.
  • 3
    Stainless 304 / 316L60–100 m/min, keep the feed per tooth up to avoid work hardening.
  • 4
    Titanium Ti-6Al-4V40–70 m/min, climb milling, generous coolant, never dwell in the cut.
Direction

M3 vs M4: when clockwise is the wrong choice

M3 rotates the spindle clockwise when viewed from the spindle nose looking down at the part. M4 rotates it counterclockwise. For right-hand end mills, drills, and taps, M3 is correct. The cut pushes chips to the left of the feed direction, which is what the geometry expects.

M4 shows up in three places. First, left-hand cutting tools, which are rare but used in some deep-pocket and high-helix setups. Second, lathe work where the tool sits on the back side of the part or where a left-hand boring bar is used. Third, rigid tapping on some controls, where the reverse command is written as M4 rather than a spindle-orientation code. Read the control manual before you assume.

There is a real cost to getting the direction wrong. A right-hand end mill run in M4 will push the part away from the tool and pull the tool out of the holder over a long run. You will see it as poor finish first, then as a pulled tool and a scrapped part. If the cut sounds different from the last job and the finish looks smeared, check the M word before you change feeds and speeds.

  • 1
    M3Right-hand tools, milling, drilling, standard tapping.
  • 2
    M4Left-hand tools, back-side lathe work, some rigid tapping cycles.
  • 3
    M5Spindle stop. Use it at the end of every tool, before the retract.
Safety and setup

Warm-up, tool change, and the mistakes that scrap parts

Cold spindles grow. A machine that has been sitting overnight will hold a different dimension for the first 20 minutes than it will after an hour. On a job with a ±0.005 mm tolerance, we run a 10–15 minute warm-up cycle before the first cut. The program uses M3 S3000 to S6000 in steps, with the spindle running free and no tool in the cut. That is cheaper than scrapping the first part of the day.

Tool changes are where most M3 errors happen. The safest order is: M5 to stop the spindle, M9 to stop coolant, G00 Z to a safe height, then M6 for the tool change, then the new S word and M3. If you call M6 while the spindle is still turning, some controls will fault and some will not. Do not rely on the control to protect you.

One more habit worth building: never leave M3 active at the end of a program. End with M5, M9, and a G00 G91 G28 Z0 retract. An operator who hits cycle start on a program that still has M3 modal will see the spindle spin up the moment the door closes, with no tool called and no position verified.

  • 1
    Warm-up10–15 minutes, stepped speeds, no cut. Especially on tight-tolerance work.
  • 2
    Tool change orderM5, M9, safe Z, M6, new S word, M3.
  • 3
    End of programM5, M9, spindle retract, coolant off, door safe.
Procedure

Step by step: how to use M3 in CNC machine programs

Follow this order in every tool block. The numbers are starting points, not fixed rules.

  • 1
    Confirm the tool and holderLoad the right tool, measure stick-out, and check runout. A Ø10 mm end mill with 0.02 mm runout will not hold finish no matter what rpm you pick.
  • 2
    Stop the spindle before the changeWrite M5 and M9, then retract Z to a safe plane. Never call M6 with M3 still modal.
  • 3
    Pick the S value from surface speedUse rpm = (cutting speed × 1000) ÷ (π × diameter). Aluminium 300–500 m/min, steel 100–150 m/min, stainless 60–100 m/min as starting bands.
  • 4
    Write M3 in its own block with the S wordM3 S8000 on one line. Do not split M3 and S across two blocks unless you have a reason.
  • 5
    Wait for spindle-at-speedAdd G04 P0.5, or use the control's spindle-at-speed wait. Small spindles need 0.3–1.0 s to reach 10,000 rpm.
  • 6
    Approach, then cutG00 to the start point, then G01 into the material. Let the first 2–3 mm of feed confirm the sound and the chip color before you trust the rest of the path.
  • 7
    Watch the first partCheck chip color and shape. Light straw in steel is right. Blue or purple means reduce speed or increase feed.
  • 8
    Stop cleanly at the end of the toolM5, M9, safe Z retract. Repeat the M3 block for the next tool with its own S value.
Reference

M3 command reference and common errors

Match the symptom to the cause before you change feeds and speeds.

Block or symptomWhat it meansWhat to do
M3 S8000Clockwise at 8,000 rpmStandard for right-hand tools
M3 with no SPrevious S value stays activeRe-state S in every tool block
M4 S8000Counterclockwise at 8,000 rpmLeft-hand tools, back-side lathe work
M5Spindle stopUse before M6 and at program end
Tool enters cut below set rpmM3 too close to first G01Add G04 P0.5 or a separate block
Finish looks smeared, tool pulls outM4 used with a right-hand toolSwitch to M3
First part of the day is oversizeCold spindle, no warm-upRun 10–15 min warm-up cycle
Small tool breaks earlyrpm above the practical limitCap at 15,000 rpm and check runout

Get the M3 block right and the rest of the program has a chance

Spindle direction, S value, and timing are three decisions that decide whether the cut works. Set them per tool, wait for spindle-at-speed, and stop cleanly at the end.

FAQs

M3 questions we get from engineers

Does M3 need an S word every time?

Not strictly, because the command is modal and the control remembers the last S value. In practice, write the S word in every tool block. A forgotten S is one of the most common causes of a small tool running at a large tool's rpm.

How long should I wait after M3 before the first cut?

Enough for the spindle to reach the commanded speed. On most machines that is 0.3–1.0 s for speeds up to 12,000 rpm, and longer for high-speed spindles. A G04 P0.5 dwell covers most cases. If your control has a spindle-at-speed wait, use it instead of a fixed dwell.

Can I use M3 on a lathe?

Yes. On a lathe, M3 is usually written with G97 for a fixed rpm, or with G96 for constant surface speed where the control adjusts rpm as the diameter changes. With G96, the S value is surface speed in m/min or ft/min, not rpm. Read the control manual before mixing the two.

What is the difference between M3 and M13?

M13 is a combined command: spindle clockwise plus coolant on. It saves a block but ties two functions together. We prefer separate M3 and M8 lines because it is easier to debug when coolant or spindle behaves unexpectedly.

Why does my spindle fault when I call M6 after M3?

Because the spindle is still turning. The tool change macro expects a stopped spindle. Write M5 and M9 before M6. Some controls enforce this with a fault, others do not, which is why the habit matters more than the alarm.

Do I need M3 for rigid tapping?

Yes, for a right-hand tap, and the control will reverse the spindle for retract. Some controls use M4 for the reverse leg and some handle it inside the G84 cycle. The tap must match the spindle direction, so verify the cycle with a dry run above the part.

Send us your drawing and we will review the program

Upload a STEP file and we will return a quotation and a free DFM analysis within 12 hours. Production can start within 24 hours, and every part ships after 100% inspection.

12-hour quote100% inspection±0.005 mmNo MOQ

Follow

More machining notes from our 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