Command reference
ZPL commands
69 commands in 9 groups, from format start to barcodes. Open one for its syntax, parameters, example and the pages of Zebra's guide it comes from. This reference covers 69 of the 223 commands in the programming guide, chosen for building labels.
Format start and end, separators, comments
Groups^XAStart FormatOpens a label format. A valid ZPL II format starts with ^XA and ends with ^XZ.^XZEnd FormatCloses a label format. When the printer receives it, a label prints.^FSField SeparatorMarks the end of a field definition, so the commands that follow start a new field.^FXCommentAdds a non-printing comment to a label format. The comment runs up to the next caret or tilde command.
Field position and orientation
Groups^FOField OriginSets where the next field starts: the position of the field's upper-left corner, counted in dots from the label home position.^FTField TypesetSets the field position, counted from the label home, using a typesetting origin that stays fixed to the field's contents and does not change with rotation.^LHLabel HomeSets the label home position, the reference point that field positions are counted from. It affects only the fields that come after it.^FWField OrientationSets the default rotation, and on newer firmware the default justification, for the fields that follow it.^FRField Reverse PrintMakes one field print as the reverse of its background: white over black or black over white.^FPField ParameterSets the direction in which the characters of a text field are laid out (horizontal, vertical or right to left) and adds an optional gap between characters.^LRLabel Reverse PrintTurns reverse printing on or off for the fields that follow it, so that fields appear as the reverse of their background without a ^FR in each one.^LTLabel TopMoves the whole label format up or down by a small number of dot rows, to fine-tune where it falls on the label without editing the fields.^POPrint OrientationInverts the whole label format by 180 degrees, or sets it back to normal. Coordinates are then counted in the inverted frame.
Field data
Groups^FDField DataDefines the data string of a field: the text or barcode data that the field carries.^FHField Hexadecimal IndicatorLets the field data that follows contain hexadecimal values for characters. A marker character, an underscore by default, introduces each value.^CIChange International Font/EncodingSelects the international character set or text encoding used for printing, and can remap individual character codes.^FVField VariableCarries the data of a variable field. It takes the place of ^FD, and its data is cleared after the label prints.^FNField NumberGives a field a number so that a stored format (^DF) can mark where data goes and a recalling format (^XF) can fill it in.^SNSerialization DataGives a field a serial value that the printer raises or lowers by a set step each time a label is printed. It works on text and barcode fields.
Fonts and text blocks
Groups^AScalable/Bitmapped FontChooses the font, orientation, character height and width for the text field that follows. The choice applies to that one field only.^CFChange the Alphanumeric Default FontSets the default font, character height and character width for alphanumeric fields, so that ^A need not be repeated in every field.^FBField BlockFormats an ^FD or ^SN string as a block of text with automatic word wrap, using the origin, font and rotation set for that field.^TBText BlocksPrints a text block of a defined width and height with automatic word wrap and support for complex text layout. Text beyond the block height is truncated.^A@Use Font Name to Call FontSelects a font by its complete file name and storage drive instead of the single-character identifier that ^A uses, and sets orientation, height and width for the field.^CWFont IdentifierAssigns a one-character identifier to a font stored in the printer, either replacing a built-in font of that identifier or adding the stored font as an extra one.
Label geometry and units
Groups^LLLabel LengthSets the label length in dots. It is required for continuous media and can optionally be applied to gap and mark media as well.^PWPrint WidthSets the print width of the label in dots.^MUSet Units of MeasurementChooses whether following values are read as dots, inches or millimeters, and can convert a format made for one density to another.^JMSet Dots per MillimeterSelects between the printer's normal dot density and half of it. At the lower density the format is doubled in size, and field origins are affected.
Print control, media and print mode
Groups^PQPrint QuantitySets how many labels print, how many print between pauses, how many times each serial number repeats, and how cutting behaves around pauses and error labels.^PRPrint RateSets the print speed, the slew speed (feeding a blank label) and the backfeed speed for the labels that follow.~SDSet DarknessSets the print darkness to the given value on a 00 to 30 scale; the guide says it is the equivalent of the darkness setting on the printer's control panel.^MDMedia DarknessChanges the print darkness relative to the printer's current darkness setting.^MTMedia TypeTells the printer whether the media is thermal transfer (used with a ribbon) or direct thermal (heat-sensitive, no ribbon).^MMPrint ModeChooses what the printer does after a label or group of labels is printed, such as tear-off, peel-off, cutting or rewinding, and whether to pre-peel.^MNMedia TrackingTells the printer whether the media is continuous or divided by webs, notches or marks, and sets the black mark offset in dots.^JUConfiguration UpdateSets the printer's active configuration: reloads factory or network defaults, recalls the last saved settings, or saves the current settings.
Graphic shapes
Groups^GBGraphic BoxDraws a box, or a line, with chosen width, height, border thickness, color and corner rounding.^GCGraphic CircleDraws a circle from a diameter, an outline thickness and a color.^GDGraphic Diagonal LineDraws a straight diagonal line inside a box of given width and height, leaning right or left.^GEGraphic EllipseDraws an ellipse from a width, a height, an outline thickness and a color.
Images, graphics and stored formats
Groups^GFGraphic FieldSends bitmap data inside the label format, straight into the printer's bitmap storage, as ASCII hexadecimal, binary or compressed binary.~DGDownload GraphicsDownloads a graphic, written as an ASCII hexadecimal string, into printer memory under a name, for later recall.^XGRecall GraphicPrints a graphic that is stored in printer memory, optionally magnified on each axis by a factor from 1 to 10.^DFDownload FormatStores the ZPL commands that follow it, as text, under a name in printer memory, so that ^XF can recall the format later and merge variable data into it.^XFRecall FormatRecalls a format stored with ^DF so that it is merged with variable data supplied through ^FN fields in the calling format.^ILImage LoadLoads a stored image of a format at the start of a new format, so that variable data can be added on top of it.^ISImage SaveSaves the label format being built as a graphic image instead of a ZPL script, so it can be recalled later and overlaid with variable data.^IMImage MoveMoves a stored image straight into the bitmap at the field position, the same as ^XG but without magnification.^IDObject DeleteDeletes stored objects (graphics, fonts, stored formats) from a storage device, one at a time or in groups with an asterisk wildcard.~DYDownload ObjectsDownloads a graphic object or a font file to the printer in any supported format, with a choice of encoding and file extension.
Barcodes
Groups^BYBar Code Field DefaultSets the module width, the wide-to-narrow bar ratio and the bar height that later barcode commands fall back on, until the next ^BY is received.^BCCode 128 Barcode (Subsets A, B, and C)Prints a Code 128 barcode, a variable-length alphanumeric code with three character subsets, from the data of the next field.^B3Code 39 BarcodePrints a Code 39 barcode, which reaches the full 128-character ASCII set through paired characters, from the data of the next field.^B2Interleaved 2 of 5 Bar CodePrints an Interleaved 2 of 5 barcode, a numeric-only linear code, from the data of the next field.^BEEAN-13 BarcodePrints an EAN-13 barcode from exactly 12 characters of field data; the guide describes it as similar to UPC-A and used in retail in Europe and Japan.^BUUPC-A BarcodePrints a UPC-A barcode, a fixed-length numeric code, from exactly 11 characters of field data.^BQQR Code BarcodePrints a QR Code symbol from the data of the next field; the field data must begin with switches that select the error-correction level and the input mode.^BXData Matrix BarcodePrints a Data Matrix symbol, a two-dimensional code of square modules inside a perimeter finder pattern, from the data of the next field.^B7PDF417 Bar CodePrints a PDF417 symbol, a two-dimensional stacked code of three to 90 rows, from the data of the next field.^B0Aztec Barcode ParametersPrints an Aztec symbol, a two-dimensional matrix code of square modules around a central bulls-eye. Written with the digit zero; the guide also documents a letter O form, ^BO.^BDUPS MaxiCode Bar CodePrints a UPS MaxiCode symbol, a two-dimensional code developed by UPS and read optically, with no interpretation line; modes 2 and 3 expect a structured message.^BOAztec Bar Code ParametersPrints an Aztec symbol, a two-dimensional matrix code of square modules around a central bulls-eye. Written with the capital letter O; the guide also documents a digit zero form, ^B0.^B8EAN-8 BarcodePrints an EAN-8 barcode, the short form of EAN-13, from seven characters of field data.^B9UPC-E BarcodePrints a UPC-E barcode, the zero-suppressed short form of UPC-A for number system 0, from ten characters of field data.^BACode 93 BarcodePrints a Code 93 barcode, a variable-length continuous symbology that covers 128 ASCII characters through substitute and paired characters.^BKANSI Codabar Bar CodePrints an ANSI Codabar barcode (also called NW-7) of digits and a few control characters, with a chosen start and stop character.^BRGS1 Databar (formerly Reduced Space Symbology)Prints a barcode of the GS1 DataBar family, chosen by a symbology type number, for space-constrained identification.^BFMicroPDF417 BarcodePrints a MicroPDF417 barcode, a stacked two-dimensional code like PDF417 but with narrower row address patterns, in one of 34 row-and-column modes.
ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.