CNC G-code list
Motion
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G00 | Rapid positioning | Moves to a point at full rapid speed, not cutting. | Mill and lathe |
G01 | Linear interpolation (feed move) | Cuts in a straight line at the programmed feed rate F. | Mill and lathe |
G02 | Circular interpolation, clockwise | Cuts an arc clockwise, seen from the positive end of the axis normal to the plane. | Mill and lathe |
G03 | Circular interpolation, counterclockwise | Cuts an arc counterclockwise. | Mill and lathe |
G32 | Thread cutting (single pass) | Cuts one thread pass, synchronising feed with the spindle. | Lathe |
Plane
Modal: one stays active until another from this group replaces it.
Units
Modal: one stays active until another from this group replaces it.
Positioning mode
Modal: one stays active until another from this group replaces it.
Feed mode
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G93 | Inverse time feed | F is 1 divided by the time the move should take, in minutes. | Mill |
G94 | Feed per minute | F is read in mm (or inches) per minute. | Mill |
G95 | Feed per revolution | F is read per spindle revolution. | Mill |
G98 | Feed per minute (lathe) | On a system A lathe, F is read per minute. | Lathe |
G99 | Feed per revolution (lathe) | On a system A lathe, F is read per spindle revolution. The normal turning mode. | Lathe |
Spindle speed mode
Modal: one stays active until another from this group replaces it.
Work offset
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G54 | Work offset 1 | Selects the first work coordinate system, where program zero is on the part. | Mill and lathe |
G55 | Work offset 2 | Selects work coordinate system 2. | Mill and lathe |
G56 | Work offset 3 | Selects work coordinate system 3. | Mill and lathe |
G57 | Work offset 4 | Selects work coordinate system 4. | Mill and lathe |
G58 | Work offset 5 | Selects work coordinate system 5. | Mill and lathe |
G59 | Work offset 6 | Selects work coordinate system 6. | Mill and lathe |
Tool length
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G43 | Tool length compensation + | Applies the tool length offset H so Z positions are measured from the tool tip. | Mill |
G44 | Tool length compensation − | Subtracts the tool length offset instead of adding it. Rarely used. | Mill |
G49 | Tool length compensation cancel | Cancels G43 or G44. | Mill |
Cutter compensation
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G40 | Cutter compensation cancel | Turns off cutter radius (or tool nose) compensation. | Mill and lathe |
G41 | Cutter compensation left | Offsets the tool to the left of the path, looking in the direction of travel. | Mill and lathe |
G42 | Cutter compensation right | Offsets the tool to the right of the path. | Mill and lathe |
Canned cycle
Modal: one stays active until another from this group replaces it.
| Code | Name | What it does | Machine |
|---|---|---|---|
G73 | High-speed peck drilling | Drills in pecks with a small retract to break the chip. | Mill |
G74 | Left-hand tapping cycle | Taps a left-hand thread: spindle counterclockwise in, clockwise out. | Mill |
G76 | Fine boring cycle | Bores, orients the spindle and shifts the tool away before retracting. | Mill |
G80 | Canned cycle cancel | Cancels the active drilling or tapping cycle. | Mill |
G81 | Drilling cycle (spot drill) | Feeds to depth and rapids out: one move per hole. | Mill |
G82 | Drilling cycle with dwell | Like G81, but dwells at the bottom for P time. | Mill |
G83 | Deep hole peck drilling | Pecks Q deep and retracts fully out of the hole each time. | Mill |
G84 | Tapping cycle (right hand) | Taps to depth, reverses the spindle and feeds out. | Mill |
G85 | Boring cycle (feed out) | Feeds in and feeds back out, for reaming and boring. | Mill |
G86 | Boring cycle (spindle stop, rapid out) | Bores, stops the spindle at the bottom and rapids out. | Mill |
G89 | Boring cycle with dwell (feed out) | Like G85, with a dwell at the bottom. | Mill |
Cycle return
Modal: one stays active until another from this group replaces it.
Lathe cycle
| Code | Name | What it does | Machine |
|---|---|---|---|
G70 | Finishing cycle | Runs the finish pass along a profile already defined for G71, G72 or G73. | Lathe |
G71 | Rough turning cycle | Roughs a profile along Z in repeated passes, leaving finishing stock. | Lathe |
G72 | Rough facing cycle | Like G71, but the passes run along X, for faces. | Lathe |
G73 | Pattern repeating cycle (lathe) | Repeats the finished profile offset outward, for forgings and castings. | Lathe |
G74 | Face peck drilling / grooving (lathe) | Pecks along Z, used for drilling on centre or face grooving. | Lathe |
G75 | Grooving cycle (X) | Pecks along X to cut a groove on a diameter. | Lathe |
G76 | Threading cycle (multi-pass) | Cuts a complete thread in many passes from one or two lines. | Lathe |
G90 | Outside/inside diameter cutting cycle (lathe) | A simple box cycle: in X, along Z, out X, back to start. | Lathe |
G92 | Thread cutting cycle (lathe) | Cuts one thread pass and returns, one line per pass. | Lathe |
G94 | Facing cycle (lathe) | A simple box cycle for faces: along X, then out in Z. | Lathe |
Polar coordinates
Modal: one stays active until another from this group replaces it.
Rotation
Modal: one stays active until another from this group replaces it.
Cutting mode
Modal: one stays active until another from this group replaces it.
Non-modal
Each acts only on its own line.
| Code | Name | What it does | Machine |
|---|---|---|---|
G04 | Dwell | Pauses motion for a set time; the spindle keeps running. | Mill and lathe |
G09 | Exact stop (one block) | Makes the machine stop fully at the end of this one block before moving on. | Mill and lathe |
G10 | Programmable data input | Writes offsets (work offsets, tool offsets) from inside the program. | Mill and lathe |
G28 | Return to reference position | Sends the named axes home, by way of an intermediate point. | Mill and lathe |
G30 | Return to second reference position | Like G28, but to a second stored position, often the tool-change point. | Mill and lathe |
G50 | Maximum spindle speed (lathe) | With S, caps the spindle RPM during constant surface speed. | Lathe |
G52 | Local coordinate system | Shifts the zero point temporarily inside the active work offset. | Mill and lathe |
G53 | Machine coordinate move | Moves to a position in machine coordinates for this one line. | Mill and lathe |
G65 | Macro call | Calls a macro program and passes it arguments. | Mill and lathe |
G92 | Set coordinate system (shift) | Tells the control that the current position has the given coordinates. | Mill |
Meanings follow the common Fanuc-style standard shared by Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls; lathe meanings use Fanuc G-code system A. Check the manual for your control before running a program.
Frequently asked questions
- What are the most important G-codes to learn first?
- Start with G00, G01, G02, G03, G04, G20, G21, G28, G40, G41, G42, G43, G54, G80, G81, G83, G84, G90, G91, G96, G97. They appear in nearly every program: motion, units, plane, work offset, tool length and cutter compensation, and the basic drilling cycles.
- What does modal mean for a G-code?
- A modal G-code stays active on every following line until another code from the same group replaces it. G01 keeps cutting at feed until G00, G02 or G03 is programmed. Non-modal codes such as G04 or G28 act only on their own line.
- Are G-codes the same on a mill and a lathe?
- Most are, but some numbers change meaning. On a lathe with Fanuc G-code system A, G90 is a turning cycle rather than absolute mode, G92 is a threading cycle and G98/G99 set the feed mode. This list shows both meanings where they differ.
- Are G-codes the same on Haas and Fanuc?
- The common codes behave the same because both follow the Fanuc-style standard. Options, cycle parameters and some machine-specific codes differ, so check the manual for your control.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.