What Is the G92 (E0) G-Code Command in Marlin Firmware?

The G92 G-code command, especially in the form of G92 E0, is one that you will commonly come across in the Cura Start G-code section by default for many 3D printers, such as the highly popular Ender 3, which effectively means that it automatically runs before each print.

In this guide, we will describe the function of the G92 (and G92 E0) G-code command, go through the usage of this command along with the parameters it accepts, and explain the scenarios where it would be correct to use it.

What Is the G92 (E0) G-Code Command in Marlin Firmware?

The G92 (Set Position) command sets the current position of the 3D printer to the values you have specified for the X, Y, Z, and E axes, effectively allowing you to override the X-axis, Y-axis, Z-axis, and E-axis values according to your needs.

x and y axes position before using g92 example

In the example image above, you can see that the X-axis and Y-axis positions of the 3D printer are X0 Y0, which, on a correctly configured 3D printer, corresponds to the nozzle positioned at the front-left corner of the print bed.

Once you use the G92 G-code command with an X-axis value of -3 and a Y-axis value of -5 at this position (G92 X-3 Y-5), the current location of the X and Y axes will now be X-3 and Y-5 instead, which effectively means that X0 Y0 will instead be positioned 3 mm to the right, and 5 mm to the back from the front-left corner of the print bed.

x and y axes position after using g92 example

G92 E0, on the other hand, explicitly means that the E-axis position (specified by the E parameter), which refers to the extruder position, is being set to a value of 0, effectively resetting the extruder and making it ready to print.

running g92 e0 on octoprint

To understand why this is necessary and how this “resets” the extruder, we will first need to take a quick look at the M82 (E Absolute) and M83 (E Relative) G-code commands, with M82 being present at the start of every G-code file that Cura produces, as this command essentially determines how the E-axis positioning will work.

m82 gcode in gcode file

When the E-axis is in absolute mode as a result of running the M82 G-code command, it practically functions the same way as any other axis regarding its positioning and movement (which already use absolute positioning by default), which makes it move from the position it’s currently at to the location specified by the value of the E parameter of the G0 / G1 G-code command.

For instance, when the E-axis position is E0, and you move the E-axis to the 10 mm (G1 E10) location, you will effectively prompt your 3D printer to extrude 10 millimeters of filament, and once your 3D printer finishes extruding the filament, E10 will be the new position of the E-axis as a result.

Now, in a scenario where you move the E-axis to E5 by sending the G1 E5 G-code command while it’s already at E10, the extruder will have to go back by 5 millimeters to reach the E5 point, meaning that it will retract 5 millimeters of filament.

Technically, this is no different than how the X, Y, and Z axes work by default, and if we go off the same example for the X-axis, sending the command G1 X10 would naturally move the printhead 10 mm to the right and following that up with G1 X5 would move it 5 mm to the left to bring it back from the X10 position to the X5 position, which is standard movement.

extruder absolute positioning explained

On the other hand, in the scenario where the E-axis uses relative positioning mode, which you can activate with the M83 G-code command, the positioning system that’s in use will be different than what you are used to seeing on the X, Y, and Z axes by default, with the value of each movement command determining how much the E-axis will move instead of where it will move.

Once again, going with the same example from earlier, starting off with an E-axis position of E0 and sending the G1 E10 G-code command will cause your 3D printer to move the E-axis by 10 mm, which will end up with the extrusion of 10 millimeters of filament, and the E-axis position ending up at E10.

Afterward, once you follow that up with G1 E5, the difference will be the extruder moving forward again by 5 mm, resulting in your 3D printer extruding another 5 millimeters of filament, and bringing the E-axis position to E15.

extruder relative positioning explained

From the two examples above, we can quickly see the differences between these two modes, with the absolute mode practically measuring how far the origin point (0) is from the specified value to move the axis position and the relative mode adding this value to the current location of the axis instead.

Putting into consideration that Cura uses absolute extrusion by default, running the G92 E0 command before starting the print ensures that the extruder is positioned correctly at its starting point, not too different than how the X, Y, and Z axes move to the particular location where the first layer begins at the start of a print.

This way, when the firmware runs a G-code line that contains extrusion for the first time, the extruder correctly moves to the specified position, effectively meaning that it pushes out the right length of the filament, which in turn causes the proper amount of plastic to come out of the nozzle for each of the extrusion commands that follow, as they all depend on the extruder position starting at 0.

On the other hand, if the E-axis was at any other position than E0 at the beginning of the print, and was not reset to 0 with G92 E0 before any of the extrusion commands, the amount of filament that the 3D printer extrudes as the first extrusion command runs would be all wrong, and depending on how severely mispositioned the E-axis was, it can even become a very long retraction, effectively causing the print to fail from the start.

When To Use the G92 (E0) G-Code Command in Marlin Firmware?

While G92 isn’t a G-code command that you will need to use regularly, with better ways of correcting the X, Y, and Z positions (such as using offsets and travel limits), and the slicer handling the resetting of the extruder automatically, it’s one that can come in handy in situations where you need to correct the positions of any of the axes quickly and temporarily.

In the case of the X and Y axes, you can make use of G92 as a temporary solution for correcting the X and Y positions when the printhead isn’t correctly located right on top of the front-left corner of the print bed at X0 Y0 by moving the printhead to the correct spot first and using the G92 X0 Y0 command.

On the other hand, for the Z-axis, you can utilize the G92 G-code command as a temporary Z-offset value, which would require you to find the correct Z0 position with the paper method first and use the G92 Z0 command to set that position as the new Z0.

Finally, when it comes to the E-axis (extruder), such as in the case of G92 E0, you most likely will never have to use this command, as there isn’t a whole lot of a point to set the E-axis to anything other than 0, and setting it to 0 is something slicer software do automatically anyway.

That being said, in the rare scenario where you’re manually extruding filament for testing purposes, such as when you’re adjusting E-steps, running the G92 E0 command can come in handy to avoid keeping track of the E-axis position between extrusions, mostly for the purposes of convenience.

How to Use G92 (E0) G-Code Command in Marlin Firmware?

There isn’t much that goes into using the G92 G-code command, as the only info it requires are the X, Y, Z, and E-axis values that you would like to set the current positions.

When it comes to the X, Y, and Z axes, the first step you will need to take to use the G92 command is to move the axes to the position that you plan on overriding with the new values.

Once the axes are at the correct positions, you will then need to run G92, along with the parameters of the axes you want to override (X for the X-axis, Y for the Y-axis, Z for the Z-axis, E for the extruder), and their values, which will conclude the process.

As a quick example, if you want the X30 Y20 Z10 position to be X0 Y0 Z0 from now on, you will need to move the axes accordingly first with G0 X30 Y20 Z10, and then run the G92 X0 Y0 Z0 command to replace the current position with 0,0,0 instead.

On the other hand, while you won’t need any other command than G92 E0 when it comes to the E-axis, which resets the extruder position to 0 as we have discussed, the usage of this command with other values won’t be too different than the X, Y, and Z axes if the need (we can’t think of any) arises.


While the G92 E0 G-code command plays the critical role of initializing the extruder position before starting a print, you will most likely never need to input this command manually, as it will already be a part of the G-code file that your slicer has produced.

On the other hand, the G92 G-code command itself, when combined with the X, Y, and Z parameters, can definitely be handy in cases where you need to fix the X-axis, Y-axis, or Z-axis positioning of your 3D printer in a pinch, making it one that we can recommend adding to your toolkit.