Controllers

Grbl G-code practice

Grbl runs a subset of standard G-code: G0 to G3 motion with arcs, G4 dwell, planes, units, G90/G91, the G54 to G59 work offsets, G28/G30, G38.x probing and G43.1 tool length, plus M3, M4, M5, coolant and program stops. It leaves out canned cycles, cutter compensation and tool changing, so CAM writes those moves out in full. Machine settings live in separate $ commands, not in the program.

What carries over from any control

Every motion line in a Grbl file reads the same as on an industrial control: G0 is rapid, G1 is a feed move, G2 and G3 are arcs with I/J/K or R, and the work offsets, units and absolute or incremental mode mean what the common G-codes page says. If you can read a Grbl file you can read most of a Fanuc program; what you will not have met yet are the cycles and compensation codes Grbl does not use.

Codes that are specific to Grbl

These exist on Grbl (and LinuxCNC) but are not part of the everyday Fanuc set.

Code or wordWhat it does
G38.2 to G38.5Straight probe: move until the probe touches (or stops touching), then record the position. Used with a touch plate to find Z zero.
G43.1 Z…Dynamic tool length offset: the offset value is in the line itself, not looked up from a table. Cancel with G49.
G28.1 / G30.1Store the current machine position as the G28 or G30 position.
G10 L2 / G10 L20Set a work offset from the program. L20 sets it so the current position becomes the value given.
G92 / G92.1Temporary coordinate shift, and its cancel. Easy to forget it is active.
M4 in laser modeWith laser mode on ($32=1), M4 scales laser power with speed so corners do not burn.

What Grbl leaves out

  • No canned cycles. G81 to G89 are not supported. Each hole is written as separate moves; CAM does this for you.
  • No cutter compensation. G41 and G42 are not supported. CAM must output the toolpath already offset for the tool radius.
  • No automatic tool change. Stock Grbl has no tool changer to drive. Multi-tool jobs are split into files, or the sender pauses so you can change the bit and re-zero Z.
  • Settings are not G-code. $$ lists settings, $H homes, $X clears an alarm. They are typed in the console or sent by the sender, never part of the program.

Habits that help

  • Set Z zero with a probe, not by eye. A G38.2 touch-plate routine gives the same zero every time; a paper-feel zero drifts with every tool change.
  • Read the alarm before unlocking. $X clears an alarm but not its cause. Alarm 1 (hard limit) and alarm 2 (soft limit) mean the job tried to leave the machine's travel.
  • Check the units line. A file in G20 on a machine you zeroed in millimetres cuts 25.4 times too far. Look for G20 or G21 in the first lines.

Quiz: the codes Grbl uses

Question 1 of 10Score 0

Mill: what does this code do?

G91

Keep going with saved progress and review of missed codes

Codes and options vary by control version and machine builder. Check the manual for your machine before running a program.

More practice hubs

Frequently asked questions

Which G-codes does Grbl support?
Grbl 1.1 supports G0, G1, G2, G3, G4, G10 L2/L20, G17 to G19, G20, G21, G28, G30 (and G28.1/G30.1), G38.2 to G38.5, G40, G43.1, G49, G53, G54 to G59, G61, G80, G90, G91, G91.1, G92, G93, G94, and M0, M1, M2, M30, M3, M4, M5, M7, M8 and M9. The official Grbl wiki has the full list for each version.
Why does my Grbl machine ignore G81 or G41?
Grbl does not implement canned cycles or cutter compensation, to keep its real-time planner small enough for a microcontroller. Set your CAM post-processor to output drilling and offset toolpaths as plain G0 and G1 moves.
Are $ settings part of the G-code program?
No. $ commands configure the machine (travel, speeds, homing, laser mode) and are sent from the console or the sender. The program file should only contain G-code.
Is learning G-code on Grbl useful for a job on industrial machines?
Yes for the core: motion, arcs, offsets, units and M-codes read the same way. Add the canned cycles, cutter compensation and tool length offsets from tables, which industrial controls use on every job.

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.

Free preview · no card Try G-Code Sprint