Basic Movement Commands#

Before reading about the movement commands, make sure you are familiar with the parser state. It is critical to understanding how the command parameters are interpreted.
Read about it here: Parser state

Another important concept to understand is that a movement command will only move along the specified axes. If your command only contains a Z coordinate, then it will only move up or down. If it contains only X and Y, it will only move horizontally. (G28 and G30 are exceptions, as they will move on all axes if none are listed).

Machine coordinate system (G53)#

When you specify absolute coordinates in a movement command, unless otherwise specified, they are in the work coordinate system.

G0 G90 X0 Y0 Z0 - goes to the work origin

Sometimes you wish to use machine coordinates. In that case you have to explicitly include G53 in your command

G0 G53 G90 Z0 - goes to Z0 in machine coordinates

Unlike other modifiers, G53 will not change the parser state and will not affect future commands. To issue multiple moves in machine space you must include G53 in each one.

Keep in mind that machine coordinates are only meaningful after a successful homing operation.
Read more about coordinate systems here: Coordinate systems

Rapid move (G0)#

G0 is a straight line rapid move to the specified location. It always moves at top speed, ignoring the current feed rate.

This command will move to X 50 and Y 50. Whether that’s 50 millimeters or 50 inches, whether it is a relative 50 or absolute position, will depend on the current parser state.

G0 X50 Y50

Feed move (G1)#

G1 performs a straight line move to the specified location. It uses the specified feed rate, or the default from the current parser state.

G1 X50 Y50 F100

Probing (G38.2, G38.3)#

G38.2 starts a move towards the specified location and stops if it encounters contact with the touch probe. If the destination is reached without contact, it will raise an Alarm.

This command will start a slow move 15 mm straight down from the current location at a slow speed of 100mm/min.

G38.2 G21 G91 Z-15 F100

The G38.3 command works exactly the same as G38.2 except that it doesn’t raise an Alarm if it fails to reach the probe.

Danger: During probing you usually have the material and your fingers close to the spindle. The wrong command can send the tool moving too fast or in the wrong direction, resulting in injury and other damage. It is highly recommended to explicitly specify the units (with G21 or G20), select relative movement with G91 and set a slow feed rate with F to avoid dangerous moves.

Saved positions (G28, G30)#

The Grbl software can permanently save 2 positions in space, called G28 and G30. They can be used for different purposes, like a safe position before and after a cut, or for parking location at the end of the day, or for convenient tool changing location, and many others.

Setting the positions

G28.1 - store the current position in the G28 slot
G30.1 - store the current position in the G30 slot

Using the positions

G28 G91 Z0 - move the Z axis to the Z position of the G28 slot
G30 G91 X0 Y0 - move the X and Y axes to the XY position of the G28 slot
G28 - move all axes to the G28 location. This is equivalent to "G28 G91 X0 Y0 Z0"

Warning: It is very important to understand that G28 and G30 commands perform 2 separate moves. First they will move to the specified coordinates and then move to the saved location. This is a bit tricky to explain, and frankly not that useful.
You should always include G91 in the command and use only X0, Y0 and Z0 for the coordinates. This will eliminate the first move and go directly to the desired location.
You can read more about the full behavior and the reasons behind it in the G-code specifications.

Warning: Make sure to run homing before using these commands. They work in machine coordinate system, which is undefined before the machine is homed.

Warning: Make sure to set the positions before you use them. On a new machine they could be set to an arbitrary value that is unsafe.

Jogging#

Grbl has a special syntax for jogging commands

$J=X10 F1000

Jogging is similar to G1 move commands with a few key differences:

  • The F parameter is mandatory and applies only to the current command
  • While jog commands can use the current parser state, they will not change it. If you use G21 or G91, the parser state will remain unchanged for future commands
  • Jog commands can only be issued if the machine is currently idle or jogging. They will not queue up with other commands

Discussion#

Comment Form is loading comments...

  © 2026 Ivo Beltchev cnc@ibeltchev.com