G91 G-code

Relative Coordinates

G91 means “all moves starting now are in relative coordinates”.

This means positions are given relative to the current position, and not relative to the 0,0,0 point of the current workspace coordinate system (which is what G90 does).

When Smoothie starts, G90 is the default mode, not G91.

G91 is often used when G-code is manually sent to the machine.

G91’s evil twin is G90.

Format

The command is used as such:

G91

Which means: starting now all positions are relative.

G91        ; Standard G91 (subcode 0, default)
G91.0      ; Explicit subcode notation (equivalent to G91)

Which means: starting now all positions are relative. V2 supports explicit subcode notation (G91.0) but only subcode 0 is valid.

Parameters

No parameters.

Subcode

V1 does not support subcodes. G91 is always interpreted as relative mode.

V2 Subcode Support:

  • 0: Standard relative positioning mode (default if no subcode specified)
  • Other values: Not supported; returns an error if specified

This design allows for future extensions (e.g., G91.1, G91.2) while maintaining compatibility with existing code.

Implementation Details

V1 Implementation:

  • Sets both absolute_mode and e_absolute_mode to false
  • Affects X, Y, Z axes AND extruder (E axis)
  • Coordinates are interpreted as displacements from the current position
  • Workspace offsets (G54-G59, G92, tool offset) are not re-applied for each move
  • Modal command (remains active until changed by G90 or M82)

V2 Implementation:

  • Sets both absolute_mode and e_absolute_mode to false (same as V1)
  • Includes subcode validation: only subcode 0 is accepted
  • Returns an error for invalid subcodes instead of silently accepting them
  • Affects X, Y, Z axes AND extruder (E axis)
  • Coordinates are interpreted as displacements from the current position
  • Workspace offsets (G54-G59, G92, tool offset) are not re-applied for each move
  • Modal command (remains active until changed by G90 or M82)

Further reading

These resources are used as references for Gcode:

See also: G90 (Absolute positioning mode)

This is a wiki! If you'd like to improve this page, you can edit it on GitHub.