liminfo

G-Code Simulator

Free web tool: G-Code Simulator

G0Rapid Move

Move to position at maximum speed (non-cutting)

G0 X10 Y20 Z5

G1Linear Move

Move to position at specified feed rate (cutting)

G1 X10 Y20 F100

G2CW Arc

Clockwise circular interpolation

G2 X10 Y0 I5 J0 F100

G3CCW Arc

Counter-clockwise circular interpolation

G3 X10 Y0 I5 J0 F100

G4Dwell

Pause for specified time

G4 P1000 (1 second)

G17XY Plane

Select XY plane for arcs

G17

G18XZ Plane

Select XZ plane for arcs

G18

G19YZ Plane

Select YZ plane for arcs

G19

G20Inch Mode

Set units to inches

G20

G21Metric Mode

Set units to millimeters

G21

G28Home

Return to machine home position

G28 G91 Z0

G40Cancel Comp

Cancel cutter radius compensation

G40

G41Left Comp

Cutter compensation left

G41 D1

G42Right Comp

Cutter compensation right

G42 D1

G43Tool Length+

Tool length compensation positive

G43 H1 Z0.1

G54-G59Work Offsets

Select work coordinate systems 1-6

G54

G80Cancel Cycle

Cancel canned cycle

G80

G81Drill

Simple drilling cycle

G81 X1 Y1 Z-0.5 R0.1 F10

G83Peck Drill

Peck drilling cycle with chip breaking

G83 X1 Y1 Z-1 Q0.1 R0.1 F5

G90Absolute

Absolute positioning mode

G90

G91Incremental

Incremental positioning mode

G91

M0Program Stop

Unconditional program stop

M0

M1Optional Stop

Optional program stop

M1

M3Spindle CW

Start spindle clockwise

M3 S10000

M4Spindle CCW

Start spindle counter-clockwise

M4 S10000

M5Spindle Stop

Stop spindle

M5

M6Tool Change

Perform tool change

M6 T1

M7Mist Coolant

Turn on mist coolant

M7

M8Flood Coolant

Turn on flood coolant

M8

M9Coolant Off

Turn off all coolant

M9

M30End Program

End program and rewind

M30

About G-Code Simulator

The G-Code Reference is a browser-based CNC programming quick-lookup tool that provides instant access to over 30 standard G-codes and M-codes used in CNC milling, turning, and machining centers. The reference covers motion commands (G0 rapid move, G1 linear feed, G2/G3 arc interpolation), plane selection (G17/G18/G19), units (G20/G21), homing (G28), cutter compensation (G40/G41/G42), tool length compensation (G43), work coordinate systems (G54–G59), canned drilling cycles (G80/G81/G83), and positioning modes (G90/G91), as well as M-codes for spindle control (M3/M4/M5), tool changes (M6), coolant (M7/M8/M9), and program flow (M0/M1/M30).

CNC machinists, CAM programmers, manufacturing engineers, and vocational students use this reference to quickly look up code meanings, parameter syntax, and usage examples without opening a heavy machine manual. Each entry displays the code name, a concise description of its function, and a representative example line such as "G83 X1 Y1 Z-1 Q0.1 R0.1 F5" for the peck drilling cycle, making it easy to recall the correct parameter order at the machine.

The tool features live search filtering across all code names, descriptions, and numeric identifiers simultaneously, so typing "drill" instantly narrows the list to drilling-related codes while typing "G8" shows G80, G81, and G83. Tab filtering lets you separate G-codes from M-codes when you want to focus on one category. All filtering happens in the browser using React's useMemo — no server requests are made, and the reference works offline once the page is loaded.

Key Features

  • Covers 30+ standard G-codes: G0, G1, G2, G3, G4, G17–G19, G20, G21, G28, G40–G43, G54–G59, G80, G81, G83, G90, G91
  • Covers 10 essential M-codes: M0, M1, M3, M4, M5, M6, M7, M8, M9, M30
  • Each entry includes a code badge, function name, plain-English description, and a concrete usage example
  • Live search filters across code number, name, and description simultaneously — type to narrow results instantly
  • Tab filters to show All Codes, G-Codes only, or M-Codes only for focused browsing
  • Highlighted selected row for visual context when switching between codes
  • Bilingual interface — Korean and English via site locale toggle
  • Fully client-side filtering with useMemo — works offline once loaded, no server calls needed

Frequently Asked Questions

What is the G-Code Reference tool?

It is a free, browser-based quick-reference for CNC G-codes and M-codes. It lists over 30 standard codes used in CNC milling and machining centers, each with a function name, description, and usage example. You can search and filter codes in real time to find what you need without consulting a machine-specific manual.

What is the difference between G-codes and M-codes?

G-codes (preparatory function codes) control the motion and geometry of the machine — positioning, feed rates, arc interpolation, canned cycles, and coordinate modes. M-codes (miscellaneous function codes) control auxiliary machine functions — starting and stopping the spindle, performing tool changes, enabling coolant, and controlling program flow (stop, end, optional stop).

What G-codes are included in the reference?

The reference includes: G0 (rapid move), G1 (linear feed move), G2 (clockwise arc), G3 (counter-clockwise arc), G4 (dwell), G17/G18/G19 (plane selection), G20/G21 (inch/metric units), G28 (home return), G40/G41/G42 (cutter radius compensation), G43 (tool length compensation), G54–G59 (work coordinate systems), G80 (cancel canned cycle), G81 (drill cycle), G83 (peck drill cycle), G90/G91 (absolute/incremental positioning).

What M-codes are included?

M0 (program stop), M1 (optional stop), M3 (spindle clockwise), M4 (spindle counter-clockwise), M5 (spindle stop), M6 (tool change), M7 (mist coolant on), M8 (flood coolant on), M9 (coolant off), M30 (end program and rewind).

How do I search for a specific code?

Type in the search box at the top of the code list. The tool filters results in real time across the code number, function name, and description. For example, typing "drill" shows G81 and G83; typing "G4" shows G40, G41, G42, and G43; typing "coolant" shows M7, M8, and M9.

What does G90 vs G91 mean?

G90 sets absolute positioning mode, where all axis coordinates are measured from the work coordinate origin. G91 sets incremental positioning mode, where coordinates represent the distance to move relative to the current position. Most programs start in G90 mode. Switching to G91 is common for canned cycles and subroutines where relative distances are more convenient.

What is a canned cycle?

A canned cycle is a pre-programmed sequence that automates repetitive machining operations like drilling, boring, or tapping at multiple locations. G81 performs a simple drill cycle (rapid to position, feed to depth, rapid retract), while G83 performs a peck drill cycle that retracts periodically to break chips and clear them from deep holes. G80 cancels any active canned cycle.

Does the reference cover machine-specific codes?

The reference covers industry-standard codes common to most FANUC-compatible CNC controllers. Machine-specific codes or controller-proprietary extensions (such as Haas or Mazak custom cycles) are not included. Always consult your machine's programming manual for codes specific to your controller.