Reference91 entries7 controllers

G-code List

Every G-code in the G-Code Guru reference, across Fanuc, Haas, Siemens, Mazak, Okuma, Grbl and Marlin, grouped by what the code does. Codes shown in colour link to a full page with a worked example, controller differences and what goes wrong on the shop floor. Sort by any column or type to filter.

91 of 91

Motion 12

Rapid, feed, arcs and the codes that decide how one move blends into the next: G00 and G01 for straight moves, G02 and G03 for arcs, G04 for a dwell, G09 and G61 to G64 for exact stop and cutting mode.

Controllers
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.MotionMill · Lathe · 3D printerAll 7
G01Linear InterpolationMoves the tool in a straight line at a specified feed rate. Used for cutting operations where precise linear movement is required.MotionMill · Lathe · 3D printerAll 7
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.MotionMill · Lathe · 3D printerAll 7
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.MotionMill · Lathe · 3D printerAll 7
G04DwellPauses program execution for a specified time. Useful for chip clearing, allowing spindle to reach speed, or timing operations.MotionMill · Lathe · 3D printerAll 7
G05High-Speed Machining ModeActivates high-speed machining mode for smoother motion at high feed rates. Reduces acceleration/deceleration for better surface finish.MotionMillFanuc, Haas
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.MotionMill · LatheFanuc, Haas, Siemens, Mazak
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.MotionMillFanuc, Haas, Mazak
G61Exact Stop ModeMachine decelerates to complete stop at each programmed point. Ensures precise positioning but slower cycle time. Use for sharp corners.MotionMill · LatheFanuc, Haas, Siemens, Mazak
G62Automatic Corner OverrideAutomatically reduces feed rate at corners to maintain accuracy. Balances speed and precision for complex contours.MotionMillFanuc, Mazak
G63Tapping ModeActivates tapping mode where spindle and feed are synchronized. Feed override and spindle override are disabled.MotionMillFanuc, Haas, Siemens
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.MotionMill · LatheFanuc, Haas, Siemens, Mazak

Plane selection 3

G17, G18 and G19 pick the working plane for arcs, cutter compensation and canned cycles. Mills wake up in G17 (XY); turning work is in G18 (ZX).

Controllers
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.Plane SelectionMillAll 7
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.Plane SelectionMill · Lathe · 3D printerAll 7
G19YZ Plane SelectionSelects the YZ plane for circular interpolation. Arc movements will occur in the YZ plane with X as the perpendicular axis.Plane SelectionMillAll 7

Units and modes 9

Inch or metric (G20, G21), absolute or incremental (G90, G91), feed per minute, per revolution or inverse time (G93 to G95), and constant surface speed against fixed RPM (G96, G97).

Controllers
G20Inch ModeSets the unit system to inches. All position values and feed rates will be interpreted as inches and inches per minute.Units & ModesMill · Lathe · 3D printerAll 7
G21Metric ModeSets the unit system to millimeters. All position values and feed rates will be interpreted as millimeters and mm per minute.Units & ModesMill · Lathe · 3D printerAll 7
G90Absolute PositioningSets absolute positioning mode. All coordinates are interpreted as absolute positions relative to the current work coordinate system origin. On a Haas lathe, and on a Fanuc lathe in G code system A, G90 is the O.D./I.D. turning cycle instead.Units & ModesMill · Lathe · 3D printerAll 7
G91Incremental PositioningSets incremental positioning mode. All coordinates are interpreted as distances relative to the current position. A Haas lathe, or a Fanuc lathe in G code system A, has no G91: incremental moves are written with U and W.Units & ModesMill · Lathe · 3D printerAll 7
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.Units & ModesMillFanuc, Haas, Siemens, Mazak
G94Feed Per MinuteSets feed rate mode to units per minute. Feed rate value represents distance traveled per minute. On a Haas lathe G94 is the end facing cycle, and on a Fanuc lathe in G code system A the end face turning cycle, with feed per minute on G98.Units & ModesMill · Lathe · 3D printerAll 7
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. On a Haas lathe G95 is end face live tooling rigid tapping; feed per revolution there is G99.Units & ModesMill · LatheAll 7
G96Constant Surface SpeedActivates constant surface speed mode (lathe). Spindle RPM varies automatically to maintain constant cutting speed as diameter changes.Units & ModesLatheAll 7
G97Constant RPMCancels constant surface speed mode. Spindle runs at the programmed RPM regardless of cutting diameter.Units & ModesLatheAll 7

Coordinate systems 19

Where part zero is and how the control gets there: G54 to G59 work offsets, G52 and G92 shifts, G53 machine coordinates, G10 offset entry, G15 and G16 polar coordinates, and the reference returns G27 to G30.

Controllers
G10Data Setting / Offset EntryProgrammable data entry for work offsets, tool offsets, and parameters. Allows automatic offset adjustment during program execution.Coordinate SystemMill · LatheFanuc, Haas, Mazak, Okuma
G10.9Direct Offset EntryDirect input of offset values, bypassing safety checks. Use with caution - primarily for automated probing routines.Coordinate SystemMillHaas
G15Polar Coordinate Mode CancelCancels polar coordinate mode and returns to Cartesian (X/Y) coordinate programming.Coordinate SystemMillFanuc, Haas
G16Polar Coordinate ModeEnables polar coordinate programming. X specifies radius (distance from origin) and Y specifies angle in degrees. Useful for bolt circles and patterns.Coordinate SystemMillFanuc, Haas
G27Reference Point Return CheckMoves to reference point and verifies position. Alarms if machine does not reach reference position. Used for safety verification.Coordinate SystemMill · Lathe · 3D printerFanuc, Haas, Mazak
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.Coordinate SystemMill · Lathe · 3D printerAll 7
G28Home Axes (3D Printer)Homes one or more axes to their endstops. Without parameters, homes all axes. Specific to 3D printing firmware.Coordinate System3D printerGrbl, Marlin
G29Return from Reference PointMoves from reference point through intermediate point to final position. Reverses the G28 path.Coordinate SystemMill · Lathe · 3D printerFanuc, Haas, Mazak
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.Coordinate SystemMill · Lathe · 3D printerAll 7
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.Coordinate SystemMill · Lathe · 3D printerAll 7
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.Coordinate SystemMill · Lathe · 3D printerAll 7
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.Coordinate SystemMill · Lathe · 3D printerAll 7
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.Coordinate SystemMill · LatheFanuc, Mazak
G55Work Coordinate System 2Selects work coordinate system 2. Use for second fixture or part setup.Coordinate SystemMill · Lathe · 3D printerAll 7
G56Work Coordinate System 3Selects work coordinate system 3. Use for third fixture or part setup.Coordinate SystemMill · Lathe · 3D printerAll 7
G57Work Coordinate System 4Selects work coordinate system 4.Coordinate SystemMill · Lathe · 3D printerAll 7
G58Work Coordinate System 5Selects work coordinate system 5.Coordinate SystemMill · Lathe · 3D printerAll 7
G59Work Coordinate System 6Selects work coordinate system 6.Coordinate SystemMill · Lathe · 3D printerAll 7
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.Coordinate SystemMill · Lathe · 3D printerAll 7

Compensation 7

Tool length (G43, G44, G49) and cutter radius (G40, G41, G42) offsets, plus G37 automatic tool length measurement. The codes most often behind a part that comes out the wrong size.

Controllers
G37Automatic Tool Length MeasurementInitiates automatic tool length measurement using a tool length measuring device (probe). Measures the tool and stores the offset automatically.CompensationMillFanuc, Haas
G40Cutter Compensation CancelCancels cutter radius compensation (G41/G42). Tool path returns to programmed path. Should be called before tool changes and at program end.CompensationMillAll 7
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.CompensationMillAll 7
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.CompensationMillAll 7
G43Tool Length Compensation +Activates tool length compensation in the positive direction. Adds the offset value to the Z axis position. Standard for milling operations.CompensationMillAll 7
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.CompensationMillAll 7
G49Tool Length Compensation CancelCancels tool length compensation. Returns Z axis to programmed values without offset.CompensationMillAll 7

Canned cycles 22

Drilling, boring and tapping cycles G73 to G89, the lathe roughing and finishing cycles G70 to G72, the G12 and G13 circular pockets, G80 to cancel and G98 or G99 for the return level.

Controllers
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.Canned CyclesMillHaas, Fanuc
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.Canned CyclesMillHaas, Fanuc
G70Finishing CycleFinishing cycle that follows a previously defined rough profile (G71/G72). Removes the finishing allowance left by the roughing cycle with a single pass.Canned CyclesLatheFanuc, Haas, Mazak, Okuma
G71Rough Turning Cycle (OD/ID)Automatic roughing cycle for turning. Removes material in multiple passes parallel to the Z-axis, leaving a finishing allowance. Used for OD and ID turning.Canned CyclesLatheFanuc, Haas, Mazak, Okuma
G72Rough Facing CycleAutomatic roughing cycle for facing. Removes material in multiple passes parallel to the X-axis. Used for face roughing operations.Canned CyclesLatheFanuc, Haas, Mazak, Okuma
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.Canned CyclesMillAll 7
G74Left-Hand Tapping CycleLeft-hand (reverse) tapping cycle. For cutting left-hand threads. Spindle runs CCW during cutting.Canned CyclesMillAll 7
G74Face Grooving / Peck Drilling Cycle (Lathe)On lathe: Peck drilling cycle in Z-axis or face grooving cycle. Plunges with pecks for chip breaking.Canned CyclesLatheFanuc, Haas, Mazak
G75Grooving Cycle (OD/ID)Peck grooving cycle for OD or ID grooves. Plunges to depth with multiple pecks for chip breaking, then traverses to create groove width.Canned CyclesLatheFanuc, Haas, Mazak
G76Fine Boring CycleFine boring cycle with oriented spindle stop and shift. Tool retracts off the wall before withdrawing to prevent scratching.Canned CyclesMillAll 7
G80Canned Cycle CancelCancels any active canned cycle (G73, G81-G89). Returns to normal motion mode.Canned CyclesMillAll 7
G81Drilling CycleSimple drilling cycle. Rapids to R-plane, feeds to Z depth, then rapids out. No dwelling or pecking.Canned CyclesMillAll 7
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.Canned CyclesMillAll 7
G83Deep Hole Peck DrillingFull retract peck drilling cycle. Drills incrementally with full retract to R-plane for chip evacuation. Essential for deep holes.Canned CyclesMillAll 7
G84Tapping CycleRight-hand tapping cycle. Feeds in at specified rate, reverses spindle, feeds out. Synchronizes spindle and feed for threading.Canned CyclesMillAll 7
G85Boring CycleSimple boring cycle. Feeds in at specified rate, feeds out at same rate. Provides better finish than rapid retract.Canned CyclesMillAll 7
G86Boring Cycle with Spindle StopBoring cycle that stops spindle at bottom before rapid retract. Prevents drag marks on bore wall.Canned CyclesMillAll 7
G87Back Boring CycleBack boring cycle for machining from the back side. Tool enters through hole, orients, shifts, and bores upward.Canned CyclesMillAll 7
G88Boring Cycle with Manual RetractBoring cycle with dwell and manual retract. Stops at bottom for operator inspection or manual intervention.Canned CyclesMillAll 7
G89Boring Cycle with DwellBoring cycle with dwell at bottom, then feed retract. Dwell allows spring pass for improved finish.Canned CyclesMillAll 7
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.Canned CyclesMillAll 7
G99Return to R-LevelIn canned cycles, tool returns to the R-plane after each hole. Faster for flat surfaces with clear paths between holes.Canned CyclesMillAll 7

Threading 5

Single-point threading with G32 to G34, the G76 lathe threading cycle and the simple G92 thread cutting cycle. Feed is locked to spindle rotation, so these moves ignore the override.

Controllers
G32Single-Pass ThreadingCuts a single threading pass synchronized with spindle rotation. Used for custom thread profiles or when full control is needed. Multiple passes required for full thread.ThreadingLatheFanuc, Haas, Mazak, Okuma
G33Constant Pitch ThreadingContinuous threading at constant pitch. Similar to G32 but for continuous thread cutting. Spindle and Z-axis are synchronized.ThreadingLatheFanuc, Haas, Siemens
G34Variable Lead ThreadingCuts threads with variable (increasing or decreasing) pitch. The lead changes at a specified rate per revolution, creating tapered or accelerating thread forms.ThreadingLatheFanuc, Haas, Siemens
G76Automatic Threading Cycle (Lathe)Complete automatic threading cycle for lathe. Cuts multiple passes with automatic depth calculation, in-feed angle, and spring passes. Most common threading method.ThreadingLatheFanuc, Haas, Mazak, Okuma
G92Threading Cycle (Simple)On lathe: Simple threading cycle for single straight or taper thread pass. Commonly used for threading operations where manual control of each pass is desired.ThreadingLatheFanuc, Haas

Probing 3

G31 skip and G38.2 straight probe, which end the move on a touch signal, and G29 bed levelling on printers.

Controllers
G29Bed LevelingAutomatic bed leveling routine. Probes multiple points on the bed to create a compensation mesh. Essential for good first layer adhesion.Probing3D printerMarlin, Grbl
G31Skip Function / ProbeMoves at feed rate until the skip signal (probe trigger) is received, then stops. Used for touch probing and measuring.ProbingMillAll 7
G38.2Probe Toward - Stop on ContactMoves toward workpiece until probe contact, then stops. Standard probing move. Error if probe doesn't trigger.ProbingMillGrbl, Fanuc, Haas

Scaling and rotation 6

G50 and G51 scaling, G50.1 and G51.1 mirror image, G68 and G69 coordinate rotation: one program, several orientations.

Controllers
G50Scaling Cancel / Max Spindle SpeedOn mills: Cancels scaling (G51). On lathes: Sets maximum spindle speed for constant surface speed mode (G96).Scaling & RotationMill · Lathe · 3D printerAll 7
G50.1Mirror Image CancelCancels mirror image mode. Returns axes to normal direction of movement after G51.1 mirroring.Scaling & RotationMillFanuc, Haas
G51ScalingActivates scaling of programmed coordinates. Multiplies all moves by the scale factor around the specified center point.Scaling & RotationMillAll 7
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.Scaling & RotationMillFanuc, Haas
G68Coordinate System RotationRotates the coordinate system around a specified point by a specified angle. All subsequent moves are in the rotated system.Scaling & RotationMillAll 7
G69Coordinate System Rotation CancelCancels coordinate system rotation activated by G68. Returns to normal coordinate system.Scaling & RotationMillAll 7

Macros 3

G65 one-shot and G66, G67 modal calls into custom macro programs, with arguments passed as letter addresses.

Controllers
G65Macro CallCalls a custom macro program with optional arguments. Allows parameterized subprograms for repetitive operations.MacrosMill · Lathe · 3D printerAll 7
G66Macro Modal CallActivates modal macro call. The macro is executed after every subsequent motion block until cancelled.MacrosMill · Lathe · 3D printerAll 7
G67Macro Modal Call CancelCancels modal macro call activated by G66.MacrosMill · Lathe · 3D printerAll 7

Tool change 2

The printer-side G10 retract and G11 unretract. On a machine tool the change itself is M06.

Controllers
G10Retract FilamentFirmware-controlled filament retraction. Uses pre-configured retraction distance and speed. Prevents stringing during travel moves.Tool Change3D printerMarlin
G11Unretract FilamentReverses firmware-controlled retraction. Pushes filament back after a travel move. Ensures continuous extrusion.Tool Change3D printerMarlin

Descriptions are the one-line entries from the app's reference database. Controller support marks whether a code exists in that dialect, not that it behaves identically; the full pages cover the differences.

By controller

The same list filtered to one control, with the dialect notes that matter on that machine.

Frequently asked questions

What is the difference between G00 and G01?

G00 is a rapid: the control moves each axis at its own maximum rate to reach the position, so the path is not a straight line and nothing should be in the way. G01 is a feed move in a straight line at the programmed F rate, and it is the code you cut with. Both are modal, so one G01 sets the mode for every block that follows until a G00, G02 or G03 replaces it.

Are G-codes the same on every controller?

The core numbers are, the details are not. A Siemens SINUMERIK in its native language has no G43: tool length comes from the tool's D number, and drilling is CYCLE81 rather than G81. Okuma OSP selects work offsets with G15 and an H number, and on an OSP mill G54 to G59 are tool length offset codes, not work offsets. Grbl stops the stream with error:20 on any code it does not support, and Marlin answers "Unknown command" and carries on to the next line. The full pages carry a controller differences table for exactly this reason.

What does modal mean?

A modal code stays in force until another code from the same group replaces it. Program G01 once and every block with axis words feeds until a G00, G02 or G03 appears. A non-modal code acts on its own block only: G04 dwells once, G09 exact-stops one block, G53 suppresses the work offset for one move. The reference marks each code modal or not and names its group.

Which G-code cancels a canned cycle?

G80. On a Fanuc any group 01 motion code, so a plain G00 or G01 block, ends the cycle as well, and G80 throws away the R, Z, Q and P the cycle was holding while F stays modal. Siemens has no G80 in its native language; a cycle is made modal with MCALL and a bare MCALL deselects it. See G80: canned cycle cancel.

What is the difference between G90 and G91?

G90 reads every axis word as a position in the active work coordinate system; G91 reads it as a distance from where the tool is now. The one that catches people is G28: the X, Y and Z on the block are the intermediate point, read in whichever mode is live, so G90 G28 Z0. goes to part zero before it goes home. See G27 to G30: reference point return.

Updated 26 Oct 2026