Complete CNC Programming Code Reference
Quick reference guide for common G-codes (preparatory functions) and M-codes (miscellaneous functions) used in CNC programming. Use the search and filters to find specific codes.
📚 New to CNC? Start with CNC Programming Basics
G-codes prepare the machine for specific operations - motion, cycles, modes, and compensation.
G73 Z__ R__ Q__ F__ G73 Z-2.0 R0.1 Q0.2 F6.0 G74 Z__ R__ F__ G76 P__ Q__ R__ / G76 X__ Z__ P__ Q__ F__ G76 P010060 Q0100 R0.02 G80 G81 X__ Y__ Z__ R__ F__ G81 Z-0.75 R0.1 F6.0 G82 X__ Y__ Z__ R__ P__ F__ G82 Z-0.2 R0.1 P0.5 F4.0 G83 X__ Y__ Z__ R__ Q__ F__ G83 Z-2.0 R0.1 Q0.25 F6.0 G84 X__ Y__ Z__ R__ F__ G84 Z-0.75 R0.1 F25.0 G85 X__ Y__ Z__ R__ F__ G86 X__ Y__ Z__ R__ F__ G89 X__ Y__ Z__ R__ P__ F__ G98 G99 G40 G41 D__ G41 D01 G42 D__ G42 D01 G43 H__ G43 H01 Z1.0 G44 H__ G49 G50 S__ (lathe) or G50 X__ Y__ Z__ (mill) G50 S3000 (limit spindle to 3000 RPM) G52 X__ Y__ Z__ G53 G00 X__ Y__ Z__ G53 G00 Z0 (rapid Z to machine home) G54 G55 G56 G57 G58 G59 G92 X__ Y__ Z__ (mill) or G92 threading code (lathe) G94 G95 G90 G91 G00 X__ Y__ Z__ G00 X2.0 Y3.0 Z1.0 G01 X__ Y__ Z__ F__ G01 X2.0 Y3.0 F10.0 G02 X__ Y__ I__ J__ F__ or G02 X__ Y__ R__ F__ G02 X2.0 Y2.0 I1.0 J0 F8.0 G03 X__ Y__ I__ J__ F__ or G03 X__ Y__ R__ F__ G03 X0 Y0 I-1.0 J0 F8.0 G04 P__ or G04 X__ G04 P2.0 (pause 2 seconds) G28 X__ Y__ Z__ G28 G91 Z0 (return Z to home) G17 G18 G19 G96 S__ G96 S500 (500 SFM) G97 S__ G97 S1200 G20 G21 M-codes control machine functions like spindle, coolant, tool changes, and program flow.
M08 M09 M00 M01 M02 M30 M03 or S____ M03 S2000 M03 M04 or S____ M04 M05 M19 M98 P____ or M98 P____ L____ M98 P1000 L3 (call O1000 three times) M99 T__ M06 T2 M06 (change to tool 2)