G0 Quick Movement
example: G0 X11 rapid movement in X=11mm.

G1 Controlled movement X Y Z E
example: G1 X80 Y10 E10 moves from the current position (X0,Y0) to (80,10) and extrudes 10mm of material.

G2 Arc-controlled clockwise movement
example: G2 X80 Y10 I5 J10 E10 goes from the current position (X,Y) with hourly arc movement to the position (80,10) keeping a constant distance from the point (5 10) extruding the material from the current position until the arrival extruding 10 mm of material.

G3 Arc-controlled counterclockwise movement
example: same as the previous command but the arc movement is counterclockwise

G4 Pause for S or P
example: G4 P200 do nothing for 200 msec. Inserts a pause of the number of milliseconds indicated. During this time the machine maintains the parameters but remains stationary.

G10 Retracts the filament according to the specifications of the M207 command.

G11 Retracts and recovers the filament according to the specifications of the M208 command

G28 Returns to the point of origin of the axes

G29 Command for testing the print surface. Use a three-point test.

G30 Command for testing the printbed. Use only one test point

G31 Returns the current test status.

G32 Z head and calculates the position of the Z plane

G90 Use absolute coordinates

G91 Use relative coordinates

G92 Set coordinates
example: allows programming of absolute zero, to reset the current position to the specified values. No physical movement will occur. Without any specification, the command will reset all axes to zero.

M Basic GCode

M0 Stop.
Example: M0 – The machine stops and returns to its rest position, then switches off. All motors and heaters turn off. To restart the printer, press Reset.

M1 Sleep.
Example: M1 – The machine stops and returns to its rest position, then switches off. All motors and heaters are switched off. The machine restarts by pressing any key.

M104 Sets the temperature of the selected extruder
Example: M104 S190 sets extruder temperature to 190°C

M105 Reads the current temperature from the sensor

M106 Fan on

M107 Fan off

M108 Sets the extrusion speed

M109 Sets the extrusion temperature and waits for the extruder to cool down.

M110 Sets the current G-code line

M114 Displays current position

M115 Displays current firmware version

M Advanced GCode

M17 Turns all stepper motors on or off

M18 Turns off stepper motors such as the M84 control

M20 Shows the contents of the SD card

M21 Initializes the SD card

M22 Removes the SD card from the memory card.

M23 Select a file from SD

M24 Starts or resumes printing an SD file.

M25 Pause of printing from SD

M26 Sets the position of the SD in bytes

M27 Returns the print status of the SD file

M28 Start writing to SD

M29 Ends writing to SD

M30 Deletes a file from the SD card

M41 Loop printing

M42 Change pin status via gcode

M80 Turns on the power supply

M81 Turns off the power supply

M82 Selects absolute codes of extruder E (default)

M83 Selects the relative codes of the E-Etrusor

M84 Disable stepper motors until the next movement, or use S to specify a waiting time before motors are disabled. S0 is used to disable the wait time.

M85 Sets the shutdown timer using the S parameter. To disable it set to zero (default)

M92 Sets the programming of the steps for the axes (To be used for calibration)

M114 Sends the current position to the serial port

M115 Communicates the current version of the firmware and the capacity of the microcontroller used

M117 Displays a message
Example: M117 “Printer Name”: Displays the printer name on the LCD.

M119 Notifies the serial port that an endstop status is present.

M140 Sets the temperature of the printing surface

M190 Waits until the temperature of the printing surface reaches the set temperature

M200 Sets the diameter of the filament

M201 Sets maximum print acceleration in units/second square for movements during printing (M201 X1000 Y1000)

M202 Sets the maximum acceleration in unit/square second for non-print movements (M202 X1000 Y1000). This command is not used in Marlin firmware.

M203 Sets the maximum extrusion speed of the machine (M203 X200 Y200 Z300 E10000) in mm/sec.

M204 Sets the default speed: S for normal movements; T only for material dispenser movements (M204 S3000 T7000) in “mm/sec square” in mini time segments, expressed in ms (B20000)

M205 Advanced settings: minimum movement speed S=during printing T=only movements, B=minimum time segment X=maximum tear xy, Z=maximum tear Z , E=maximum tear E

M206 Sets an additional rest point

M207 Sets the retraction length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]

M208 Sets the maximum movement for the axes

M209 Enables automatic retraction

M220 Sets the value of the speed override factor in percent

M221 Sets the value of the extrusion override factor in percent

M240 Trigger pulse for taking a picture

M300 S(xxxx) P(xxxx). The M300 basically tells the printer: “sing!”. The S is the height of the sound and the P is the duration in milliseconds.

M301 Sets the parameters PID, P I and D

M302 Enables cold extrusion

M303 PID relay autotune S sets the temperature (default = 150C)

M400 Finishes all movements

M500 Stores parameters in the EEPROM

M501 Reads parameters from EEPROM

M502 Returns to factory settings. Of course these must have been stored in the EEPROM previously.

M503 Prints current settings (from memory and not from eeprom)

M999 Restart after an error

These are the main commands that we will use on our printers.
If I’ve forgotten some and/or if you have some gcode start or end to recommend add it in the comments!


If you have found this post useful, please LIKE on Easy 3D Home Facebook’s page to receive updates on all the news of the Blog! You can find other guides about 3D in our Guides section!