# G01

The Linear Interpolation G-code, known as G01 allows the machine to move with exact synchronization of all its axis. The machine will move relative to the absolute position set initially or through offsets. The G01 G-code can also be written as G1, and most CNC programs can accept either G01 or G1. We use G1 in our examples to save space, which is important when using software such as Grbl.

```Standard Format:
G1 X0.000 Y0.000 Z0.000 F100.0
```

Where the numbers following the X, Y, Z and F can be changed for the desired amount. Additional commands can also be added for a 4-Axis or larger machine.

## Code Examples

In this example, the machine will move from its current position to an absolute position of (1,1,0) units at a federate of 100 units per minute. (The units can be set using G20 and G21.)

```G1 X0.000 Y0.000 Z0.000 F100.0
G1 X1.000 Y1.000 Z0.000 F100.0
```

This example will raise the height of the Z-Axis from the origin to be 1 unit higher at the current federate. Notice that units that are not changed, do not have to be entered.

```G1 Z0.000 F100.0
G1 Z1.000
```

This example shows that negative movements are also possible. We will move from the origin position of (0,0,0) to (-1,-1,-1).

```G1 X0.000 Y0.000 Z0.000 F100.0
G1 X-1.000 Y-1.000 Z-1.000
```

As a final example we will take a system that is setup to run in inches, move to an absolute position of (1,1,1) convert to mm, move one millimeter from the origin and then convert back to inches. The final position will be (1 mm, 1 inch, 1 inch). The change of units is done with G20 and G21, and an a M-code (M02) indicates the end of the cycle.

```G20
G1 X0.000 Y0.000 Z0.000 F100
G1 X1.000 Y1.000 Z1.000 F100
G21
G1 X1.000
G20
M2
```