Need a quick refresher at the machine? Use this cheat sheet for the most common standard Fanuc and Haas compatible codes for 3-Axis Milling.
| Code | Category | Description | Quick Notes |
|---|---|---|---|
| G00 | Motion | Rapid Positioning | Moves at max machine speed. Warning: Beware of non-linear "dogleg" moves. |
| G01 | Motion | Linear Interpolation | Straight line cut. Requires an F (Feed) value. |
| G02 | Motion | Circular Interpolation (CW) | Clockwise arc. Requires endpoint and radius (R) or center offset (I, J, K). |
| G03 | Motion | Circular Interpolation (CCW) | Counter-Clockwise arc. Requires endpoint and radius (R) or center offset (I, J, K). |
| G04 | Motion | Dwell | Pauses all axis motion. Defined by P (milliseconds) or X (seconds). e.g., G04 P1000 = 1 sec. |
| G09 | Motion | Exact Stop | Non-modal. Forces the axis to come to a complete stop before the next block. Used for a single sharp corner without activating modal G61. |
| G17 | Setup | XY Plane Selection | Default for 3-axis milling. Tells the machine that G02/G03 arcs and canned cycles happen in the X and Y axes. |
| G18 | Setup | ZX Plane Selection | Selects the XZ plane. Usually used for side-milling arcs or using right-angle heads. |
| G19 | Setup | YZ Plane Selection | Selects the YZ plane. |
| G20 | Setup | Inch Programming | Sets the machine to read coordinates and feeds in Imperial units (Inches). |
| G21 | Setup | Metric Programming | Sets the machine to read coordinates and feeds in Metric units (Millimeters). |
| G28 | Coordinates | Return to Reference Point | Sends the machine to its home position. Safest when used in Incremental mode (e.g., G91 G28 Z0.0). |
| G40 | Compensation | Cutter Comp Cancel | Turns off G41/G42. Must be accompanied by a linear lead-out move. |
| G41 | Compensation | Cutter Comp Left | Offsets tool left of path (Climb Milling). Requires D offset number. |
| G42 | Compensation | Cutter Comp Right | Offsets tool right of path (Conventional). Requires D offset number. |
| G43 | Compensation | Tool Length Comp (+) | Applies tool height. Requires H offset number. Crucial for crash prevention. |
| G49 | Compensation | Tool Length Comp Cancel | Cancels G43. (Often handled implicitly by G53 or G28). |
| G10 | Coordinates | Programmable Data Input | Allows writing or altering Work Offsets (G54) or Tool Offsets directly via G-code instead of manually at the control panel. |
| G52 | Coordinates | Local Coordinate System | Temporarily shifts the active Work Offset. Great for machining repeating patterns (e.g., G52 X2.0 Y2.0). Cancel with G52 X0 Y0. |
| G53 | Coordinates | Machine Coordinates | Non-modal. Forces move to absolute machine home. e.g., G53 G0 Z0 for safe retract. |
| G54-G59 | Coordinates | Work Offsets 1-6 | Sets Part Zero. G54 is standard default. Use G54.1 P1-P48 for extended offsets. |
| G61 | Motion | Exact Stop Mode | Forces the axes to come to a complete physical stop at the end of every command before moving to the next. Prevents rounded corners on sharp geometry. |
| G64 | Motion | Continuous Path Mode | Default cutting mode. The machine blends moves together without fully stopping, keeping feed rates smooth (can round sharp corners slightly). |
| G90 | Coordinates | Absolute Positioning | Modal. All coordinates are relative to the active Work Offset (G54). |
| G91 | Coordinates | Incremental Positioning | Modal. All coordinates are relative to the tool's current physical position. |
| G94 | Feed Control | Feed Per Minute | Standard milling feed mode. F-value dictates Inches per Minute (IPM) or Millimeters per Minute (mm/min). |
| G95 | Feed Control | Feed Per Revolution | Synchronizes feed rate to spindle RPM (IPR or mm/rev). Common for tapping or lathe-style operations. |
| G103 | Advanced | Block Lookahead Limit | Haas specific. G103 P0 disables block look-ahead (crucial so macro variables don't calculate too early). G103 re-enables it. |
| G187 | Advanced | Accuracy Control (HSM) | Haas specific. Controls corner rounding/speed. P1 (Rough), P2 (Medium), P3 (Finish). E sets exact tolerance. G187 alone resets to default. |
| G12 | Pocketing | Circular Pocket Milling (CW) | Haas specific. Mills a circular pocket clockwise. Uses I (radius), K (radius of larger pocket), Q (stepover), and Z (depth). |
| G13 | Pocketing | Circular Pocket Milling (CCW) | Haas specific. Mills a circular pocket counter-clockwise. This is typically preferred for standard climb milling! |
| G80 | Canned Cycle | Canned Cycle Cancel | Always use at the end of a drilling operation to prevent crashes! |
| G81 | Canned Cycle | Standard Drill | Feed in, rapid out. For shallow holes or spot drilling. |
| G82 | Canned Cycle | Drill with Dwell | Feed in, pause (P), rapid out. For counterbores and flat-bottom holes. |
| G83 | Canned Cycle | Deep Hole Peck Drill | Feed in (Q depth), rapid fully out to clear chips, rapid back down. |
| G73 | Canned Cycle | High-Speed Peck Drill | Feed in (Q depth), back up slightly to break chip (does not fully retract). |
| G74 | Canned Cycle | Reverse Tapping | Used for left-handed threads. Spindle turns CCW, feeds in, reverses to CW, feeds out. |
| G84 | Canned Cycle | Rigid Tapping | Synchronizes Z-feed and spindle RPM. Spindle reverses at bottom of hole. |
| G85 | Canned Cycle | Boring Cycle (Feed Out) | Feeds in to depth, feeds back out. Provides excellent surface finish inside a bore. |
| G98 | Canned Cycle | Initial Plane Return | Retracts to original Z-height between holes. Used to jump clamps. |
| G99 | Canned Cycle | R-Plane Return | Retracts only to the R-plane between holes. Used for speed on flat parts. |
| M00 | Program Control | Program Stop | Forces the machine to halt until the operator presses Cycle Start. |
| M01 | Program Control | Optional Stop | Halts program ONLY if the "Optional Stop" button is active on the control panel. |
| M02 | Program Control | End of Program | Ends program. Historically doesn't rewind to the beginning like M30, though many modern controls treat them identically. |
| M30 | Program Control | End of Program | Stops spindle, turns off coolant, and rewinds the program to the beginning. |
| M97 | Program Control | Local Sub-Routine Call | Calls a subroutine within the same program (Haas standard). Requires P (N-line number). |
| M98 | Program Control | Subprogram Call | Calls an external subprogram from the machine's memory. Requires P (Program number). |
| M99 | Program Control | Subprogram Return | Ends a subprogram and returns to main program. If used in a main program, it loops the program indefinitely. |
| M03 | Spindle / Fluid | Spindle ON (Clockwise) | Standard rotation for 99% of cutting tools. Requires an S (Speed) value. |
| M04 | Spindle / Fluid | Spindle ON (CCW) | Counter-clockwise rotation. Used for left-handed taps or specialized tools. |
| M05 | Spindle / Fluid | Spindle STOP | Halts spindle rotation. |
| M08 | Spindle / Fluid | Coolant ON | Activates primary flood coolant pump. |
| M09 | Spindle / Fluid | Coolant OFF | Turns off all active coolant systems. |
| M19 | Spindle / Fluid | Spindle Orientation | Locks the spindle in a specific angular position. Crucial for broaching, probing, or adjusting boring bars. |
| M73 | Spindle / Fluid | Through-Spindle Air ON | Blasts air directly through the center of the tool. Excellent for deep-hole chip clearing without thermal shock. |
| M74 | Spindle / Fluid | Through-Spindle Air OFF | Turns off the through-spindle air system. |
| M83 | Spindle / Fluid | Auto Air Blast ON | External high-pressure air blast. Great for clearing chips when dry machining (like cutting cast iron or some plastics). |
| M84 | Spindle / Fluid | Auto Air Blast OFF | Turns off the external auto air blast. |
| M88 | Spindle / Fluid | Through-Spindle Coolant ON | Activates high-pressure coolant delivered directly through the tool (TSC). Essential for deep drilling and high-speed machining. |
| M89 | Spindle / Fluid | Through-Spindle Coolant OFF | Turns off the TSC system. |
| M06 | Tool Mgt | Tool Change | Executes physical tool change. Requires a T (Tool) number (e.g., T1 M06). |
| M16 | Tool Mgt | Tool Change | Executes a tool change (Haas specific, interchangeable with M06). |
| M68 | Tool Mgt | Clamp | Hydraulic/Pneumatic clamp (commonly used for automated fixture clamping or rotary tables). |
| M69 | Tool Mgt | Unclamp / Release | Hydraulic/Pneumatic unclamp. Used for custom fixture releases, pallet releases, or 4th-axis brake releases. |
| M86 | Tool Mgt | Spindle Tool Clamp | Clamps the tool in the spindle drawbar (Haas specific). Used after an M87. |
| M87 | Tool Mgt | Spindle Tool Unclamp | Unclamps the tool from the spindle drawbar (Haas specific). Drops the tool. Useful for custom tool release macros. |