{"id":164934,"date":"2022-06-24T11:29:59","date_gmt":"2022-06-24T03:29:59","guid":{"rendered":"https:\/\/facfox.com\/docs\/?post_type=kb&#038;p=164934"},"modified":"2022-12-09T11:28:21","modified_gmt":"2022-12-09T03:28:21","slug":"3d-printer-g-code-commands-full-list-tutorial","status":"publish","type":"kb","link":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial","title":{"rendered":"3D Printer G-code Commands: Full List &#038; Tutorial"},"content":{"rendered":"<div class=\"container container--l container--space\">\n<div class=\"section\">\n<p class=\"paragraph paragraph--emphasized\">Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!<\/p>\n<\/div>\n<\/div>\n<div class=\"toc-layout__toc\">\n<p>Simply put, G-code is a programming language for\u00a0<a href=\"https:\/\/all3dp.com\/2\/what-is-cnc-simply-explained\/\" target=\"_blank\" rel=\"noopener\">computer numerical control (CNC)<\/a>. In other words, it\u2019s the language spoken by a computer controlling a machine, and it communicates all commands required for movement and other actions.<\/p>\n<p>While G-code is the standard language for different desktop and industrial machinery, we might be most familiar with it through our 3D printers. You may not have dealt with it so far, and that\u2019s actually normal since\u00a0<a href=\"https:\/\/all3dp.com\/2\/what-is-a-3d-slicer-simply-explained\/\" target=\"_blank\" rel=\"noopener\">3D slicers<\/a>\u00a0generate the code \u201cautomagically\u201d.<\/p>\n<p>Yet, if you want to develop a deeper understanding of 3D printing, it\u2019s essential to learn the basics of G-code. This knowledge will allow you to troubleshoot and control print processes much better, while also enabling the customization of\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printer-firmware-which-to-choose-and-how-to-change-it\/\">3D printer firmware<\/a>\u00a0like\u00a0<a href=\"https:\/\/reprap.org\/wiki\/RepRap_Firmware\" target=\"_blank\" rel=\"noopener noreferrer\">RepRap<\/a>\u00a0and\u00a0<a href=\"https:\/\/all3dp.com\/topic\/marlin\/\" target=\"_blank\" rel=\"noopener\">Marlin<\/a>.<\/p>\n<p>In this article, we\u2019ll cover the basics of G-code, including how to read, understand, and write a few lines of commands, providing a solid background for even absolute beginners in coding. Without further ado, then, let\u2019s start from the beginning!<\/p>\n<\/div>\n<div>\n<h3 class=\"headline headline--xxl\">What Is It?<\/h3>\n<\/div>\n<div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png\" alt=\"\" width=\"1000\" height=\"556\" \/><figcaption class=\"wp-caption-text\">G-code commands are used to instruct a machine to perform specific actions (Source: All3DP)<\/figcaption><\/figure>\n<\/div>\n<div>\n<p>For those strangers to programming in general, think of G-code as sequential lines of instructions, each telling the 3D printer to perform a specific task. These lines are known as commands, and the printer executes them one by one until reaching the end of the code.<\/p>\n<p>While the term \u201cG-code\u201d is used to reference the programming language as a whole, it\u2019s also one of two types of commands used in 3D printing: \u201cgeneral\u201d and \u201cmiscellaneous\u201d commands.<\/p>\n<p>General command lines are responsible for types of motion in a 3D printer. Such commands are identified by the letter \u2018G\u2019, as in G-commands. Besides controlling the three plus axes movement performed by the printhead, they\u2019re also in charge of filament extrusion.<\/p>\n<p>The miscellaneous commands, on the other hand, instruct the machine to perform non-geometric tasks. In 3D printing, such tasks include heating commands for the nozzle and bed and also fan control, among many others, as we\u2019ll see. Miscellaneous commands are identified with the letter \u2018M\u2019.<\/p>\n<div class=\"rich-text__embed\">\n<div class=\"article-link__content\">\n<div class=\"article-link__image\">\n<div class=\"image image--rounded image--loaded\">\n<h3><strong>The Syntax<\/strong><\/h3>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8b67a47f9c8e10a7.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption class=\"wp-caption-text\">Command lines consist of identification and parameters (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<div>\n<p>Every G-code command line follows a certain syntax. Each line corresponds to only one command, which can lead to codes that are awfully lengthy.<\/p>\n<p>The first argument of any given line is the command code itself. As we have seen, it can be either a \u2018G\u2019 or an \u2018M\u2019 code type, followed by a number that identifies the command. For instance, \u201cG0\u201d corresponds to a linear move command.<\/p>\n<p>Next comes the parameters that more accurately define the command. For a G0 linear move, these parameters include the final position and how fast it moves, also identified by upper-case letters. Each command has its own set of parameters as we\u2019ll see soon.<\/p>\n<h3>A Note on G-code Comments<\/h3>\n<p>Before we get started, when we go over the various commands, you\u2019ll see semicolons after a letter and number that explain what the code does. Here\u2019s an example of a line that has a code comment:<\/p>\n<p><code>G1 X25 Y5 ; I am a code comment!<\/code><\/p>\n<p>Programmers often need to include explanations in plain English so that other programmers can understand certain lines or sections of code. It might also happen that you forget why you coded things in a certain way, resulting in a difficult time figuring things out again.<\/p>\n<p>To solve this problem are code comments. Comments include anything (on the same line) following a semicolon and are completely ignored by the machine when it executes the G-code. In this way, they are purely meant for programmers\u2019 eyes.<\/p>\n<\/div>\n<div>\n<div class=\"section\">\n<h3 class=\"headline headline--listicle-section u-text-center\">IMPORTANT COMMANDS FOR 3D PRINTING<\/h3>\n<\/div>\n<div class=\"rich-text rich-text--full\">\n<p>As there are literally hundreds of G-code commands, we\u2019ll cover the most basic and important ones in the following sections. Once you get the hang of it, you\u2019ll be able to explore other commands from\u00a0<a href=\"https:\/\/marlinfw.org\/docs\/gcode\/G000-G001.html\" target=\"_blank\" rel=\"noopener noreferrer\">reference sheets<\/a>\u00a0on your own.<\/p>\n<\/div>\n<\/div>\n<div>\n<h3 class=\"headline headline--xxl\">G0 &amp; G1: Linear Motion<\/h3>\n<\/div>\n<div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/0b164d930f4d1e6a.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption class=\"wp-caption-text\">G0 and G1 commands are responsible for linear motion and extrusion (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<div>\n<p>The G0 and G1 commands both perform linear movements. By convention, G0 is used for non-extrusion movements like initial and travel moves, while G1 encompasses all the extruding linear motion.<\/p>\n<p>Both commands function the same, though. The parameters for G0 or G1 include the final positions for\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printer-axis-the-basics-simply-explained\/\" target=\"_blank\" rel=\"noopener\">all the X-, Y-, and Z-axes<\/a>, the amount of extrusion to be performed during the move, and the speed, specified by the feed rate in the set units.<\/p>\n<h3><strong>Example<\/strong><\/h3>\n<p><code>G1 X90 Y50 Z0.5 F3000 E1<\/code>\u00a0tells the printer to move in a straight line (G1) towards the final coordinates X = 90 mm, Y = 50 mm, Z = 0.5 mm at a feed rate (F) of 3,000 mm\/min while extruding (E) 1 mm of material in the extruder.<\/p>\n<p>Most linear moves are performed within a single layer, meaning that the Z coordinate is usually omitted from the command line.<\/p>\n<\/div>\n<div>\n<div class=\"listicle-header__wrapper\">\n<div class=\"listicle-header__content\">\n<h3 class=\"headline headline--xl\">G90 &amp; G91: Absolute &amp; Relative Positioning<\/h3>\n<\/div>\n<\/div>\n<div class=\"listicle-header__image\">\n<div class=\"image image--center image--rounded image--loaded\">\n<figure id=\"attachment_164936\" aria-describedby=\"caption-attachment-164936\" style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-164936 size-full\" src=\"https:\/\/facfox.com\/docs\/wp-content\/uploads\/2022\/06\/Pasted-2.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption id=\"caption-attachment-164936\" class=\"wp-caption-text\">Relative positioning is defined by the previous coordinates, while absolute isn&#8217;t (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<p>The G90 and G91 commands tell the machine how to interpret coordinates used for movement. G90 establishes \u201cabsolute positioning\u201d, which is usually the default, while G91 is for \u201crelative positioning\u201d.<\/p>\n<p>Neither command requires any parameters, and setting one automatically cancels the other. The way positioning works is quite simple, so let\u2019s jump right in.<\/p>\n<h3><strong>Example<\/strong><\/h3>\n<p>Let\u2019s say we want to move the printhead to X=30 in a line. In absolute positioning mode, that would look like this:<\/p>\n<p><code>G90 ; sets absolute positioning<\/code>\u00a0<code>G0 X30 ; moves to the X = 30 coordinate<\/code><\/p>\n<p>This simple move would tell the printer to move the printhead so that it\u2019s positioned at X = 30. Now, for a relative positioning move, we need to know where the printhead is currently. Let\u2019s assume it\u2019s at X = 10:<\/p>\n<p><code>G91 ; sets relative positioning<\/code>\u00a0<code>G0 X20 ; moves +20 mm along the X-axis<\/code><\/p>\n<p>G91 first tells the machine to interpret the coordinates as relative to the current position (X = 10). Knowing that, the machine simply needs to move 20 mm in the X-axis positive direction, thus reaching X = 30, as we\u2019d like.<\/p>\n<\/div>\n<div>\n<h3 class=\"headline headline--xl\">G28 &amp; G29: Auto Home &amp; Bed Leveling<\/h3>\n<\/div>\n<div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/2885dc74caaeae5d.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption class=\"wp-caption-text\">G28 and G29 are useful for the initialization phase (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<div>\n<p>We call \u201choming\u201d the process of setting the physical limits of all movement axes. The G28 command will perform this task by moving the printhead until it triggers\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printer-endstop-switch-optical-endstop\/\">end-stops<\/a>\u00a0to acknowledge the limits.<\/p>\n<p>Homing is important not only for the machine to orient itself but also to prevent the printhead from moving outside the boundaries. The G28 command is usually performed before every print process.<\/p>\n<p>Another command, G29, starts the\u00a0<a href=\"https:\/\/all3dp.com\/2\/auto-leveling-3d-printer-do-i-really-need-it\/\" target=\"_blank\" rel=\"noopener\">automatic bed leveling<\/a>\u00a0sequence. There are many different\u00a0<a href=\"https:\/\/all3dp.com\/2\/mesh-bed-leveling-all-you-need-to-know\/\" target=\"_blank\" rel=\"noopener\">methods for leveling a bed<\/a>\u00a0prior to printing, as this is usually set by\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printer-firmware-which-to-choose-and-how-to-change-it\/\" target=\"_blank\" rel=\"noopener\">firmware<\/a>\u00a0and not by the final users.\u00a0For this reason, we won\u2019t get into details surrounding the methods and command parameters. Just know that G29 is usually sent after an auto-home (G28) and should perform the automatic bed leveling as\u00a0<a href=\"https:\/\/all3dp.com\/2\/how-to-set-up-marlin-for-auto-bed-leveling\/\" target=\"_blank\" rel=\"noopener\">determined by the firmware<\/a>.<\/p>\n<h3><strong>Example<\/strong><\/h3>\n<p><code>G28 X Y ; home the X and Y axes only<\/code><\/p>\n<p><code>G28 ; home all axes<\/code><\/p>\n<p>Specific axis can be individually homed by including X, Y, or Z as parameters. Otherwise, G28 alone will home all three.<\/p>\n<p><code>G29 ; perform automatic bed leveling sequence<\/code><\/p>\n<p>If you want to run an auto bed leveling sequence, remember to send G29 after performing the homing process.<\/p>\n<\/div>\n<div>\n<h3 class=\"headline headline--xl\">M104, M109, M140, &amp; M190: Set Temperature<\/h3>\n<\/div>\n<div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/1a9cbad29a0028b0.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption class=\"wp-caption-text\">These M-code commands are responsible for controlling hot end and bed temperature (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<div>\n<p>These are essential miscellaneous commands, which again, don\u2019t involve any motion.<\/p>\n<p>To start, the M104 command sets a target temperature for the hot end to reach and keep it until otherwise instructed.<\/p>\n<p>Some of the parameters include the actual temperature value (S) and which printhead (T) to heat (for multiple extrusion setups).<\/p>\n<h3>Example<\/h3>\n<p><code>M104 S210 ; set target temperature for hot end to 210 degrees<\/code><\/p>\n<p>This command line instructs the machine to heat up its hot end to 210 \u00b0C and assumes there is only one hot end in this extrusion setup. After setting the target temperature, the printer will go on to perform the next command line while heating the hot end.<\/p>\n<p>Alternatively, if we wanted to wait until that target is reached before moving on to the next line, we can use the M109 command.<\/p>\n<p><code>M109 S210 ; set target temperature for hot end to 210 degrees and do nothing until reached\u00a0\u00a0<\/code><\/p>\n<p>Setting the bed temperature is very similar to the hot end, but instead with the M140 and M190 commands:<\/p>\n<p><code>M140 S110 ;\u00a0set target temperature for bed to 110 degrees<\/code><br \/>\n<code>M190 S110 ; set target temperature for bed to 110 degrees and do nothing until reached<\/code><\/p>\n<\/div>\n<div>\n<h3 class=\"headline headline--xxl\">M106 &amp; M107: Fan Control<\/h3>\n<\/div>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8bce3676cf84aa87.png\" alt=\"\" width=\"1000\" height=\"277\" \/><figcaption class=\"wp-caption-text\">Both M106 and M107 commands control all the fans in your 3D printer (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<p>Yet another essential task for 3D printers, the miscellaneous M106 and M107 commands provide\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printer-fans-do-i-really-need-one\/\" target=\"_blank\" rel=\"noopener\">fan<\/a>\u00a0control.<\/p>\n<p>M106 turns a fan on and sets its speed. This is especially useful for the part cooling fan, as different speeds are required during the printing process during the\u00a0<a href=\"https:\/\/all3dp.com\/2\/3d-printing-first-layer-problems-how-to-make-it-perfect\/\" target=\"_blank\" rel=\"noopener\">first layer<\/a>\u00a0and\u00a0<a href=\"https:\/\/all3dp.com\/2\/bridging-3d-printing-tips-tricks-for-perfect-bridges\/\" target=\"_blank\" rel=\"noopener\">bridging<\/a>.<\/p>\n<p>The speed parameter must be a value between 0 and 255. A 255 value provides 100% power, and any number within this range will specify a percentage accordingly.<\/p>\n<h3>Example<\/h3>\n<p><code>M106 ; turn on a fan at maximum (100%) speed<\/code><br \/>\n<code>M106 S128 ; turn on a fan and set it to 50% power<\/code><\/p>\n<p>Multiple speed-controlled fans can be defined by the index (P) parameters, as each fan is assigned an index by the firmware.<\/p>\n<p>Finally, the M107 command will power off a specified fan. If no index parameter is provided, the part cooling fan is usually the one to be shut down.<\/p>\n<div class=\"section\">\n<h3 class=\"headline headline--listicle-section u-text-center\">PROGRAM STRUCTURE<\/h3>\n<\/div>\n<div class=\"rich-text rich-text--full\">\n<p>We\u2019re now in a good position to look at an actual piece of code that\u2019s used for 3D printing. G-code programs can be divided into three distinct sections, as we\u2019ll see next.<\/p>\n<p>It\u2019s worth noting that, if you use a text editor to open a G-code file generated by a 3D slicer, it might be that it won\u2019t immediately start with G- or M-commands. For example, a slicer like\u00a0<a href=\"https:\/\/all3dp.com\/1\/cura-tutorial-software-slicer-cura-3d\/\" target=\"_blank\" rel=\"noopener\">Cura<\/a>\u00a0or\u00a0<a href=\"https:\/\/all3dp.com\/2\/simplify3d-beginner-s-guide-to-this-premium-slicer\/\" target=\"_blank\" rel=\"noopener\">Simplify3D<\/a>\u00a0starts code by including some of the printing process parameters defined previously within comments. These lines won\u2019t affect the printing but instead present a quick reference for parameters like layer height, for example.<\/p>\n<\/div>\n<h3 class=\"headline headline--xxl\">Phase 1: Initialization<\/h3>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/fd8a82b0a0b8f4e3.png\" alt=\"\" width=\"1000\" height=\"346\" \/><figcaption class=\"wp-caption-text\">The &#8220;initialization phase&#8221; includes all commands required for preparing the printer to print (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<p>The first section of any program includes the preparation tasks required prior to starting printing the model. The following are the first six lines of initialization G-code commands from an actual 3D printing job.<\/p>\n<div class=\"code\">\n<pre class=\"code__content\"><code>G90<\/code> <code>M82<\/code> <code>M140 S80<\/code> <code>M104 S200<\/code> <code>G28<\/code> <code>G29<\/code><\/pre>\n<\/div>\n<p>As we now know, the first line says that movements should use absolute positioning, while the second line tells the extruder to also interpret extrusion in absolute terms.<\/p>\n<p>The third and fourth lines start heating the bed and nozzle to their target temperatures. Note that it won\u2019t wait for the target temperature, meaning that the printer will auto-home and level the bed while heating up.<\/p>\n<p>Some initialization routines (e.g. the one used by\u00a0<a href=\"https:\/\/all3dp.com\/2\/prusaslicer-simply-explained\/\">PrusaSlicer<\/a>) include a nozzle purging process, like printing a single straight line\u00a0before jumping into the printing process.<\/p>\n<div class=\"listicle-header__wrapper\">\n<div class=\"listicle-header__content\">\n<h3 class=\"headline headline--xxl\">Phase 2: Printing<\/h3>\n<\/div>\n<\/div>\n<div class=\"listicle-header__image\">\n<div class=\"image image--center image--rounded image--loaded\">\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/403289887eb0ac7c.png\" alt=\"\" width=\"1000\" height=\"425\" \/><figcaption class=\"wp-caption-text\">The printing process is mainly composed of a series of movements and extrusions (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Here\u2019s where the magic happens. If you look at a sliced G-code file, you\u2019ll see that it\u2019s impossible for us to make out what the nozzle is actually doing.<\/p>\n<p>3D printing is a layer-by-layer process, so you\u2019ll find that this phase includes many movements within the XY-plane while printing a single layer. Once that\u2019s done, one tiny movement in the Z direction will define the beginning of the next layer.<\/p>\n<p>Here is an example of how G-code commands can look during the printing phase:<\/p>\n<pre class=\"code__content\"><code>G1 X103.505 Y153.291 E4.5648 ; movement and extrusion in XY plane<\/code> <code>G1 X103.291 Y153.505 E4.5804 ; movement and extrusion in XY plane<\/code> <code>G1 Z0.600 F3000 ; change layer<\/code> <code>G1 X104.025 Y154.025 F9000 ; movement in XY plane<\/code> <code>G1 X95.975 Y154.025 E0.4133 F1397 ; movement and extrusion in XY plane<\/code><\/pre>\n<div class=\"listicle-header__wrapper\">\n<div class=\"listicle-header__content\">\n<h3 class=\"headline headline--xl\">Phase 3: Reset the Printer<\/h3>\n<\/div>\n<\/div>\n<div class=\"listicle-header__image\">\n<div class=\"image image--center image--rounded image--loaded\">\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/2be2ecae08f10912.png\" alt=\"\" width=\"1000\" height=\"414\" \/><figcaption class=\"wp-caption-text\">The final commands of G-code are usually resetting positions and status (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Finally, when printing is done, some final lines of G-code commands bring the printer to a reasonable default state.<\/p>\n<p>For example, the nozzle might go to a pre-defined position, the hot end and bed heaters are turned off, and the motors are disabled, among other actions.<\/p>\n<pre class=\"code__content\"><code>M107 ; turn fan off<\/code> <code>G1 Z10 ; move nozzle away from print<\/code> <code>M104 S0 ; turn hot end heating off<\/code> <code>M140 S0 ; turn bed heating off<\/code> <code>M84 ; turn motors off<\/code><\/pre>\n<div class=\"listicle-header__wrapper\">\n<div class=\"listicle-header__content\">\n<h3 class=\"headline headline--xl\">Terminal Inputs &amp; Outputs<\/h3>\n<\/div>\n<\/div>\n<div class=\"listicle-header__image\">\n<div class=\"image image--center image--rounded image--loaded\">\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/bb2aaf36dd76caf3.png\" alt=\"\" width=\"1000\" height=\"562\" \/><figcaption class=\"wp-caption-text\">OctoPrint has a terminal window for sending and receiving G-code directly (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Until now, we\u2019ve only talked about the computer sending G-code commands to the printer (usually transferred via an SD card). However, this isn\u2019t the only method of communication.<\/p>\n<p>Some control software, like\u00a0<a href=\"https:\/\/all3dp.com\/2\/pronterface-how-to-download-install-and-set-it-up\/\" target=\"_blank\" rel=\"noopener\">Pronterface<\/a>\u00a0and\u00a0<a href=\"https:\/\/all3dp.com\/topic\/octoprint\/\" target=\"_blank\" rel=\"noopener\">OctoPrint<\/a>, allows direct communication with the 3D printer, in which case you can input commands manually.<\/p>\n<p>For obvious reasons, it wouldn\u2019t be practical to print anything by sending lines of codes individually. But sometimes this method of communication is needed for other purposes, like retrieving valuable information for calibration or even when the 3D printer lacks a display screen.<\/p>\n<p>For example, the M105 \u201creport temperatures\u201d command will retrieve the current nozzle and bed temperatures (which might then be displayed by something like OctoPrint).<\/p>\n<p>This communication is also very useful for seeing and changing EEPROM settings that are hardcoded at the firmware level. Parameters like a motor\u2019s steps\/mm, maximum feed rates, or PID can be visualized via M503 (\u201creport settings\u201d), changed manually, and then saved via M500 (\u201csave settings\u201d).<\/p>\n<h3 class=\"headline headline--xxl\">Writing G-code<\/h3>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/cf50f489c036a568.png\" alt=\"\" width=\"1000\" height=\"552\" \/><figcaption class=\"wp-caption-text\">Some G-code visualization tools can be quite useful for learning how to write code (Source: Lucas Carolo via All3DP)<\/figcaption><\/figure>\n<p>By now, you should be able to read and understand G-code much better. Still, you can also benefit from writing it.<\/p>\n<p>This\u00a0<a href=\"https:\/\/nraynaud.github.io\/webgcode\/\" target=\"_blank\" rel=\"noopener noreferrer\">G-code online visualization<\/a>\u00a0is a great tool for testing your skills, as you can write G-code commands and simulate them accordingly. It\u2019s actually a lot of fun!<\/p>\n<p>Looking at exported G-code files from slicers should also provide you with some insights as to how G-code works for 3D printing. Make sure to have a\u00a0<a href=\"https:\/\/marlinfw.org\/meta\/gcode\/\" target=\"_blank\" rel=\"noopener noreferrer\">commands reference sheet<\/a>\u00a0by your side and explore the code!<\/p>\n<h3 class=\"headline headline--xxl\">Compatibility<\/h3>\n<figure style=\"width: 1000px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/df28ad3b03ad3727.png\" alt=\"\" width=\"1000\" height=\"562\" \/><figcaption class=\"wp-caption-text\">Learning G-code is an ongoing and rewarding task (Source: Repetier)<\/figcaption><\/figure>\n<p>We hope that, with an understanding of G-code commands, you become a more knowledgeable and powerful 3D printing user. While G-code isn\u2019t the most complex computer language, it still requires a lot of practice and study.<\/p>\n<p>Before wrapping up this article, it might be worth talking a bit about G-code compatibility.<\/p>\n<p>There are many types of 3D printing firmware, and each might have different \u201cflavors\u201d of G-code. This can lead to major compatibility issues, as commands that work for one machine might not work for another.<\/p>\n<p>Slicer software handles this by passing the code through machine-specific post-processing drivers. The post-processor detects the incoming code\u2019s flavor and converts the code to something the firmware will understand.<\/p>\n<p>With that said, we hope you enjoyed this brief guide. Happy coding!<\/p>\n<div><\/div>\n<div>Source: <a href=\"https:\/\/all3dp.com\/2\/3d-printer-g-code-commands-list-tutorial\/\">https:\/\/all3dp.com\/2\/3d-printer-g-code-commands-list-tutorial\/<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a programming language for\u00a0computer numerical control (CNC). In other words, it\u2019s the language spoken by a computer controlling a machine, and it communicates all commands required for movement and other [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[45],"kbtag":[130,144,753,754],"class_list":["post-164934","kb","type-kb","status-publish","hentry","kbtopic-tech","kbtag-3d-printer","kbtag-cnc","kbtag-g-code","kbtag-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.1 (Yoast SEO v27.1.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>3D Printer G-code Commands: Full List &amp; Tutorial - FacFox Docs<\/title>\n<meta name=\"description\" content=\"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3D Printer G-code Commands: Full List &amp; Tutorial\" \/>\n<meta property=\"og:description\" content=\"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial\" \/>\n<meta property=\"og:site_name\" content=\"FacFox Docs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/facfox3d\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-09T03:28:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@facfox3d\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial\",\"url\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial\",\"name\":\"3D Printer G-code Commands: Full List & Tutorial - FacFox Docs\",\"isPartOf\":{\"@id\":\"https:\/\/facfox.com\/docs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage\"},\"image\":{\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage\"},\"thumbnailUrl\":\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png\",\"datePublished\":\"2022-06-24T03:29:59+00:00\",\"dateModified\":\"2022-12-09T03:28:21+00:00\",\"description\":\"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!\",\"breadcrumb\":{\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage\",\"url\":\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png\",\"contentUrl\":\"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/facfox.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"3D Printer G-code Commands: Full List &#038; Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/facfox.com\/docs\/#website\",\"url\":\"https:\/\/facfox.com\/docs\/\",\"name\":\"FacFox Docs\",\"description\":\"Knowledgebase of manufacturing\",\"publisher\":{\"@id\":\"https:\/\/facfox.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/facfox.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/facfox.com\/docs\/#organization\",\"name\":\"FACFOX,INC.\",\"url\":\"https:\/\/facfox.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/facfox.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/facfox.com\/docs\/wp-content\/uploads\/2020\/11\/foxdoc-favicon.png\",\"contentUrl\":\"https:\/\/facfox.com\/docs\/wp-content\/uploads\/2020\/11\/foxdoc-favicon.png\",\"width\":132,\"height\":133,\"caption\":\"FACFOX,INC.\"},\"image\":{\"@id\":\"https:\/\/facfox.com\/docs\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/facfox3d\",\"https:\/\/x.com\/facfox3d\",\"https:\/\/instagram.com\/facfox3d\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"3D Printer G-code Commands: Full List & Tutorial - FacFox Docs","description":"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial","og_locale":"en_US","og_type":"article","og_title":"3D Printer G-code Commands: Full List & Tutorial","og_description":"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!","og_url":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial","og_site_name":"FacFox Docs","article_publisher":"https:\/\/facebook.com\/facfox3d","article_modified_time":"2022-12-09T03:28:21+00:00","og_image":[{"url":"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@facfox3d","twitter_misc":{"Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial","url":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial","name":"3D Printer G-code Commands: Full List & Tutorial - FacFox Docs","isPartOf":{"@id":"https:\/\/facfox.com\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage"},"image":{"@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage"},"thumbnailUrl":"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png","datePublished":"2022-06-24T03:29:59+00:00","dateModified":"2022-12-09T03:28:21+00:00","description":"Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code! Simply put, G-code is a Understanding G-code commands will unlock the next level of 3D printing. Read on to quickly learn the basics of this code!","breadcrumb":{"@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#primaryimage","url":"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png","contentUrl":"https:\/\/img.facfox.com\/imgs\/2022\/06\/16\/8ebaa81ebfc27d8a.png"},{"@type":"BreadcrumbList","@id":"https:\/\/facfox.com\/docs\/kb\/3d-printer-g-code-commands-full-list-tutorial#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/facfox.com\/docs\/"},{"@type":"ListItem","position":2,"name":"3D Printer G-code Commands: Full List &#038; Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/facfox.com\/docs\/#website","url":"https:\/\/facfox.com\/docs\/","name":"FacFox Docs","description":"Knowledgebase of manufacturing","publisher":{"@id":"https:\/\/facfox.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/facfox.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/facfox.com\/docs\/#organization","name":"FACFOX,INC.","url":"https:\/\/facfox.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/facfox.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/facfox.com\/docs\/wp-content\/uploads\/2020\/11\/foxdoc-favicon.png","contentUrl":"https:\/\/facfox.com\/docs\/wp-content\/uploads\/2020\/11\/foxdoc-favicon.png","width":132,"height":133,"caption":"FACFOX,INC."},"image":{"@id":"https:\/\/facfox.com\/docs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/facfox3d","https:\/\/x.com\/facfox3d","https:\/\/instagram.com\/facfox3d"]}]}},"_links":{"self":[{"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kb\/164934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/comments?post=164934"}],"version-history":[{"count":3,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kb\/164934\/revisions"}],"predecessor-version":[{"id":165342,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kb\/164934\/revisions\/165342"}],"wp:attachment":[{"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/media?parent=164934"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kbtopic?post=164934"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/facfox.com\/docs\/wp-json\/wp\/v2\/kbtag?post=164934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}