Firmware ignores comments, but slicers fill them with information that printers’ screens, print hosts and G-code viewers read: which program made the file, how long it will take, where each layer starts, what each move is printing, the full settings, and preview images. These conventions belong to each slicer rather than to any standard. This page records the two most copied, PrusaSlicer’s (also used by the slicers derived from it) and UltiMaker Cura’s, from their source code.
Identifying the producer
Readers look at the first comments for a producer string. PrusaSlicer’s own G-code reader recognises these:
| Text found in a comment | Producer |
|---|---|
generated by PrusaSlicer | PrusaSlicer, written as ; generated by PrusaSlicer version on date at time UTC |
generated by SuperSlicer | SuperSlicer |
generated by OrcaSlicer | OrcaSlicer |
BambuStudio | Bambu Studio |
generated by AnkerMake Studio | AnkerMake Studio |
generated by XDesktop | XYZprinting XDesktop |
Cura_SteamEngine | UltiMaker Cura (its engine) |
KISSlicer | KISSlicer |
ideaMaker | Raise3D ideaMaker |
CraftWare | CraftWare |
PrusaSlicer
Header
After the producer line come optional ; prepared by and notes lines,
then the thumbnails, then the extrusion widths used:
; external perimeters extrusion width = 0.45mm, and the same for
perimeters, infill, solid infill, top infill, support material and first layer.
Markers in the body
| Comment | Meaning |
|---|---|
;LAYER_CHANGE | A new layer starts |
;Z:z | Print height of the new layer, in mm |
;HEIGHT:h | Layer height of the following extrusions |
;WIDTH:w | Extrusion width of the following extrusions |
;TYPE:role | What the following moves print; see the roles below |
;WIPE_START, ;WIPE_END | A wipe move during retraction |
;COLOR_CHANGE | A colour change inserted by the user |
;PAUSE_PRINT | A pause inserted by the user |
;CUSTOM_GCODE | Custom G-code inserted by the user at a layer |
;MOVING_UNRETRACT_START, ;MOVING_UNRETRACT_END | An unretraction made while travelling |
;FLUSH_START, ;FLUSH_END | Custom tag: filament flushing in custom G-code |
;EXCLUDE_E_START, ;EXCLUDE_E_END | Custom tag: extrusion not to be counted |
;_GP_FIRST_LINE_M73_PLACEHOLDER, ;_GP_LAST_LINE_M73_PLACEHOLDER, ;_GP_PRINT_STATISTICS_PLACEHOLDER | Placeholders the slicer replaces before saving: with M73 progress lines and with the statistics block |
; objects_info = JSON | The printed objects and their outlines, on one line, for cancelling objects |
Users’ own custom G-code must not contain the reserved tags, and PrusaSlicer warns
when it does. Other comments starting ;_ (such as
;_EXTRUDE_SET_SPEED and ;_SET_FAN_SPEED) are internal
markers that are removed before the file is written.
Feature roles
;TYPE: value | Meaning |
|---|---|
Perimeter | Inner wall |
External perimeter | Outer wall |
Overhang perimeter | Wall over air |
Internal infill | Sparse infill |
Solid infill | Solid infill |
Top solid infill | Top surface |
Ironing | Ironing pass over the top surface |
Bridge infill | Bridge |
Gap fill | Thin gaps between walls |
Skirt/Brim | Skirt or brim (Skirt in versions up to 2.3.1) |
Support material | Support |
Support material interface | Support interface |
Wipe tower | Wipe (purge) tower |
Custom | Custom G-code that extrudes |
Statistics and progress
Near the end come lines such as ; filament used [mm] = ,
; filament used [cm3] = , ; filament used [g] = ,
; filament cost = (one value per extruder, comma separated),
; total filament used [g] = , ; total filament cost = ,
; total filament used for wipe tower [g] = ,
; total toolchanges = ,
; estimated printing time (normal mode) = 1h 2m 3s, the same for
silent mode, and ; estimated first layer printing time (normal mode) = .
Through the file it inserts M73 Ppercent
Rminutes left lines (Q and S for
silent mode, C and D for minutes to the next colour
change).
Settings block
The file ends with every setting, one per line, between
; prusaslicer_config = begin and ; prusaslicer_config = end,
each line ; key = value. Recent
versions can also write the settings as JSON between
; prusaslicer_json_config = begin and
; prusaslicer_json_config = end, each line of the JSON prefixed with
; . PrusaSlicer reloads its settings from this block when the G-code
is opened.
Embedded thumbnails
PrusaSlicer (and the slicers that copy it) stores preview images in comments near the top, so a printer can show them. Each image is compressed, Base64 encoded and split over comment lines of at most 78 characters:
;
; thumbnail begin 16x16 1220
; iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADW0lEQVQ4jW2TX2xTdRTHP/f+7u1u
; …
; thumbnail end
;
| Tag | Image format |
|---|---|
thumbnail | PNG |
thumbnail_JPG | JPEG |
thumbnail_QOI | QOI |
The sizes and formats come from the printer profile; Prusa’s own printers ask for
several sizes. RepRapFirmware hands embedded thumbnails to its web interface with
M36.1.
UltiMaker Cura
Flavours
Cura writes for one G-code flavour, chosen in the printer settings, and names it on
the first line as ;FLAVOR:name: Marlin,
Marlin(Volumetric), RepRap, UltiGCode,
Griffin, Cheetah, Makerbot,
BFB, Mach3 or Repetier.
Header
For most flavours the header is short:
| Comment | Meaning |
|---|---|
;FLAVOR: | The flavour |
;TIME: | Estimated print time in seconds |
;Filament used: | RepRap and Marlin flavours: filament length per extruder, comma separated, such as 1.23m; mm3 volumes for Marlin(Volumetric) |
;Layer height: | RepRap and Marlin flavours: layer height in mm |
;MINX: … ;MAXZ: | Bounding box of the print, in mm |
;TARGET_MACHINE.NAME: | Printer name |
;MATERIAL:, ;MATERIAL2:, ;NOZZLE_DIAMETER: | Only for the UltiGCode flavour (Ultimaker 2): material volume in mm³ for each extruder, and nozzle size |
The Griffin and Cheetah flavours (UltiMaker’s own printers) use a longer header
between ;START_OF_HEADER and ;END_OF_HEADER, with
;HEADER_VERSION:0.1, ;FLAVOR:,
;GENERATOR.NAME:Cura_SteamEngine, ;GENERATOR.VERSION:,
;GENERATOR.BUILD_DATE:, ;TARGET_MACHINE.NAME:, and per
extruder n ;EXTRUDER_TRAIN.n.INITIAL_TEMPERATURE:,
.MATERIAL.VOLUME_USED:, .MATERIAL.GUID:,
.NOZZLE.DIAMETER: and .NOZZLE.NAME:, then
;BUILD_PLATE.INITIAL_TEMPERATURE:,
;BUILD_VOLUME.TEMPERATURE:, ;PRINT.TIME:,
;PRINT.GROUPS:, ;PRINT.SIZE.MIN.X: to
;PRINT.SIZE.MAX.Z:, ;SLICE_UUID:, and print-process
reporting limits (;PPR_ENABLE:TRUE and the
PPR_ warning and limit values).
Markers in the body
| Comment | Meaning |
|---|---|
;LAYER_COUNT:n | Number of layers |
;LAYER:n | Layer n starts (counted from 0; raft layers are negative) |
;MESH:name | The following moves belong to this object (NONMESH for travel between objects) |
;TYPE:role | WALL-OUTER, WALL-INNER, SKIN (top and bottom), FILL (infill), SUPPORT, SUPPORT-INTERFACE, SKIRT (skirt, brim or raft) or PRIME-TOWER |
;TIME_ELAPSED:seconds | Estimated time at the end of each layer |
Cura appends its settings at the very end on lines starting
;SETTING_3 , holding a JSON object of changed settings broken into
short lines.
What is not covered
Other slicers (Simplify3D, ideaMaker, KISSlicer, Bambu Studio and OrcaSlicer’s own additions) have their own comment conventions that are not documented here.