What Are the M600, M701, M702, M703 G-Codes? (In-Depth)

In the earlier articles, we have covered plenty of temperature-related G-codes, but as you can imagine, their functionality doesn’t end there. Considering that there is a G-code for every single action a printer can perform, we have only scratched the surface so far.

We will be continuing our G-code series with a few filament-related ones, which we believe will come in quite handy if you find yourself often changing the filament of your 3D printer mid-print.

So, what are the M600, M701, M702, and M703 G-Codes?

  • M600 (Filament Change) – Prepares the printer for filament change.
  • M701 (Load Filament) – Loads the filament into the extruder.
  • M702 (Unload Filament) – Unloads the filament from the extruder.
  • M703 (Configure Filament Change) – Configures the parameters for auto filament change.

As each of these G-codes comes with different syntaxes and parameters, we will be taking a deep dive into each of them separately in the upcoming sections with examples and detailed explanations.

M600 G-Code (Filament Change)

The M600 command is the primary way of changing a filament.

Executing the M600 G-code initiates the filament change process by moving the printhead away and ejecting the filament.

Afterward, the printer waits for you to insert the new filament, and it loads and primes the filament after you insert it.

While there are many parameters you can use with M600 in Marlin, running it without any is enough to initiate a standard filament change, just as the example below:

M600

Next up, we will be diving into the parameters you can use with M600, which allow you to customize the filament changing process.

Positions (X / Y / Z)

The X, Y,and Z flags allow you to set the position for the printhead.

When you pass the X, Y, and Z flags alongside the locations of your choice, the nozzle printhead will move to the position you have specified before unloading the filament.

Here is an example:

M600 X50 Y30 Z10

In this case, the X position is 50, the Y position is 30, and the Z position is 10.

As a result of running this command, the printhead will position itself to the X50, Y30, Z10 coordinate and initiate the filament changing process in that position.

Retract Before Moving (E)

The E flag allows you to specify the retraction distance.

Passing this flag alongside the retraction distance (in millimeters) will cause the printer to retract the filament by this distance before moving into position.

An example would be:

M600 E2

In this example, the retraction distance (E) is 2 millimeters.

Running this command will cause the printer to retract the filament by 2 millimeters before moving into its position for unloading the filament.

Load Length (L)

The L flag is for specifying the load length of the new filament.

Passing this flag alongside the load length (millimeters) allows the printer to push the filament from the extruder to the nozzle at this specific distance.

For instance:

M600 L13

In this example, the load length (L) is 13 millimeters.

When you run this command, the printer will push the new filament 13 millimeters into the nozzle after it’s loaded.

As a rule of thumb, for direct-drive systems, this value should be equal to the length of the nozzle.

On the other hand, for Bowden systems, the suitable value is the combined length of the tube and the nozzle.

Finally, we will be going over the extra parameters the Marlin firmware adds to the M600 G-code.

Unload Length (U)

The U flag specifies the unload length of the filament that is being replaced.

Passing this flag alongside the unload length (in millimeters) causes the printer to pull the filament from the nozzle back to the extruder by the specified distance.

Let’s look at an example:

M600 U13

In this example, the unload length (U) is 13 millimeters.

Upon running this command, the printer will pull the filament 13 millimeters back from the nozzle.

As a rule of thumb, for direct-drive systems, this value should be equal to the length of the nozzle.

On the other hand, for Bowden systems, the suitable value is the combined length of the tube and the nozzle.

Resume Temperature (R)

The R flag allows you to set the resume temperature.

Using this flag alongside a temperature value causes the printer to set the temperature to this value before the new filament is loaded, essentially preparing it.

Here is an example:

M600 R90

In this example, the resume temperature (R) is 90 degrees.

Running this command will cause the printer to set the hotend to 90 degrees after unloading the old filament and load the new one when the target temperature is reached.

Beeps (B)

The B flag allows you to set the number of beeps.

Using this flag alongside the desired number of beeps causes the printer to sound X number of beeps to alert you about the filament change.

Here is an example:

M600 B5

In this example, the number of beeps (B) is 5.

Running this command will cause the printer to beep five times to let you know about the filament change.

M701 G-Code (Load Filament)

The M701 G-code initiates a filament load.

Running this command loads the filament into the hotend, making it ready for printing.

As this command doesn’t require any parameters, the following input is sufficient:

M701

In Marlin firmware, you can also pass the L (Load length) flag and the Z (Move Z-axis) flag if you wish.

M702 G-Code (Unload Filament)

The M702 G-code initiates a filament unload.

Running this command retracts the filament from the hotend and prepares it for removal.

As this G-code has no mandatory parameters, inputting the code below is sufficient:

M702

In Marlin firmware, you can also pass the U (Unload length) flag andthe Z (Move Z-axis) flag if you wish.

M703 G-Code (Configure Filament Change)

The M703 G-code allows you to apply the configuration for the loaded filament.

In essence, running this code executes the config file of the filament, which often contains parameters such as temperatures and retraction distances.

As this G-code doesn’t require any parameters, all you have to input is:

M703

In Marlin firmware, you can also pass the L (Load length) and U (Unload length) parameters.

Also, In Marlin firmware, the G-code for this function is M603 instead.

Wrapping Up

Changing the filament mid-print is gaining a decent amount of popularity lately, as many enthusiasts want to go for multi-colored prints that look way more aesthetically pleasing.

The M600, M701, M702, and M703 G-codes are highly useful in such a scenario as they allow you to control the unloading and the loading of the filament directly.

While it’s also possible to configure a filament change through slicer software, we believe that the simple approach of using G-codes is more than enough in most cases.

As always, we will be adding more in-depth explanations for vital G-codes moving forward, so make sure to stay tuned!