Commonly used G-Codes

Here are the most common G-codes with their function called out. The ones highighted in red are appropriate for use on Sherline CNC machines. This list is included near the end of the instructions that come with your Sherline CNC machine. You can also find a complete list on your Sherline computer at Applications>CNC>G-code Quick Reference.

 

g0 rapid positioning
g1 linear interpolation
g2 circular/helical interpolation (clockwise)
g3 circular/helical interpolation (counterclockwise)
g4 dwell
g10 coordinate system origin setting
g17 xy plane selection
g18 xz plane selection
g19 yz plane selection
g20 inch system selection
g21 millimeter system selection
g40 cancel cutter diameter compensation
g41 start cutter diameter comp. left
g42 start cutter diameter comp. right
g43 tool length offset (plus)
g49 cancel tool length offset
g53 motion in machine coordinate system
g54 use preset work coordinate system 1
g55 use preset work coordinate system 2
g56 use preset work coordinate system 3
g57 use preset work coordinate system 4
g58 use preset work coordinate system 5
g59 use preset work coordinate system 6
g59.1 use preset work coordinate system 7
g59.2 use preset work coordinate system 8
g59.3 use preset work coordinate system 9
g80 cancel motion mode (includes canned)
g81 drilling canned cycle
g82 drilling with dwell canned cycle
g83 chip-breaking drilling canned cycle
g84 right hand tapping canned cycle
g85 boring, no dwell, feed out canned cycle
g86 boring, spindle stop, rapid out canned
g87 back boring canned cycle
g88 boring, spindle stop, manual out canned
g89 boring, dwell, feed out canned cycle
g90 absolute distance mode
g91 incremental distance mode
g92 offset coordinate systems
g92.2 cancel offset coordinate systems
g93 inverse time feed mode
g94 feed per minute mode
g98 initial level return in canned cycles

 

 

A more complete list of G- and M-Codes

For those interested, here is a more complete list of common codes.

G00 Rapid move G0 X# Y# Z# up to eight axes or G0 Z# X#
G01 Feed Rate move G1 X# Y# Z# up to eight axes or G1 Z# X#
G02 Clockwise move
G03 Counter Clockwise move
G04 Dwell time G04 L#
G08 Spline Smoothing On
G09 Exact stop check, Spline Smoothing Off
G10 A linear feedrate controlled move with a decelerated stop
G11 Controlled Decel stop
G17 XY PLANE
G18 XZ PLANE
G19 YZ PLANE
G28 Return to clearance plane
G33 Threading (Lathe)
G35 Bypass error checking on next line
G40 Tool compensation off
G41 Tool compensation to the left
G42 Tool compensation to the right
G43 Tool length compensation – negative direction
G44 Tool length compensation – positive direction
G49 Tool length compensation cancelled
G53 Cancel work coordinate offsets
G54-G59 Work coordinate offsets 1 through 6
G61 Spline contouring with buffering mode off
G64 Spline contouring with buffering mode on
G65 Mill out rectangular pocket
G66 Mill out circular pocket
G67 Flycut
G68 Mill out rectangular pocket with radius corners
G70 Inch mode
G71 Millimeter mode
G74 Peck drilling (Lathe) G83 Z# X# R#
G81 Drill cycle G81 X# Y# Z# R#
G82 Dwell cycle G82 X# Y# Z# R#
G83 Peck cycle G83 X# Y# Z# R#
G84 Tapping cycle G84 X# Y# Z# R# C#
G85 Boring cycle 1 G85 X# Y# Z# R#
G86 Boring cycle 2 G86 X# Y# Z# R#
G88 Boring cycle 3 G88 X# Y# Z# R#
G89 Boring cycle 4 G89 X# Y# Z# R#
G90 Absolute mode
G91 Incremental mode
G92 Home coordinate reset G92 X# Y# Z#
G94 IPM mode (Lathe) default
G95 IPR mode (Lathe)
G96 Constant Surface Feed On (Lathe)
G97 Constant Surface Feed Off (Lathe)
G110 Lathe Groove Face
G111 Lathe Groove OD
G112 Lathe Groove ID
G113 Lathe Thread OD
G114 Lathe Thread ID
G115 Lathe Face Rough
G116 Lathe Turn Rough
G120 Mill Outside Square
G121 Mill Outside Circle or Island
G122 Mill Out Counter Bore
G123 Mill Outside Ellipse pocket
G124 Mill Inside Ellipse pocket
G125 Mill Outside Slot
G126 Mill Inside Slot pocket
G130 3D tool compensation with gouge protection
G131 3D offset parallel to 3D profile
G132 3D tool compensation with gouge protection in the Z axis only
G135 5 axis tool compensation with gouge protection
G136 Included angle limit for gouge protection. G136 L#
G140 3D part rotation and plane tilting G140 U# V# W# R#
G141 Scale factor for the X axis only. G141 L#
G142 Scale factor for the Y axis only. G142 L#
G143 Scale factor for the Z axis only. G143 L#
G160 Mill 3D Cylinder
G162 Mill 3D Sphere
G163 Mill 3D Ramped Plane
G170 Set soft limits and crash fixture/chuck barriers to defaults
G171 Set backward crash fixture/chuck barriers G171 U# V# W#
G172 Set forward crash fixture/chuck barriers G172 U# V# W#
G181 Bolt Hole Drill
G182 Bolt Hole Dwell
G183 Bolt Hole Peck
G184 Bolt Hole TapG185 Bolt Hole Bore

Common M Codes

Default M codes used on most machines types. User customizable M codes will change based on application and user definition.

M02 End of Program
M03 Spindle On Clockwise, Laser, Flame, Power ON
M04 Spindle On Counter Clockwise
M05 Spindle Stop, Laser, Flame, Power OFF
M06 Tool Change
M08 Coolant On
M09 Coolant Off
M10 Reserved for tool height offset
M13 Spindle On, Coolant On
M30 End of Program when macros are used
M91 Readout Display Incremental
M92 Readout Display Absolute
M97 Go to or jump to line number
M98 Jump to macro or subroutine
M99 Return from macro or subroutine
M100 Machine Zero Reset
M199 Mid program start