G-Code

RepRap.org has a great G-Code index of all commands and their compatibility with different versions of firmware: 

http://reprap.org/wiki/G-code

FiveD, Teacup, Sprinter, Marlin, Repetier, Smoothie, RepRapFirmware, Machinekit, MakerBot,   grbl  , Redeem, MK4duo, 4 Special fields, 4.1 N: Line number, 4.2 *: Checksum, 5 Checking, 6 Buffering, 7 G-commands, 7.1 G0 & G1: Move, 7.2 G2 & G3: Controlled Arc Move, 7.3 G4: Dwell, 7.4 G6: Direct Stepper Move, 7.5 G10: Tool Offset, 7.6 G10: Retract, 7.7 G11: Unretract, 7.8 G12: Clean Tool, 7.9 G17..19: Plane Selection (CNC specific), 7.10 G20: Set Units to Inches, 7.11 G21: Set Units to Millimeters, 7.12 G22 & G23: Firmware controlled Retract/Precharge, 7.13 G26: Mesh Validation Pattern, 7.14 G28: Move to Origin (Home), 7.15 G29: Detailed Z-Probe, 7.15.1 G29 Auto Bed Leveling (Marlin), 7.15.2 G29 Unified Bed Leveling (Marlin), 7.15.3 G29 Manual Bed Leveling (Marlin), 7.15.4 G29 Auto Bed Leveling (Repetier-Firmware), 7.15.5 G29 Auto Bed Leveling (RepRapFirmware), 7.16 G29.1: Set Z probe head offset, 7.17 G29.2: Set Z probe head offset calculated from toolhead position, 7.18 G30: Single Z-Probe, 7.19 G31: Set or Report Current Probe status, 7.20 G31: Dock Z Probe sled, 7.21 G32: Probe Z and calculate Z plane, 7.21.1 Probe and calculate in Reprapfirmware, 7.21.2 Probe and calculate in Repetier firmware, 7.22 G32: Undock Z Probe sled, 7.23 G33: Firmware dependent, 7.23.1 G33: Measure/List/Adjust Distortion Matrix (Repetier - Redeem), 7.23.2 G33: Delta Auto Calibration (Marlin 1.1.x), 7.24 G38.x Straight Probe (CNC specific), 7.24.1 G38.2 probe toward workpiece, stop on contact, signal error if failure, 7.24.2 G38.3 probe toward workpiece, stop on contact, 7.24.3 G38.4 probe away from workpiece, stop on loss of contact, signal error if failure, 7.24.4 G38.5 probe away from workpiece, stop on loss of contact, 7.25 G40: Compensation Off (CNC specific), 7.26 G42: Move to Grid Point, 7.27 G54..59: Coordinate System Select (CNC specific), 7.28 G60: save current position to slot, 7.29 G61: Apply/restore saved coordinates to the active extruder., 7.30 G80: Cancel Canned Cycle (CNC specific), 7.31 G90: Set to Absolute Positioning, 7.32 G91: Set to Relative Positioning, 7.33 G92: Set Position, 7.33.1 G92.x: Reset Coordinate System Offsets (CNC specific), 7.34 G93: Feed Rate Mode (Inverse Time Mode) (CNC specific), 7.35 G94: Feed Rate Mode (Units per Minute) (CNC specific), 7.36 G100: Calibrate floor or rod radius, 7.37 G130: Set digital potentiometer value, 7.38 G131: Remove offset, 7.39 G132: Calibrate endstop offsets, 7.40 G133: Measure steps to top, 7.41 G161: Home axes to minimum, 7.42 G162: Home axes to maximum, 8 M-commands, 8.1 M0: Stop or Unconditional stop, 8.2 M1: Sleep or Conditional stop, 8.3 M2: Program End, 8.4 M3: Spindle On, Clockwise (CNC specific), 8.5 M4: Spindle On, Counter-Clockwise (CNC specific), 8.6 M5: Spindle Off (CNC specific), 8.7 M6: Tool change, 8.8 M7: Mist Coolant On (CNC specific), 8.9 M8: Flood Coolant On (CNC specific), 8.10 M9: Coolant Off (CNC specific), 8.11 M10: Vacuum On (CNC specific), 8.12 M11: Vacuum Off (CNC specific), 8.13 M17: Enable/Power all stepper motors, 8.14 M18: Disable all stepper motors, 8.15 M20: List SD card, 8.16 M21: Initialize SD card, 8.17 M22: Release SD card, 8.18 M23: Select SD file, 8.19 M24: Start/resume SD print, 8.20 M25: Pause SD print, 8.21 M26: Set SD position, 8.22 M27: Report SD print status, 8.23 M28: Begin write to SD card, 8.24 M29: Stop writing to SD card, 8.25 M30: Delete a file on the SD card, 8.25.1 M30 in grbl, 8.26 M31: Output time since last M109 or SD card start to serial, 8.27 M32: Select file and start SD print, 8.28 M33: Get the long name for an SD card file or folder, 8.29 M33: Stop and Close File and save restart.gcode, 8.30 M34: Set SD file sorting options, 8.31 M35: Upload firmware NEXTION from SD, 8.32 M36: Return file information, 8.33 M37: Simulation mode, 8.34 M38 Compute SHA1 hash of target file, 8.35 M40: Eject, 8.36 M41: Loop, 8.37 M42: Switch I/O pin, 8.38 M43: Stand by on material exhausted, 8.39 M43: Pin report and debug, 8.40 M48: Measure Z-Probe repeatability, 8.41 M70: Display message, 8.42 M72: Play a tone or song, 8.43 M73: Set build percentage, 8.44 M80: ATX Power On, 8.45 M81: ATX Power Off, 8.46 M82: Set extruder to absolute mode, 8.47 M83: Set extruder to relative mode, 8.48 M84: Stop idle hold, 8.49 M85: Set inactivity shutdown timer, 8.50 M92: Set axis_steps_per_unit, 8.51 M93: Send axis_steps_per_unit, 8.52 M98: Call Macro/Subprogram, 8.53 M99: Return from Macro/Subprogram, 8.54 M98: Get axis_hysteresis_mm, 8.55 M99: Set axis_hysteresis_mm, 8.56 M101: Turn extruder 1 on (Forward), Undo Retraction, 8.57 M102: Turn extruder 1 on (Reverse), 8.58 M103: Turn all extruders off, Extruder Retraction, 8.59 M104: Set Extruder Temperature, 8.59.1 M104 in Teacup Firmware, 8.60 M105: Get Extruder Temperature, 8.61 M106: Fan On, 8.61.1 M106 in RepRapFirmware, 8.61.2 M106 in Teacup Firmware, 8.62 M107: Fan Off, 8.63 M108: Cancel Heating (Marlin), 8.64 M108: Set Extruder Speed (BFB), 8.65 M109: Set Extruder Temperature and Wait, 8.65.1 M109 in Teacup, 8.65.2 M109 in Marlin, Sprinter (ATmega port), RepRapFirmware, 8.65.3 M109 in Sprinter (4pi port), 8.65.4 M109 in MakerBot, 8.66 M110: Set Current Line Number, 8.67 M111: Set Debug Level, 8.67.1 M111 in RepRapFirmware, 8.67.2 M111 in Repetier, 8.68 M112: Emergency Stop, 8.69 M113: Set Extruder PWM, 8.70 M114: Get Current Position, 8.71 M115: Get Firmware Version and Capabilities, 8.72 M116: Wait, 8.73 M117: Get Zero Position, 8.74 M117: Display Message, 8.75 M118: Echo message on host, 8.76 M118: Negotiate Features, 8.77 M119: Get Endstop Status, 8.78 M120: Push, 8.79 M121: Pop, 8.80 M120: Enable endstop detection, 8.81 M121: Disable endstop detection, 8.82 M122: Diagnose, 8.83 M123: Tachometer value, 8.84 M124: Immediate motor stop, 8.85 M126: Open Valve, 8.85.1 M126 in MakerBot, 8.86 M127: Close Valve, 8.86.1 M127 in MakerBot, 8.87 M128: Extruder Pressure PWM, 8.88 M129: Extruder pressure off, 8.89 M130: Set PID P value, 8.90 M131: Set PID I value, 8.91 M132: Set PID D value, 8.91.1 M132 in MakerBot, 8.92 M133: Set PID I limit value, 8.92.1 M133 in MakerBot, 8.93 M134: Write PID values to EEPROM, 8.93.1 M134 in MakerBot, 8.94 M135: Set PID sample interval, 8.94.1 M135 in MakerBot, 8.95 M136: Print PID settings to host, 8.96 M140: Set Bed Temperature (Fast), 8.97 M141: Set Chamber Temperature (Fast), 8.98 M142: Holding Pressure, 8.99 M143: Maximum heater temperature, 8.100 M144: Bed Standby, 8.101 M146: Set Chamber Humidity, 8.102 M149: Set temperature units, 8.103 M150: Set display color, 8.104 M155: Automatically send temperatures, 8.105 M160: Number of mixed materials, 8.106 M163: Set weight of mixed material, 8.107 M164: Store weights, 8.108 M165: Set multiple mix weights, 8.109 M190: Wait for bed temperature to reach target temp, 8.110 M191: Wait for chamber temperature to reach target temp, 8.111 M200: Set filament diameter, 8.112 M201: Set max printing acceleration, 8.113 M202: Set max travel acceleration, 8.114 M203: Set maximum feedrate, 8.114.1 M203 Repetier, 8.115 M204: Set default acceleration, 8.115.1 M204 Repetier, 8.116 M205: Advanced settings, 8.116.1 M205 Repetier, 8.117 M206: Offset axes, 8.118 M206 in Repetier: Set eeprom value, 8.119 M207: Calibrate z axis by detecting z max length, 8.120 M207: Set retract length, 8.121 M208: Set axis max travel, 8.122 M208: Set unretract length, 8.123 M209: Enable automatic retract, 8.124 M210: Set homing feedrates, 8.125 M211: Disable/Enable software endstops, 8.126 M212: Set Bed Level Sensor Offset, 8.127 M218: Set Hotend Offset, 8.128 M220: Set speed factor override percentage, 8.129 M221: Set extrude factor override percentage, 8.130 M220: Turn off AUX V1.0.5, 8.131 M221: Turn on AUX V1.0.5, 8.132 M222: Set speed of fast XY moves, 8.133 M223: Set speed of fast Z moves, 8.134 M224: Enable extruder during fast moves, 8.135 M225: Disable on extruder during fast moves, 8.136 M226: Gcode Initiated Pause, 8.137 M226: Wait for pin state, 8.138 M227: Enable Automatic Reverse and Prime, 8.139 M228: Disable Automatic Reverse and Prime, 8.140 M229: Enable Automatic Reverse and Prime, 8.141 M230: Disable / Enable Wait for Temperature Change, 8.142 M231: Set OPS parameter, 8.143 M232: Read and reset max. advance values, 8.144 M240: Trigger camera, 8.145 M240: Start conveyor belt motor / Echo off, 8.146 M241: Stop conveyor belt motor / echo on, 8.147 M245: Start cooler, 8.148 M246: Stop cooler, 8.149 M250: Set LCD contrast, 8.150 M251: Measure Z steps from homing stop (Delta printers), 8.151 M260: i2c Send Data, 8.152 M261: i2c Request Data, 8.153 M280: Set servo position, 8.154 M290: Baby stepping, 8.155 M291: Display message and optionally wait for response, 8.156 M292: Acknowledge message, 8.157 M300: Play beep sound, 8.158 M301: Set PID parameters, 8.158.1 Marlin, 8.158.2 RepRapFirmware (v1.09 onwards), 8.158.3 Smoothie, 8.158.4 Other implementations, 8.158.5 Teacup, 8.159 M302: Allow cold extrudes, 8.160 M303: Run PID tuning, 8.161 M304: Set PID parameters - Bed, 8.161.1 M304 in RepRapPro version of Marlin: Set thermistor values, 8.162 M305: Set thermistor and ADC parameters, 8.163 M306: Set home offset calculated from toolhead position, 8.164 M307: Set or report heating process parameters, 8.165 M320: Activate autolevel (Repetier), 8.166 M321: Deactivate autolevel (Repetier), 8.167 M322: Reset autolevel matrix (Repetier), 8.168 M323: Distortion correction on/off (Repetier), 8.169 M340: Control the servos, 8.170 M350: Set microstepping mode, 8.171 M351: Toggle MS1 MS2 pins directly, 8.172 M355: Turn case lights on/off, 8.173 M360: Report firmware configuration, 8.174 SCARA calibration codes (Morgan), 8.175 M360: Move to Theta 0 degree position, 8.176 M361: Move to Theta 90 degree position, 8.177 M362: Move to Psi 0 degree position, 8.178 M363: Move to Psi 90 degree position, 8.179 M364: Move to Psi + Theta 90 degree position, 8.180 M365: SCARA scaling factor, 8.181 M366: SCARA convert trim, 8.182 M370: Morgan manual bed level - clear map, 8.183 M371: Move to next calibration position, 8.184 M372: Record calibration value, and move to next position, 8.185 M373: End bed level calibration mode, 8.186 M374: Save calibration grid, 8.187 M375: Display matrix / Load Matrix, 8.188 M376: Set bed compensation taper, 8.189 M380: Activate solenoid, 8.190 M381: Disable all solenoids, 8.191 M400: Wait for current moves to finish, 8.192 M401: Lower z-probe, 8.193 M402: Raise z-probe, 8.194 M404: Filament width and nozzle diameter, 8.195 M405: Filament Sensor on, 8.196 M406: Filament Sensor off, 8.197 M407: Display filament diameter, 8.198 M408: Report JSON-style response, 8.199 M420: Set RGB Colors as PWM (MachineKit), 8.200 M420: Leveling On/Off/Fade (Marlin), 8.201 M421: Set a Mesh Bed Leveling Z coordinate, 8.202 M450: Report Printer Mode, 8.203 M451: Select FFF Printer Mode, 8.204 M452: Select Laser Printer Mode, 8.205 M453: Select CNC Printer Mode, 8.206 M460: Define temperature range for thermistor-controlled fan, 8.207 M500: Store parameters in EEPROM, 8.208 M501: Read parameters from EEPROM, 8.209 M502: Revert to the default "factory settings.", 8.210 M503: Print settings, 8.211 M530: Enable printing mode, 8.212 M531: Set print name, 8.213 M532: Set print progress, 8.214 M540: Enable/Disable "Stop SD Print on Endstop Hit", 8.215 M540: Set MAC address, 8.216 M550: Set Name, 8.217 M551: Set Password, 8.218 M552: Set IP address, enable/disable network interface, 8.219 M553: Set Netmask, 8.220 M554: Set Gateway, 8.221 M555: Set compatibility, 8.222 M556: Axis compensation, 8.223 M557: Set Z probe point or define probing grid, 8.224 M558: Set Z probe type, 8.225 M559: Upload configuration file, 8.226 M560: Upload web page file, 8.227 M561: Set Identity Transform, 8.228 M562: Reset temperature fault, 8.229 M563: Define or remove a tool, 8.230 M564: Limit axes, 8.231 M565: Set Z probe offset, 8.232 M566: Set allowable instantaneous speed change, 8.233 M567: Set tool mix ratios, 8.234 M568: Turn off/on tool mix ratios, 8.235 M569: Set axis direction and enable values, 8.236 M570: Configure heater fault detection, 8.237 M571: Set output on extrude, 8.238 M572: Set or report extruder pressure advance, 8.239 M573: Report heater PWM, 8.240 M574: Set endstop configuration, 8.241 M575: Set serial comms parameters, 8.242 M577: Wait until endstop is triggered, 8.243 M578: Fire inkjet bits, 8.244 M579: Scale Cartesian axes, 8.245 M580: Select Roland, 8.246 M581: Configure external trigger, 8.247 M582: Check external trigger, 8.248 M583: Wait for pin, 8.249 M584: Set drive mapping, 8.250 M585: Probe Tool, 8.251 M586: Configure network protocols, 8.252 M587: Store WiFi host network in list, or list stored networks, 8.253 M588: Forget WiFi host network, 8.254 M589: Configure access point parameters, 8.255 M590: Report current tool type and index, 8.256 M591: Configure filament sensing, 8.257 M600: Set line cross section, 8.258 M600: Filament change pause, 8.259 M605: Set dual x-carriage movement mode, 8.260 M665: Set delta configuration, 8.261 M666: Set delta endstop adjustment, 8.262 M667: Select CoreXY mode, 8.263 M668: Set Z-offset compensations polynomial, 8.264 M669: Set kinematics type and kinematics parameters, 8.265 M670: Set IO port bit mapping, 8.266 M671: Define positions of Z leadscrews or bed levelling screws, 8.267 M672: Program Z probe, 8.268 M700: Level plate, 8.269 M701: Load filament, 8.270 M702: Unload filament, 8.271 M703: Get Board Type, 8.272 M710: Erase the EEPROM and reset the board, 8.273 M750: Enable 3D scanner extension, 8.274 M751: Register 3D scanner extension over USB, 8.275 M752: Start 3D scan, 8.276 M753: Cancel current 3D scanner action, 8.277 M754: Calibrate 3D scanner, 8.278 M755: Set alignment mode for 3D scanner, 8.279 M756: Shutdown 3D scanner, 8.280 M800: Fire start print procedure, 8.281 M801: Fire end print procedure, 8.282 M851: Set Z-Probe Offset, 8.282.1 M851 in Marlin 1.0.2, 8.282.2 M851 in Marlin 1.1.0, 8.282.3 M851 in MK4duo 4.3.25, 8.283 M900 Set Linear Advance Scaling Factors, 8.284 M905: Set local date and time, 8.285 M906: Set motor currents, 8.286 M907: Set digital trimpot motor, 8.287 M908: Control digital trimpot directly, 8.288 M909: Set microstepping, 8.289 M910: Set decay mode, 8.290 M911: Enable auto save and set threshold voltages, 8.291 M912: Set electronics temperature monitor adjustment, 8.292 M913: Set motor percentage of normal current, 8.293 M914: Set/Get Expansion Voltage Level Translator, 8.294 M928: Start SD logging, 8.295 M997: Perform in-application firmware update, 8.296 M998: Request resend of line, 8.297 M999: Restart after being stopped by error, 9 Other commands, 9.1 G: List all G-codes, 9.2 M: List all M-codes, 9.3 T: Select Tool, 10 Proposed EEPROM configuration codes, 11 Replies from the RepRap machine to the host computer, 12 Proposal for sending multiple lines of G-code, 12.1 Problem to solve, 13 Alternatives to G-code

Still need help? Contact Us Contact Us