If you own a Creality Ender 3 and want more control over your printer, understanding Marlin G-code is one of the most useful skills you can build. G-code is the language your 3D printer speaks every movement, every temperature change, every fan speed adjustment is controlled by these short text commands. Whether you're troubleshooting a failed print, dialing in first-layer adhesion, or automating repetitive tasks, knowing the right G-code commands saves you time and filament. The Ender 3 runs on Marlin firmware (or a Marlin-based variant), which means its command set follows a well-documented standard. This article gives you a practical, working G-code reference specifically tailored to what your Ender 3 actually supports and responds to.

What Is Marlin G-Code and How Does It Work on the Ender 3?

G-code is a plain-text instruction set that tells your printer where to move, how fast to go, what temperature to heat to, and when to extrude filament. Each line is a single command for example, G28 tells the printer to home all axes, and M104 S200 sets the hotend temperature to 200°C.

The Ender 3 ships with firmware based on Marlin, which is the most common open-source 3D printer firmware. Some newer models run Creality's own firmware, but it still responds to the same core Marlin G-code commands. If you've ever opened a .gcode file generated by a slicer like Cura or PrusaSlicer, you've already seen these commands in action. If you want to understand how to read those files line by line, our guide on how to read G-code on a 3D printer breaks that process down.

Why Would You Manually Send G-Code to an Ender 3?

Most of the time, your slicer generates G-code for you. But there are several situations where sending commands directly through a terminal using software like Pronterface, OctoPrint, or the built-in serial monitor becomes really useful:

  • Diagnosing hardware issues. You can test individual motors, heaters, and endstops without running a full print.
  • Calibrating steps per millimeter. Commands like M92 let you adjust how far each motor step actually moves an axis.
  • Changing settings on the fly. Adjust feed rate, flow rate, or temperature mid-print without re-slicing.
  • Saving settings permanently. The M500 command writes changes to EEPROM so they survive a power cycle.
  • Running bed leveling routines. Manual mesh bed leveling uses a sequence of G-code moves.

Think of it like learning keyboard shortcuts instead of always clicking through menus it gives you faster, more precise control.

What Are the Most Common Marlin G-Code Commands for the Ender 3?

G-codes (as opposed to M-codes) primarily control movement and positioning. Here are the ones you'll actually use on an Ender 3:

Movement Commands

  • G0 X{pos} Y{pos} Z{pos} F{speed} Rapid move. Moves the toolhead as fast as possible to the specified coordinates. Used for travel moves (no extrusion).
  • G1 X{pos} Y{pos} Z{pos} E{length} F{speed} Linear move with extrusion. This is the workhorse command every printed line is a series of G1 moves. The E value controls how much filament is pushed through.
  • G28 Home all axes. Sends the print head to the endstops (X=0, Y=0, Z=0). You can also home individual axes: G28 X, G28 Y, or G28 Z.
  • G29 Auto bed leveling probe sequence. Only works if you have a BLTouch or similar probe installed and enabled in firmware.
  • G90 Set positioning to absolute. All coordinates are then measured from the origin point (0,0,0).
  • G91 Set positioning to relative. Moves are measured from the current position, not the origin.
  • G92 E0 Reset the extruder position to zero. Used at the start of prints or during retraction tuning to prevent the E value from growing too large.

Arc and Advanced Movement

  • G2 / G3 Clockwise and counterclockwise arc moves. Not commonly used unless you enable the ARC_SUPPORT feature in Marlin. Some prints sliced with arc-welding plugins use these.

What M-Code Commands Does the Ender 3 Support?

M-codes handle machine control temperatures, fans, configuration, and printer state. These are just as important as the movement commands.

Temperature Commands

  • M104 S{temp} Set hotend temperature (non-blocking). The printer starts heating but continues executing the next commands immediately.
  • M109 S{temp} Set hotend temperature and wait. The printer pauses until the target temperature is reached before moving on.
  • M140 S{temp} Set bed temperature (non-blocking). Same idea as M104 but for the heated bed.
  • M190 S{temp} Set bed temperature and wait. Blocks until the bed reaches the target.
  • M106 S{value} Set part cooling fan speed. S0 is off, S255 is full speed.
  • M107 Turn off the part cooling fan.

Extruder and Filament Commands

  • M82 Set extruder to absolute mode. The E distance is cumulative from zero.
  • M83 Set extruder to relative mode. Each E value is a delta from the current position.
  • M302 S{temp} Allow cold extrusion. Lets you extrude below the minimum temperature threshold (useful for testing, dangerous for prints). Use M302 S0 to set the minimum to 0°C.

Homing, Stepper, and Endstop Commands

  • M17 Enable all stepper motors. Locks the motors in position.
  • M18 / M84 Disable stepper motors. Lets you move the axes freely by hand.
  • M119 Report endstop states. Shows whether each endstop is triggered or open essential for diagnosing homing failures.
  • M211 S0 / M211 S1 Disable or enable software endstops. When disabled, you can move the nozzle below Z=0. Useful during Z-offset calibration.

EEPROM and Configuration Commands

  • M500 Save current settings to EEPROM. Changes persist after power-off.
  • M501 Load saved settings from EEPROM.
  • M502 Restore factory defaults from firmware. Does not erase EEPROM use M500 after M502 to overwrite saved values.
  • M503 Report current settings. Prints all active parameters (steps/mm, acceleration, PID values, etc.) to the terminal.
  • M92 X{val} Y{val} Z{val} E{val} Set steps per millimeter for each axis. After measuring actual vs. intended movement, you adjust these values and save with M500.

PID Tuning Commands

  • M303 E0 S{temp} C{cycles} Run PID auto-tune for the hotend. For example, M303 E0 S200 C8 runs 8 tuning cycles at 200°C. After it finishes, the terminal reports Kp, Ki, and Kd values.
  • M304 P{val} I{val} D{val} Set PID values for the bed (if your firmware supports it).
  • M301 P{val} I{val} D{val} Manually set hotend PID values. Use the values from M303 output, then save with M500.

Feed Rate and Flow Control

  • M220 S{percent} Set feed rate percentage. M220 S120 speeds up printing by 20%. M220 S80 slows it down. Useful for adjusting speed mid-print.
  • M221 S{percent} Set flow rate (extrusion multiplier). M221 S95 reduces extrusion by 5%, which can help with over-extrusion issues.

SD Card Commands

  • M20 List files on the SD card.
  • M23 {filename} Select a file for printing.
  • M24 Start or resume the selected print.
  • M25 Pause the current print.
  • M26 S{byte position} Set the SD card read position.
  • M27 Report SD card print progress.
  • M524 Abort the running SD print.

Informational and Diagnostic Commands

  • M105 Report current hotend and bed temperatures. This is sent automatically by most host software, but you can trigger it manually.
  • M115 Report firmware version and capabilities. Useful for confirming your Ender 3 is running Marlin and which version.
  • M114 Report current position of all axes.
  • M200 D{diameter} Set filament diameter for volumetric extrusion. M200 D0 disables volumetric mode (the default for most Ender 3 setups).
  • M203 X{val} Y{val} Z{val} E{val} Set maximum feed rates (mm/s) for each axis.
  • M204 P{val} T{val} Set default printing (P) and travel (T) acceleration.
  • M205 Advanced settings: junction deviation, minimum feedrate, etc. On Ender 3, you'll commonly see M205 J0.012 for junction deviation tuning.

For a printable quick-reference you can keep near your printer, check out our G-code reference sheet for 3D printers.

What G-Code Commands Should You Be Careful With?

Not all commands are harmless. A few can cause problems if used incorrectly:

  • Disabling software endstops (M211 S0) lets you crash the nozzle into the bed. Only do this intentionally during calibration, and re-enable them immediately after.
  • Cold extrusion (M302) can jam or damage your hotend if you push filament through without proper heat.
  • Changing max feed rates (M203) or acceleration (M204) aggressively can cause layer shifts, missed steps, or binding on the Ender 3's stock lead screws and belts.
  • M502 without M500 resets firmware defaults in RAM but doesn't erase the EEPROM. If you want a true factory reset, run M502 followed by M500.

Mistakes in G-code syntax can also lead to unexpected behavior. Our article on common G-code syntax errors in 3D printing covers the most frequent formatting problems that cause print failures.

What Settings Does the Ender 3 Store in EEPROM?

When you send M503, the printer dumps all its active settings. On a stock Ender 3, you'll typically see:

  • Steps per unit (M92): Usually X80 Y80 Z400 E93 by default.
  • Max feedrates (M203): X500 Y500 Z5 E25.
  • Max acceleration (M204): P500 T1000.
  • Acceleration settings (M205): Junction deviation, min feedrates, etc.
  • Home offset (M206): Typically all zeros unless manually adjusted.
  • PID values (M301): The default heating algorithm parameters.

Every one of these can be changed, tested, and saved. That's what makes learning G-code so valuable you're not locked into factory defaults.

Quick Tips for Sending G-Code to Your Ender 3

  • Use a terminal tool. Pronterface (Printrun), OctoPrint's terminal, or even the Arduino serial monitor all work. Connect via USB and select the right baud rate (usually 115200 for stock Ender 3).
  • One command per line. Don't paste a full G-code file into a terminal expecting it to queue some hosts handle this, others don't.
  • Test with M105 first. It's a safe command that confirms communication. If you get a temperature reading back, your connection works.
  • Use semicolons for comments. Anything after a ; on a line is ignored by the parser. You can annotate your commands.
  • Save before power off. Any change you make in RAM is lost if you don't run M500.
  • Know your firmware version. Not all Marlin builds enable the same features. Run M115 to confirm what you're working with. A Code font can also help when documenting your custom G-code scripts for readability.

Your Ender 3 G-Code Quick-Start Checklist

  1. Connect via USB using Pronterface, OctoPrint, or another serial terminal at 115200 baud.
  2. Send M105 to verify the connection is working.
  3. Send M115 to confirm you're running Marlin firmware.
  4. Send M503 to dump your current configuration and note the defaults.
  5. Test one change at a time adjust a setting, verify the behavior, then save with M500.
  6. Keep a log of what you changed and when. It's easy to lose track of which settings are stock and which are custom.
  7. Bookmark this page so you have a quick reference when you need to look up a command mid-troubleshooting.

Start with safe, read-only commands like M105, M114, M115, and M503. Once you're comfortable reading the output, move on to calibration commands like M92 and M303. One small change at a time is always the right approach with the Ender 3.