G code and M code list

In CNC machining G code and M code are used for control machining that language known as a numeric control programming language. There is some difference between the G code and M code. We can see a list of G code and M code below.

What is the G code?

G code is a type of function used in numeric control programming language for CNC machine.
G code contains the information to position a tool to do the actual work.
G code is a way for you to tell the machine to move to various points at the desired speed, control the spindle speed, turn on and off various coolants, and all sorts of other things.

CNC G codes

G00 - Positioning at rapid speed; Mill and Lathe
G01 - Linear interpolation (machining a straight line) Mill and Lathe
G02 - Circular interpolation clockwise (machining arcs) Mill and Lathe
G03 - Circular interpolation, counter-clockwise; Mill and Lathe
G04 - Mill and Lathe, Dwell
G09 - Mill and Lathe, Exact stop
G10 - Setting offsets in the program; Mill and Lathe
G12 - Circular pocket milling, clockwise; Mill
G13 - Circular pocket milling, counterclockwise; Mill
G17 - X-Y plane for arc machining; Mill and Lathe with live tooling
G18 - Z-X plane for arc machining; Mill and Lathe with live tooling
G19 - Z-Y plane for arc machining; Mill and Lathe with live tooling
G20 - Inch units; Mill and Lathe
G21 - Metric units; Mill and Lathe
G27 - Reference return check; Mill and Lathe
G28 - Automatic return through reference point; Mill and Lathe
G29 - Move to location through reference point; Mill and Lathe (slightly different for each machine)
G31 - Skip function; Mill and Lathe
G32 - Thread cutting; Lathe
G33 - Thread cutting; Mill
G40 - Cancel diameter offset; Mill. Cancel tool nose offset; Lathe
G41 - Cutter compensation left; Mill. Tool nose radius compensation left; Lathe
G42 - Cutter compensation right; Mill. Tool nose radius compensation right; Lathe
G43 - Tool length compensation; Mill
G44 - Tool length compensation cancel; Mill (sometimes G49)
G50 - Set coordinate system and maximum RPM; Lathe
G52 - Local coordinate system setting; Mill and Lathe
G53 - Machine coordinate system setting; Mill and Lathe
G54~G59 - Workpiece coordinate system settings #1 t0 #6; Mill and Lathe
G61 - Exact stop check; Mill and Lathe
G65 - Custom macro call; Mill and Lathe
G70 - Finish cycle; Lathe
G71 - Rough turning cycle; Lathe
G72 - Rough facing cycle; Lathe
G73 - Irregular rough turning cycle; Lathe
G73 - Chip break drilling cycle; Mill
G74 - Left-hand tapping; Mill
G74 - Face grooving or chip break drilling; Lathe
G75 - OD groove pecking; Lathe
G76 - Fine boring cycle; Mill
G76 - Threading cycle; Lathe
G80 - Cancel cycles; Mill and Lathe
G81 - Drill cycle; Mill and Lathe
G82 - Drill cycle with dwell; Mill
G83 - Peck drilling cycle; Mill
G84 - Tapping cycle; Mill and Lathe
G85 - Bore in, bore out; Mill and Lathe
G86 - Bore in, rapid out; Mill and Lathe
G87 - Back boring cycle; Mill
G90 - Absolute programming
G91 - Incremental programming
G92 - Reposition origin point; Mill
G92 - Thread cutting cycle; Lathe
G94 - Per minute feed; Mill
G95 - Per revolution feed; Mill
G96 - Constant surface speed control; Lathe
G97 - Constant surface speed cancel
G98 - Per minute feed; Lathe
G99 - Per revolution feed; Lathe

What is the M code?

M code is an auxiliary program command.
M code contains the information to coolant OFF/ON like operating the various machining parts like door, coolant, spindle etc.

CNC M Codes
M00 - Program stop; Mill and Lathe
M01 - Optional program stop; Lathe and Mill
M02 - Program end; Lathe and Mill
M03 - Spindle on clockwise; Lathe and Mill
M04 - Spindle on counterclockwise; Lathe and Mill
M05 - Spindle off; Lathe and Mill
M06 - Tool change; Mill
M08 - Coolant on; Lathe and Mill
M09 - Coolant off; Lathe and Mill
M10 - Chuck or rotary table clamp; Lathe and Mill
M11 - Chuck or rotary table clamp off; Lathe and Mill
M19 - Orient spindle; Lathe and Mill
M30 - Program end, return to start; Lathe and Mill
M97 - Local sub-routine call; Lathe and Mill
M98 - Sub-program call; Lathe and Mill
M99 - End of subprogram; Lathe and Mill