Haas G-codes73 codesMill

Haas Mill G-code List

Because the numbering follows Fanuc almost everywhere, a Fanuc program usually runs on a Haas mill. It goes wrong in the details: settings that change what a code does, L instead of K for loops, dwells where P10. is ten seconds and the G154 extended offsets. Below is every G-code the reference marks for a Haas mill except G10.9.

Haas Mill G-code: 73 codes

Codes in colour link to a full page with a worked example and controller differences; the rest link to their row on the G-code list.

CodeFunctionNotes
G00Rapid PositioningMoves the tool at maximum speed to the specified position. Used for non-cutting moves to position the tool quickly. Movement is typically not in a straight line - each axis moves at its maximum rate independently.WARNING: G00 moves at maximum speed. Ensure clear path to avoid collisions. Movement path may not be linear.
G01Linear InterpolationMoves the tool in a straight line at a specified feed rate. Used for cutting operations where precise linear movement is required.Feed rate (F) is modal - once set, it remains active until changed.
G02Circular Interpolation CWMoves the tool in a clockwise arc. The arc center is defined by I/J/K offsets or R radius. Direction is clockwise when viewed from the positive direction of the perpendicular axis.I/J/K are usually incremental from current position. R cannot make full circles.
G03Circular Interpolation CCWMoves the tool in a counter-clockwise arc. The arc center is defined by I/J/K offsets or R radius. Direction is counter-clockwise when viewed from the positive direction of the perpendicular axis.I/J/K are usually incremental from current position. R cannot make full circles.
G04DwellPauses program execution for a specified time. Useful for chip clearing, allowing spindle to reach speed, or timing operations.P format varies by controller: Fanuc uses milliseconds, some use seconds. Check your controller documentation.
G05High-Speed Machining ModeActivates high-speed machining mode for smoother motion at high feed rates. Reduces acceleration/deceleration for better surface finish.Controller-specific. Check documentation for exact syntax and modes available.
G09Exact Stop CheckNon-modal exact stop. Machine decelerates to a complete stop at the end of the current block only. Unlike G61, it only affects the single block it appears on.Non-modal, only affects the block it's on. Use instead of G61 when you need exact stop at one point only.
G10Data Setting / Offset EntryProgrammable data entry for work offsets, tool offsets, and parameters. Allows automatic offset adjustment during program execution.Powerful but use with caution. L2 sets absolute values, some controls use L20 for incremental. Check controller documentation.
G12Circular Pocket Milling CWMills a circular pocket using clockwise tool motion. The tool starts at the center and spirals outward to the specified diameter, then retracts. Simplifies circular pocket programming without CAM.Position tool at pocket center and desired Z depth before calling. I/K/Q usage varies by controller, check documentation. CW direction pushes chips outward (climb milling with standard tooling).
G13Circular Pocket Milling CCWMills a circular pocket using counter-clockwise tool motion. Identical to G12 but with opposite rotation direction. Use for conventional milling approach.Position tool at pocket center and desired Z depth before calling. CCW direction is conventional milling with standard tooling. Some machinists prefer G13 for harder materials.
G15Polar Coordinate Mode CancelCancels polar coordinate mode and returns to Cartesian (X/Y) coordinate programming.Always cancel polar mode when done to avoid confusion. Modal, stays active until G16.
G16Polar Coordinate ModeEnables polar coordinate programming. X specifies radius (distance from origin) and Y specifies angle in degrees. Useful for bolt circles and patterns.X = radius from origin, Y = angle in degrees. Origin is the current work offset origin. Cancel with G15.
G17XY Plane SelectionSelects the XY plane for circular interpolation (G02/G03). Arc movements will occur in the XY plane with Z as the perpendicular axis. This is the default plane for most milling operations.
G18XZ Plane SelectionSelects the XZ plane for circular interpolation. Arc movements will occur in the XZ plane with Y as the perpendicular axis. Common for lathe operations.
G19YZ Plane SelectionSelects the YZ plane for circular interpolation. Arc movements will occur in the YZ plane with X as the perpendicular axis.
G20Inch ModeSets the unit system to inches. All position values and feed rates will be interpreted as inches and inches per minute.
G21Metric ModeSets the unit system to millimeters. All position values and feed rates will be interpreted as millimeters and mm per minute.
G27Reference Point Return CheckMoves to reference point and verifies position. Alarms if machine does not reach reference position. Used for safety verification.Use at program start to verify machine is homed. Alarms if not at reference.
G28Return to Reference PointReturns the machine to its reference point (machine home). Can pass through an intermediate point if coordinates are specified. Often used for safe tool changes.CRITICAL: Always retract Z first before X/Y return to avoid crashes. G91 G28 Z0 is a common safe retract pattern.
G29Return from Reference PointMoves from reference point through intermediate point to final position. Reverses the G28 path.Uses the intermediate point stored by previous G28. Rarely used in modern programming.
G30Return to 2nd Reference PointReturns the machine to its second reference point. Similar to G28 but goes to an alternate reference position. Useful when G28 position is inconvenient for tool changes.
G31Skip Function / ProbeMoves at feed rate until the skip signal (probe trigger) is received, then stops. Used for touch probing and measuring.Trigger position stored in system variables. Slow feed rate recommended for accuracy.
G37Automatic Tool Length MeasurementInitiates automatic tool length measurement using a tool length measuring device (probe). Measures the tool and stores the offset automatically.Requires tool length measurement hardware (tool setter). Automatically updates tool length offset register.
G38.2Probe Toward - Stop on ContactMoves toward workpiece until probe contact, then stops. Standard probing move. Error if probe doesn't trigger.Generates error if probe not triggered by end of move. Used in probing routines.
G40Cutter Compensation CancelCancels cutter radius compensation (G41/G42). Tool path returns to programmed path. Should be called before tool changes and at program end.Must exit compensation with a linear move (G00/G01). Cannot cancel during an arc.
G41Cutter Compensation LeftActivates cutter radius compensation to the left of the programmed path. Tool is offset by its radius to the left of the direction of travel. Used for climb milling on external profiles.Must enter compensation with a linear lead-in move. Offset value in D register = tool radius (not diameter on most controls).
G42Cutter Compensation RightActivates cutter radius compensation to the right of the programmed path. Tool is offset by its radius to the right of the direction of travel. Used for conventional milling on external profiles.Must enter compensation with a linear lead-in move. Offset value in D register = tool radius.
G43Tool Length Compensation +Activates tool length compensation in the positive direction. Adds the offset value to the Z axis position. Standard for milling operations.H number typically matches tool number. Apply after tool change and before any Z moves to work.
G44Tool Length Compensation -Activates tool length compensation in the negative direction. Subtracts the offset value from the Z axis position. Less commonly used than G43.
G49Tool Length Compensation CancelCancels tool length compensation. Returns Z axis to programmed values without offset.Automatically cancelled by some controllers on M06. Good practice to call before tool change.
G50Scaling Cancel / Max Spindle SpeedOn mills: Cancels scaling (G51). On lathes: Sets maximum spindle speed for constant surface speed mode (G96).Function varies by machine type. On lathe, critical for CSS operations to prevent over-speed.
G50.1Mirror Image CancelCancels mirror image mode. Returns axes to normal direction of movement after G51.1 mirroring.Always cancel mirror mode when done. Forgetting to cancel can cause crashes on subsequent operations.
G51ScalingActivates scaling of programmed coordinates. Multiplies all moves by the scale factor around the specified center point.Cancel with G50. Be careful with scaling - affects all subsequent moves including rapids.
G51.1Mirror Image EnableEnables mirror image mode for specified axes. Reverses the direction of programmed moves around the specified mirror center point. Useful for machining symmetric parts.Cancel with G50.1. Specify which axes to mirror by including their center coordinates. Great for symmetric parts, program one side, mirror for the other.
G52Local Coordinate SystemSets a local coordinate system offset that is added to the active work coordinate system. Creates a temporary shift without changing the work offset.G52 X0 Y0 Z0 cancels the local offset. Useful for pattern work.
G53Machine Coordinate SystemTemporarily use machine coordinates for the current block only. Coordinates are interpreted relative to machine zero, ignoring work offsets. Non-modal - only affects the block it's on.Must be used with G00 or G01. Non-modal - only affects current line.
G54Work Coordinate System 1Selects work coordinate system 1. This is typically the primary/default work offset used for most machining operations. Origin is set during setup.Work offset values are set in the controller. G54 is the most commonly used work offset.
G54.1Extended Work Coordinate SystemsSelects additional work coordinate systems beyond G54-G59. Provides up to 48 additional offsets (P1-P48) for complex multi-fixture setups.Provides 48 additional work offsets beyond the standard G54-G59. Haas uses G154 P1-P99 as an alternative syntax.
G55Work Coordinate System 2Selects work coordinate system 2. Use for second fixture or part setup.
G56Work Coordinate System 3Selects work coordinate system 3. Use for third fixture or part setup.
G57Work Coordinate System 4Selects work coordinate system 4.
G58Work Coordinate System 5Selects work coordinate system 5.
G59Work Coordinate System 6Selects work coordinate system 6.
G60Single Direction PositioningApproaches the final position from one direction only to eliminate backlash error. Machine overshoots and returns from the specified direction for precise positioning.Used for precision boring and jig boring where backlash compensation is critical. Direction set by parameter.
G61Exact Stop ModeMachine decelerates to complete stop at each programmed point. Ensures precise positioning but slower cycle time. Use for sharp corners.Use for accurate corners. G64 returns to cutting mode for smoother motion.
G63Tapping ModeActivates tapping mode where spindle and feed are synchronized. Feed override and spindle override are disabled.Overrides disabled to prevent thread damage. F = pitch × RPM.
G64Cutting Mode / Continuous PathEnables continuous path mode for smooth motion. Machine does not decelerate fully at corners, allowing faster cycle times with slight corner rounding.Default mode on most machines. Corners may be slightly rounded based on speed.
G65Macro CallCalls a custom macro program with optional arguments. Allows parameterized subprograms for repetitive operations.Arguments A-Z map to local variables #1-#26. Macro must be defined on controller.
G66Macro Modal CallActivates modal macro call. The macro is executed after every subsequent motion block until cancelled.Cancel with G67. Useful for repetitive operations at multiple positions.
G67Macro Modal Call CancelCancels modal macro call activated by G66.
G68Coordinate System RotationRotates the coordinate system around a specified point by a specified angle. All subsequent moves are in the rotated system.Cancel with G69. Affects G00, G01, G02, G03 moves. Use for patterns.
G69Coordinate System Rotation CancelCancels coordinate system rotation activated by G68. Returns to normal coordinate system.
G73High Speed Peck DrillingChip breaking peck drill cycle with minimal retract. Drills incrementally with small retracts to break chips without fully retracting. Faster than G83 for most materials.Retract distance is typically small (0.5-1mm). Use G83 for deep holes requiring full chip evacuation.
G74Left-Hand Tapping CycleLeft-hand (reverse) tapping cycle. For cutting left-hand threads. Spindle runs CCW during cutting.Start with M04 (CCW spindle). Feed = Pitch x RPM.
G76Fine Boring CycleFine boring cycle with oriented spindle stop and shift. Tool retracts off the wall before withdrawing to prevent scratching.Requires oriented spindle stop (M19). Q direction set by parameter. Use for precision bores.
G80Canned Cycle CancelCancels any active canned cycle (G73, G81-G89). Returns to normal motion mode.Good practice to call G80 after completing all holes in a pattern.
G81Drilling CycleSimple drilling cycle. Rapids to R-plane, feeds to Z depth, then rapids out. No dwelling or pecking.Use for shallow holes (typically less than 3x diameter). For deeper holes, use G73 or G83.
G82Drilling Cycle with DwellDrilling cycle with dwell at the bottom. Rapids to R-plane, feeds to depth, dwells, then rapids out. Used for counterboring and spot drilling.Dwell improves bottom finish and hole accuracy. P value in milliseconds on most controls.
G83Deep Hole Peck DrillingFull retract peck drilling cycle. Drills incrementally with full retract to R-plane for chip evacuation. Essential for deep holes.Use for holes deeper than 3x diameter. Q value typically 1-2x drill diameter. Use coolant (M08).
G84Tapping CycleRight-hand tapping cycle. Feeds in at specified rate, reverses spindle, feeds out. Synchronizes spindle and feed for threading.Feed = Pitch x RPM. Example: M8x1.25 at 400 RPM needs F500. Use rigid tapping if available.
G85Boring CycleSimple boring cycle. Feeds in at specified rate, feeds out at same rate. Provides better finish than rapid retract.
G86Boring Cycle with Spindle StopBoring cycle that stops spindle at bottom before rapid retract. Prevents drag marks on bore wall.Spindle restarts automatically on retract. Use for precision bores.
G87Back Boring CycleBack boring cycle for machining from the back side. Tool enters through hole, orients, shifts, and bores upward.Requires oriented spindle stop (M19). Complex cycle - verify with dry run.
G88Boring Cycle with Manual RetractBoring cycle with dwell and manual retract. Stops at bottom for operator inspection or manual intervention.Requires operator to press cycle start for retract. Use for inspection or special operations.
G89Boring Cycle with DwellBoring cycle with dwell at bottom, then feed retract. Dwell allows spring pass for improved finish.Dwell allows tool deflection to recover, improving bottom finish and diameter accuracy.
G90Absolute PositioningSets absolute positioning mode. All coordinates are interpreted as absolute positions relative to the current work coordinate system origin.Recommended for most operations. Easier to verify positions and safer for program restarts.
G91Incremental PositioningSets incremental positioning mode. All coordinates are interpreted as distances relative to the current position.Use with caution - position errors accumulate. Often used with G28 for safe retract.
G92Position Register / Coordinate System OffsetSets the current position to specified values without moving. Creates an offset to make current position equal to given coordinates. Use with caution - can cause confusion.WARNING: G92 offset is persistent and can cause crashes if forgotten. Prefer G54-G59 work offsets when possible.
G93Inverse Time Feed ModeFeed rate specifies time to complete the move (1/minutes). F2.0 means move completes in 0.5 minutes. Used for complex multi-axis moves.Essential for 5-axis simultaneous machining. F = 1 / time in minutes.
G94Feed Per MinuteSets feed rate mode to units per minute. Feed rate value represents distance traveled per minute.
G95Feed Per RevolutionSets feed rate mode to units per revolution. Feed rate value represents distance traveled per spindle revolution. Common for turning and drilling operations.
G98Return to Initial LevelIn canned cycles, tool returns to the initial Z level (where cycle started) after each hole. Safer for fixtures with varying heights.Use when moving between holes that have obstructions between them.
G99Return to R-LevelIn canned cycles, tool returns to the R-plane after each hole. Faster for flat surfaces with clear paths between holes.Use for faster cycle times when part surface is flat and path between holes is clear.

Where Haas differs

  • Setting 56, M30 Restore Default G: when on, M30 resets modal G codes to their defaults, cancelling G43 and returning to G54 and G80.
  • Setting 33, Coordinate System, decides what G52 and G92 do to the work offsets. In FANUC mode the G52 values are added to every work offset, a global shift; in YASNAC mode G52 becomes another work offset, like G55.
  • Setting 40, Tool Offset Measure, decides whether the offset column is read as a radius or a diameter, so the same D value cuts two different parts on two machines.
  • Setting 58, Cutter Compensation, FANUC or YASNAC, changes how the tool goes round an outside corner: YASNAC joins every outside corner with an arc, FANUC makes a sharp corner and adds a linear move where the angle is over 270 degrees.
  • 2D cutter compensation, G41 and G42, works in X and Y with G17; 3D compensation is G141.
  • G154 P1 to P99 are the extended work offsets; G110 to G129 are the older names for G154 P1 to P20.
  • Canned cycle loop count is L, not Fanuc's K.
  • G04 P with a decimal point is read in seconds and without one in milliseconds: G04 P10. is ten seconds, G04 P10 is ten milliseconds, so P0.5 is half a second.
  • Setting 57, Exact Stop Canned X-Y, decides whether the control comes to a full stop at each hole before the Z move of a canned cycle.
  • G73 and G83 take I, J and K for a reducing peck: I the first peck, J the amount taken off each following peck, K the smallest peck allowed. G83 also takes P as a dwell at the bottom. Setting 22, Can Cycle Delta Z, is the G73 backoff and Setting 52, G83 Retract Above R, controls the G83 retract height.
  • A G28 block with no axis word returns every axis to machine zero.
  • G12 and G13 circular pocket milling and G154 are on the Haas list and not on most others. G10.9, which the reference also marks for Haas, is not on the Haas G-code list, so the table leaves it out.

Frequently asked questions

Will a Fanuc program run on a Haas mill?

Usually, with three checks first. Loop counts are L not K, a P dwell with a decimal point is read in seconds, and Setting 56 decides what M30 leaves behind. Work offsets beyond G59 are G154 P1 to P99. See G54 to G59: work offsets.

Why does my G41 cut differently on two Haas machines?

Setting 40 decides whether the tool offset column is a radius or a diameter, and Setting 58 decides how the tool goes round an outside corner. The same D value and the same program give two different parts if the settings differ. See G40, G41 and G42: cutter compensation.

How does a Haas reduce the peck depth in G83?

With I, J and K on the cycle block: I is the first peck, J the amount taken off each following peck and K the smallest peck allowed. Setting 52 controls how far above R the drill retracts between pecks. See G73 and G83: peck drilling.

What does Setting 56 do?

M30 Restore Default G. When it is on, M30 puts every modal G code back to its default, so G43 is cancelled, G54 is restored and a canned cycle left running is cancelled. With it off, the modal G codes of the last run carry into the next, although M30 still cancels the tool length offset.

Other controller lists

Last updated 11 Oct 2026