M Code Overview

M codes belong to one of the following four execution categories:

Execute before tool change or motion.

Execute after T and S codes, but before motion.

Execute after tool change or motion.

Execute after tool change or motion (system M codes).

Understanding each M code’s execution category is important when the M code is programmed in a block that also contains axis motion and/or other machine operations such as tool change or spindle-speed commands.