ZPL commands: reference and cheat sheet
What each ZPL II command does, in plain words, with its syntax. Try any of them in the ZPL viewer.
Download the cheat sheet · Working with another printer language? EPL to ZPL · TSPL to ZPL
Label format
^XA |
Start Format | Opens a label. Everything up to ^XZ is one label. ^XA |
^XZ |
End Format | Closes the label opened by ^XA and prints it. ^XZ |
^PW |
Print Width | Sets the label width in dots. ^PWa (a = width in dots) |
^LL |
Label Length | Sets the label length in dots. ^LLy (y = length in dots) |
^LH |
Label Home | Moves the origin that every field position is measured from. ^LHx,y |
^LS |
Label Shift | Shifts every field left by the given number of dots. ^LSa |
^LT |
Label Top | Moves the whole label up or down by the given number of dot rows. ^LTx |
^PO |
Print Orientation | Prints the label normally (N) or upside down (I). ^POa (N or I) |
^PM |
Print Mirror | Mirrors the whole label horizontally when set to Y. ^PMa (Y or N) |
^PQ |
Print Quantity | Sets how many labels to print; each one counts as a label in the preview. ^PQq,p,r,o |
^MU |
Set Units | Changes the unit of measurement to dots, inches or millimetres. ^MUa,b,c |
^CI |
Change International Encoding | Selects the character set. ^CI28 is UTF-8. ^CIa |
Fields and position
^FO |
Field Origin | Sets the field position: x, y coordinates in dots from the top-left corner. ^FOx,y,z |
^FT |
Field Typeset | Positions a field by its baseline instead of its top-left corner. ^FTx,y,z |
^FD |
Field Data | The text or barcode data of the current field. ^FDa |
^FS |
Field Separator | Ends the current field. ^FS |
^FB |
Field Block | Wraps text into a block with a width, line count and alignment. ^FBa,b,c,d,e |
^FR |
Field Reverse Print | Prints the field white on black over whatever is under it. ^FR |
^FH |
Field Hexadecimal Indicator | Lets ^FD contain hex escapes such as _0D. ^FHa |
^FW |
Field Orientation | Sets the default rotation for the fields that follow. ^FWr (N, R, I or B) |
^FN |
Field Number | Names a variable field in a stored format. ^FN# |
^FX |
Comment | A comment. The printer ignores everything up to the next command. ^FXc |
^SN |
Serialization Data | Prints a number that increments on each label. ^SNv,n,z |
Text and fonts
^A |
Scalable/Bitmapped Font | Selects the font, rotation and size for the next text field. ^Afo,h,w (^A0N,30,30) |
^A@ |
Use Font Name | Selects a font by its file name on the printer. ^A@o,h,w,d:f.x |
^CF |
Change Default Font | Sets the font and size used when a field has no ^A. ^CFf,h,w |
^TB |
Text Blocks | Wraps a text field inside a box of given width and height. ^TBa,b,c |
^CW |
Font Identifier | Assigns a one-letter name to a font file. ^CWa,d:o.x |
Barcodes
^BY |
Bar Code Field Default | Sets module width, wide-to-narrow ratio and height for the barcodes that follow. ^BYw,r,h |
^BC |
Code 128 | Code 128 barcode, the most common one on shipping labels. ^BCo,h,f,g,e,m |
^B3 |
Code 39 | Code 39 barcode. ^B3o,e,h,f,g |
^B2 |
Interleaved 2 of 5 | Interleaved 2 of 5 barcode, numeric only. ^B2o,h,f,g,e |
^BE |
EAN-13 | EAN-13 retail barcode. ^BEo,h,f,g |
^B8 |
EAN-8 | EAN-8 retail barcode. ^B8o,h,f,g |
^BU |
UPC-A | UPC-A retail barcode. ^BUo,h,f,g,e |
^B9 |
UPC-E | UPC-E retail barcode. ^B9o,h,f,g,e |
^BQ |
QR Code | QR Code. The field data starts with the error correction level and input mode, as in ^FDQA,text. ^BQa,b,c,d,e |
^BX |
Data Matrix | Data Matrix 2D barcode. ^BXo,h,s,c,r,f,g,a |
^B7 |
PDF417 | PDF417 stacked 2D barcode. ^B7o,h,s,c,r,t |
^BO |
Aztec | Aztec 2D barcode. ^BOa,b,c,d,e,f,g |
^BD |
MaxiCode | MaxiCode, used by UPS. ^BDm,n,t |
^B0 |
Aztec (alias) | Aztec 2D barcode; the same command as ^BO. ^B0a,b,c,d,e,f,g |
^BA |
Code 93 | Code 93 barcode: denser than Code 39, with two built-in check characters. ^BAo,h,f,g,e |
^BK |
ANSI Codabar | Codabar barcode, used by libraries, blood banks and some couriers. ^BKo,e,h,f,g,k,l |
^BL |
LOGMARS | LOGMARS barcode, the US military's Code 39 with a mandatory check digit. ^BLo,h,g |
^B1 |
Code 11 | Code 11 barcode, numeric, used on telecom equipment. ^B1o,e,h,f,g |
^BM |
MSI | MSI (Modified Plessey) barcode, numeric, used on shelf labels. ^BMo,e,h,f,g,e2 |
^BP |
Plessey | Plessey barcode, numeric, with a CRC check digit. ^BPo,e,h,f,g |
^BS |
UPC/EAN Extensions | The 2- or 5-digit add-on printed next to a UPC or EAN code. ^BSo,h,f,g |
^BZ |
POSTAL | US postal barcodes: POSTNET, PLANET and Intelligent Mail. ^BZo,h,f,g,t |
^B5 |
Planet Code | USPS PLANET barcode. ^B5o,h,f,g |
^BR |
GS1 DataBar | GS1 DataBar (formerly RSS): compact GTIN barcodes for produce and coupons. ^BRa,b,c,d,e,f |
^BF |
MicroPDF417 | MicroPDF417, a smaller PDF417 for little labels. ^BFo,h,m |
Graphics
^GB |
Graphic Box | Draws a box or a line: width, height, border thickness, colour and rounding. ^GBw,h,t,c,r |
^GC |
Graphic Circle | Draws a circle: diameter, border thickness and colour. ^GCd,t,c |
^GE |
Graphic Ellipse | Draws an ellipse. ^GEw,h,t,c |
^GD |
Graphic Diagonal Line | Draws a diagonal line. ^GDw,h,t,c,o |
^GF |
Graphic Field | Embeds a bitmap image in the label (ASCII hex, binary or Z64). ^GFa,b,c,d,data |
^GS |
Graphic Symbol | Prints a registered, copyright or other symbol. ^GSo,h,w |
Stored formats and images
^DF |
Download Format | Stores the label format on the printer under a name. ^DFd:o.x |
^XF |
Recall Format | Recalls a stored format to fill its ^FN fields. ^XFd:o.x |
~DG |
Download Graphic | Stores an image on the printer under a name. ~DGd:o.x,t,w,data |
^XG |
Recall Graphic | Prints an image stored with ~DG. ^XGd:o.x,mx,my |
^IM |
Image Move | Prints a stored image at the current field origin. ^IMd:o.x |