If you own a maker 3D printer, there's a good chance you've hit a point where the slicer software alone isn't enough. Maybe you want to manually adjust the nozzle temperature mid-print, change the fan speed, or troubleshoot a failed first layer. That's when a g-code reference sheet becomes one of the most useful things you can keep next to your printer. G-code is the raw language your 3D printer actually reads and knowing the basic commands gives you real control over your machine.

What exactly is g-code, and how does it control my 3D printer?

G-code is a set of text-based instructions that tell your 3D printer what to do step by step. Each line is a command move the nozzle to this position, heat the bed to this temperature, extrude this much filament. Your slicer software (like Cura, PrusaSlicer, or Simplify3D) generates these commands automatically from your 3D model file, but the printer's firmware interprets and executes each one directly.

Think of it like sheet music for your printer. The slicer writes the music, and the printer plays it. When you understand the commands on your g-code commands for 3D printers, you can edit the "music" yourself to fix problems, fine-tune settings, or do things the slicer interface doesn't offer.

Which g-code commands do I actually need to know for day-to-day printing?

You don't need to memorize hundreds of commands. A handful handle most real-world situations on maker 3D printers. Here are the ones worth keeping on a quick-reference sheet:

Movement commands

  • G0 Rapid move (moves the head without extruding, used for travel)
  • G1 Linear move with extrusion (the workhorse command for actual printing)
  • G28 Home all axes (sends the print head to its starting position)
  • G29 Auto bed leveling (runs the probing sequence if your printer supports it)

Temperature commands

  • M104 S[value] Set hotend temperature (non-blocking, printer continues other tasks)
  • M109 S[value] Set hotend temperature and wait until it's reached
  • M140 S[value] Set bed temperature (non-blocking)
  • M190 S[value] Set bed temperature and wait

Fan and extrusion commands

  • M106 S[value] Set cooling fan speed (0–255, where 255 is full speed)
  • M107 Turn off cooling fan
  • G92 E0 Reset extruder position to zero (useful before purge lines)

Printer status and safety

  • M84 Disable stepper motors (lets you move the axes freely by hand)
  • M112 Emergency stop (kills everything immediately)
  • M115 Report firmware version (handy for troubleshooting compatibility)

If you're running Marlin firmware on an Ender 3 or similar machine, you'll find a more complete list in this Marlin g-code list for the Ender 3.

When would I manually send g-code instead of using my slicer?

Most of the time, the slicer handles everything. But there are specific moments when typing commands directly saves you time or solves a problem:

  • Calibrating e-steps or flow rate. You send a command to extrude 100mm of filament, then measure how much actually went through.
  • Testing a single axis. If your X-axis is making a grinding noise, you can manually jog it with G1 commands to isolate the issue.
  • Adjusting the Z-offset live. Baby-stepping during a first layer is often done through terminal commands like M851 Z[value].
  • Fixing a print in progress. Paused mid-print? You can sometimes rescue it by sending temperature or movement commands through your printer's terminal.
  • Running a PID tune. The command M303 E0 S200 C8 starts an auto-tune cycle for the hotend to get stable temperature readings.

You typically send these commands through the terminal in your printer's interface (OctoPrint, Pronterface, or the LCD menu on some printers).

What's the difference between G-commands and M-commands?

This trips up a lot of beginners. The distinction is simpler than it sounds:

  • G-commands (G0, G1, G28, etc.) control geometry movement, positioning, and coordinates. They tell the printer where to go.
  • M-commands (M104, M106, M84, etc.) control machine functions temperature, fans, motors, and other hardware settings. They tell the printer how to behave.

Both types appear in every g-code file your slicer produces. They work together, line by line, to produce a finished print.

Where can I find or download a printable g-code reference sheet?

Several sources offer downloadable PDFs or printable cheat sheets for common 3D printer g-code commands. Here are your best options:

  • Your firmware's official documentation. Marlin, Klipper, and RepRap firmware all maintain detailed command references online.
  • Community-created cheat sheets. Forums like the r/3Dprinting subreddit and RepRap wiki host user-made quick references tailored to specific printers.
  • Printer manufacturer websites. Some makers like Creality and Prusa publish simplified command lists for their machines.

You can also build your own. Once you know the commands you use most, a simple one-page table taped to the wall next to your printer is honestly the fastest reference you can have. If you're looking for a broader starting point, check out the full g-code reference sheet on this site.

What common mistakes do people make with 3D printer g-code?

G-code is forgiving in some ways, but a few errors come up repeatedly in maker communities:

  • Not homing before moving. Sending G1 X100 Y100 Z10 without G28 first can crash the nozzle into the bed because the printer doesn't know where it is.
  • Setting temperature but not waiting for it. Using M104 instead of M109 means the printer starts printing before the hotend reaches target temperature, causing under-extrusion or adhesion failure.
  • Mixing up millimeters and coordinates. G1 Z0.3 means "move Z to 0.3mm." If you meant "move Z down by 0.3mm from current position," you'd need to check whether relative or absolute positioning is active (G91 for relative, G90 for absolute).
  • Forgetting to reset the extruder. If you don't use G92 E0 before a new print or purge line, the extruder position might be wildly off, causing it to skip or grind.
  • Editing g-code in a word processor. Always use a plain text editor (Notepad++, VS Code, or similar). Rich text editors can insert hidden characters that break the file.

Do different printer brands use different g-code?

The core g-code standard (based on the original CNC machining language) is shared across nearly all FDM 3D printers. G1, G28, M104 these work the same on a Creality Ender 3, a Prusa MK4, or a Bambu Lab machine.

Where things differ is in firmware-specific extensions. Marlin, Klipper, and RepRapFirmware each add their own custom commands for advanced features like input shaping, pressure advance, or filament change macros. For example, Klipper uses a different syntax for some calibration routines than Marlin does.

The safest approach: start with the standard commands that work everywhere, then look up firmware-specific extensions when you need them. Most printers ship with Marlin-based firmware, so that's the most common starting point for makers.

Can I create custom g-code scripts for repeated tasks?

Yes, and this is where g-code knowledge really pays off. You can write small text files containing command sequences and save them as .gcode files to run on your printer. Common use cases include:

  • Purge scripts. A short sequence that heats the nozzle, extrudes a line of filament to prime it, and wipes the nozzle before your print starts.
  • Bed leveling routines. A script that heats the bed, homes, and runs G29 useful to execute before a print session.
  • Filament change helpers. Retract the filament, move the head out of the way, and beep to alert you all triggered by M600 or a custom script.
  • Shutdown sequences. After a print finishes, disable heaters, turn off the fan, and disable motors so the printer goes idle cleanly.

If you work on design projects that involve custom text or lettering for engravings and embossing on 3D prints, having the right typeface matters. Fonts like Oswald translate well into clean, readable 3D-printed text.

Quick-Start Checklist: Your First Steps With G-Code

  1. Open a text editor (Notepad++, VS Code, or Sublime Text) not a word processor.
  2. Connect to your printer using OctoPrint, Pronterface, or your printer's built-in terminal.
  3. Start with G28 always home the printer before sending any movement commands.
  4. Test a simple move type G1 X50 Y50 Z10 F3000 and watch the head move.
  5. Try setting temperature type M104 S200 and verify the hotend starts heating.
  6. Bookmark one reference sheet keep the commands you use most in a place you can reach fast.
  7. Never edit g-code files with anything other than a plain text editor hidden formatting will break your print.

Tip: Print a small test cube with your slicer, open the generated .gcode file in a text editor, and read through it line by line. You'll be surprised how much of it you already understand after learning just the commands listed above. That one exercise teaches you more about how 3D printing actually works than hours of watching tutorials.