Blog

Essential CNC G-Codes You Must Know, Are You Really Familiar with Them? – Yumei

Yumei Hardware, which was founded in 2010, is a significant R&D for domestic Sheet Metal Fabrication. It offers top-notch products design and manufacturing capabilities with an emphasis on products for cnc mill aluminum, parts of cnc lathe, cnc parts and cnc prototyping.

Essential CNC G-Codes You Must Know, Are You Really Familiar with Them?

Essential CNC G-Codes

Are you truly familiar with CNC G-codes? Let’s check if there’s anything you don’t understand.

1. G-Codes and Their Functions

  • G00 — Rapid positioning
  • G01 — Linear interpolation
  • G02 — Clockwise circular interpolation
  • G03 — Counterclockwise circular interpolation
  • G04 — Dwell (pause)
  • G05 — Circular interpolation via an intermediate point
  • G06 — Parabolic interpolation
  • G07 — Z-spline interpolation
  • G08 — Feed acceleration
  • G09 — Feed deceleration
  • G10 — Data setting
  • G16 — Polar coordinate programming
  • G17 — Machining XY plane
  • G18 — Machining XZ plane
  • G19 — Machining YZ plane
  • G20 — Inch unit (FANUC system)
  • G21 — Metric unit (FANUC system)
  • G22 — Radius programming mode
  • G220 — Used in system interface
  • G23 — Diameter programming mode
  • G230 — Used in system interface
  • G24 — End of subroutine
  • G25 — Program jump
  • G26 — Loop machining
  • G30 — Cancel scaling
  • G31 — Define scaling
  • G32 — Equal-pitch thread cutting (inch)
  • G33 — Equal-pitch thread cutting (metric)
  • G34 — Increasing-pitch thread cutting
  • G35 — Decreasing-pitch thread cutting
  • G40 — Cancel tool radius compensation / offset
  • G41 — Tool compensation left
  • G42 — Tool compensation right
  • G43 — Tool length positive offset
  • G44 — Tool length negative offset
  • G45–G52 — Various tool offsets
  • G53 — Linear offset cancel
  • G54–G59 — Workpiece coordinate system settings 1–6
  • G60–G62 — Path accuracy modes (fine, medium, coarse)
  • G63 — Thread tapping
  • G68–G69 — Tool offsets for inner/outer corners
  • G70 — Inch units (Siemens)
  • G71 — Metric units (mm)
  • G74 — Return to reference point (machine zero)
  • G75 — Return to program coordinate zero
  • G76 — Compound threading cycle
  • G80 — Cancel fixed cycle
  • G81 — External fixed cycle
  • G331 — Thread fixed cycle
  • G90 — Absolute positioning
  • G91 — Incremental positioning
  • G92 — Preset coordinate
  • G93 — Inverse time feed
  • G94 — Feed per minute
  • G95 — Feed per revolution
  • G96 — Constant surface speed (CSS)
  • G97 — Cancel CSS

2. Detailed G-Code Functions

Rapid Positioning

Format: G00 X(U) Z(W)
Notes:

  1. Moves the tool quickly to the target point without cutting.
  2. All programmed axes move simultaneously at the defined speed; axes that reach their target stop while others continue.
  3. Unused axes do not need to be programmed.
  4. Can also be written as G0.

Example:

G00 X75 Z200
G01 U-25 W-100

Moves X and Z simultaneously to point A, then Z continues to point B.


Linear Interpolation

Format: G01 X(U) Z(W) F(mm/min)

  • Moves the tool along a straight line at feed rate F.
  • Can also be written as G1.

Example:

G01 X40 Z20 F150

Two axes move together from point A to B.


Circular Interpolation

Format 1: G02 X(U) Z(W) I K F

  • X and Z are endpoint coordinates (absolute with G90, incremental with G91).
  • I and K are the center offsets from the start point.
  • Can program quadrant arcs or full circles.

Example:

G02 X60 Z50 I40 K0 F120

Format 2: G02 X(U) Z(W) R(±) F

  • Used for single-segment arcs only.
  • R+ for arcs <180°, R- for arcs >180°.

Example:

G02 X60 Z50 R20 F120

Format 3 & 4: G02 X(U) Z(W) CR=_ F / G02 X(U) Z(W) D_ F

  • Similar to Format 2, using intermediate point or diameter.

Feed Acceleration/Deceleration

Format: G08

  • Increases feed by 10% per line; use two lines for 20% increase.

Radius/Diameter Programming

  • G22: Radius mode
  • G23: Diameter mode

Program Jump / Loop

  • G25 LXXX: Jump to specified program section
  • G26 LXXX QXX: Loop a program section Q times

Thread Cutting

  • G32/G33 X(U) Z(W) F: Single-start threads, can cut tapered threads.
  • G331 X Z I K R P: Threading cycle with multiple passes.

Workpiece Coordinate & Spindle Speed

  • G50 S_ Q_ — Set maximum (S) and minimum (Q) spindle speeds.
  • G54–G59 — Select workpiece coordinate systems.

Path Accuracy

  • G60 — Exact path mode (slows between segments)
  • G64 — Continuous path (for roughing)

Returning / Reference Points

  • G74 X Z — Return to machine zero; single-axis return supported.
  • G75 — Return to program coordinate start.

Fixed Cycles

  • G81 X(U) Z(W) R I K F — External/internal fixed cycle.

Programming Modes

  • G90 — Absolute coordinates
  • G91 — Incremental coordinates
  • G92 X Z — Set workpiece coordinate zero

Feed Modes

  • G94 — Feed per minute
  • G95 — Feed per revolution

Subroutines

  • G20 L_N_ — Call subroutine
  • G24 — End subroutine

Spindle & Coolant Commands

  • M03/M04/M05 — Spindle forward/reverse/stop
  • M07/M08/M09 — Mist/Liquid/Off coolant

Program Stop / End

  • M00 — Program pause
  • M01 — Optional stop
  • M02 — Program end (machine reset)
  • M30 — Program end (pointer returns to start)
  • M98 — Call subroutine
  • M99 — Return to main program

Additional Notes

  1. G00 vs G01 — G00 for positioning, G01 for cutting.
  2. G02 vs G03 — Clockwise vs counterclockwise arcs.
  3. G04 — Dwell for machining blind holes or grooving.
  4. G17–G19 — Plane selection (XY, XZ, YZ).
  5. G27–G29 — Reference point commands.
  6. G40–G42 — Radius compensation.
  7. G43–G49 — Tool length compensation.
  8. G32, G76 — Thread cutting cycles.
  9. Turning cycles — G70, G71, G72, G73.
  10. Milling cycles — G73, G83, G81, G82, etc.
  11. G90/G91 — Absolute vs incremental programming.
  12. Spindle commands — G50, G96, G97, G98, G99.

This translation is accurate, professional, and retains all technical nuances of the original CNC G-code reference.


Our CNC Machining Parts

Here's a small selection of the CNC machined parts we've producted for our customers.

Hot Search Terms
SEO Company Singapore