All G And M Codes for CNC Lathe Machine Programming – The Today Blog

5/5 - (1 vote)

Want to Know the all G & M Codes of the CNC Lathe Turning Machine? In this article, I will tell you the All G-Code and M-Code Command for Lathe Machine. if you have worked on a CNC machine or are Working on it you definitely know how important these codes are.

What is G-Code?

G-Code stands for “Geometric Code”. It is a programming language for CNC (Computer Numerical Control) machines. which tells the machine how to perform a task, where to move, how fast to move, and which path to follow.

g and m code for cnc machine

The cutting tool is driven by these G-code and M-code Commands in a CNC lathe machine.

What is M-Code?

The M-code is a set of auxiliary commands which is used to control all the machine’s non-geometric actions. People refer to it as a miscellaneous codes command as it is used to control the non-cutting actions such as stoping the machine, folding the machine with coolant, and shutting it after the temperature drop.

Difference Between G-Code and M-Code?

there are lots of differences between G-Code and M-Code in CNC Machine Programming.

G Code differs from lots of MachinesM Code is the same in All the CNC Machines.
G codes direct the machine’s motion and functionM codes direct the operations outside movements.
G code activates the CNC machine whileM code activates the machine’s programmable logic controller.

Important G Code Lists CNC Programming:

There are lots of Important G codes. This section will illustrate different examples of basic G and their meaning.

G CodeCommands
G00Rapid Position (6000 RPM)
G01Linear Interpolation
G02Circular Interpolation Clockwise
G03 Circular Interpolation Anti-Clockwise
G20Inch Input in Fanuc
G21Matric Input in Fanuc
G28Reference or Home position in Fanuc
G32Thread Cutting in Siemens
G33Manual Thread Cutting in Fanuc
G40Tool nose Composition Left
G42Tool nose Composition Right
G50Maximum Spindle Speed
G70Finished Turning canned cycle in Fanuc
G71Rough Turning canned cycle in Fanuc
G72Rough Cycle facing in Fanuc
G74Peck Drilling Cycle in Fanuc
G90Absolute Programming
G91Incremental Programming
G92Thread and Rough Turning cycle in Fanuc
G94Facing cycle
G96Constant surface speed Control ON
G97Constant surface speed Control OFF
G99Feed per Revolution

These are some of the important G-Codes which are used in CNC Programming.

Download important G-Codes for CNC PRogramming in PDF

Important M Code Lists CNC Programming:

In addition to the G-code, there are also M-code commands which are used when generating a real full-fledged G-code program. Here are few common M-code commands:

M Code Commands
M00Program Stop
M01Optional Stop
M02End of Program
M03Spindle Rotation Clockwise
M04Spindle Rotation Anti-Clockwise
M05Spindle Stop
M07Coolant ON
M09Coolant OFF
M10Chuck Clamp
M11Chuck Unclamp
M16Chuck Clamp-on ID
M18Chuck Clamp-on OD
M19Spindle Operational Lock
M20Spindle Operational Cancel
M30End of Program then repeat the program
M46Door Open
M47Door Closed

These are some of the important M-Codes which are used in CNC Programming.

Download important M-Codes for CNC PRogramming in PDF

Using CNC machines is one of the most important processes in CNC machining. However, these machines cannot function without G and M codes which instruct them on what to do.

Understanding how to generate these codes is vital to the CNC machining process and successful parts production. Mastery of these codes gives you a head start in your CNC programming career.

That’s All Guys! Hope you Like the Article.

That It Guys, in this article I have told you about the G and M codes of CNC Machine Programming.

if you have any suggestions then comment below or contact us at

If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.


DSLR vs Mirrorless Explained! Which one is better and why?

Learn How To Make Calculator using C Programming Language

Don’t forget to share it with your friends.

Follow us on Twitter and Facebook also.

Follow me personally on Instagram and Twitter.

1 thought on “All G And M Codes for CNC Lathe Machine Programming – The Today Blog”

Leave a Comment