G Code Quick Guide
G Code Quick Guide
G Code Quick Guide
What is G-Code?
G-Code programming is a very robust and simple language. G-codes are what CNC
Machines run on. A CNC control program process the g-code line by line and send this
information to the machine. The machine then takes this information and makes precise
movements. Yes, it is as simple as that.
Post Processors
A post processor is a specific way you CAM Program will process your design. There
are standard ones and custom ones. If a standard one doesn’t work for you, most good CAM
Software gives you the option to customize the post processor to fit your needs.
Canned Cycles
We won’t be covering Canned Cycles here. There are G-Codes that do pertain to
Canned Cycles. This guide is targeted toward beginner to intermediate CNC Learners.
http://www.CNCInformation.com
Page 2
Ivan Irons | CNC Information | G-Code Quick Guide
G4 or G04 – Dwell
Machine will dwell once reached position to a user defined time, noted by a “P”
G21 - Machine in MM
http://www.CNCInformation.com
Page 3
Ivan Irons | CNC Information | G-Code Quick Guide
http://www.CNCInformation.com
Page 4
Ivan Irons | CNC Information | G-Code Quick Guide
http://www.CNCInformation.com
Page 5
Ivan Irons | CNC Information | G-Code Quick Guide
M-Codes
M0 - program stop
M1 - optional program stop
M2 - program end
M3 - turn spindle clockwise
M4 - turn spindle counterclockwise
M5 - stop spindle turning
M6 - tool change
M7 - mist coolant on
M8 - flood coolant on
M9 - mist and flood coolant off
M26 - enable automatic b-axis clamping
M27 - disable automatic b-axis clamping
M30 - program end, pallet shuttle, and reset
M48 - enable speed and feed overrides
M49 - disable speed and feed overrides
M60 - pallet shuttle and program stop
http://www.CNCInformation.com
Page 6
Ivan Irons | CNC Information | G-Code Quick Guide
Disclaimer
This is not a class on learning g-code. It is a quick guide of the different g-codes. In
other words, this guide is for reference only. You should always prove out your process,
program and cnc machine before you ever begin machining.
In order to learn the entire CNC Process, you will need to spend time. Time learning
about the whole process, not just one part. G-Code is just one part of a whole process. If you
are focused on only one part you are destined to have trouble.
This guide is assumed to be correct, but is subject to change at any time. This guide is
for reference only. Your safety is your responsibility. Use you head.
http://www.CNCInformation.com
Page 7