M99: Subprogram end / return
What M99 does
M99 at the end of a subprogram returns control to the line after the M98 that called it. In a main program, M99 loops back to the start, which some bar-fed lathes use to run continuously.
| Type | M-code |
|---|---|
| Machine | Mill and lathe |
| Group | Program control |
| Modal | No: acts only on its own line |
M99 example
M99 Return to the calling program.
| Word | What it means here |
|---|---|
M99 | Subprogram end / return |
Codes people confuse with M99
| Code | What it does instead |
|---|---|
M98 | Subprogram call. Calls another program as a subprogram. |
M30 | End of program and rewind. Ends the program and returns to the first line, ready for the next part. |
Other codes in the program control group
These also act only on their own line.
Meanings follow the common Fanuc-style standard that Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls share for this code. Options and parameters change details from machine to machine, so check the manual for your control.
Quick check: M99
-
What does
M99do? (Mill and lathe) -
Which code: Ends a subprogram and returns to the calling program.(Mill and lathe)
-
What does
M98do? (Mill and lathe)
Show the answers
- Ends a subprogram and returns to the calling program.
- M99
- Calls another program as a subprogram.
Frequently asked questions
- What does M99 mean in CNC programming?
- Subprogram end / return. Ends a subprogram and returns to the calling program.
- Is M99 modal?
- No. M99 acts only on the line where it is written; the next line goes back to whatever modal codes were already active.
- What is the difference between M99 and M98?
- M99 (subprogram end / return): ends a subprogram and returns to the calling program. M98 (subprogram call): calls another program as a subprogram.
- What is the difference between M99 and M30?
- M99 (subprogram end / return): ends a subprogram and returns to the calling program. M30 (end of program and rewind): ends the program and returns to the first line, ready for the next part.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.