ZPL Command Reference — Cheat Sheet for Zebra Printers

Updated June 11, 2026

This is a working reference for the ZPL II commands that cover the vast majority of real labels: format structure, text, fonts, barcodes, graphics and printer control. All positions and sizes are in printer dots (203 dpi = 8 dots/mm — see What is ZPL? for the basics). Parameters shown in the syntax column are: x,y = position from the top-left corner, h,w = height and width, o = orientation (N normal, R 90°, I 180°, B 270°).

Label format

CommandSyntaxWhat it does
^XA^XAStart of a label format. Every label begins with this command.
^XZ^XZEnd of a label format. The printer renders and prints the label when it receives this.
^FX^FXcommentComment — ignored by the printer. End it with ^FS like any field.
^PW^PWwidthPrint width in dots. Set this to your label width so fields are not clipped.
^LL^LLlengthLabel length in dots. Needed mainly for continuous (non-gap) media.
^LH^LHx,yLabel home — shifts the origin for all subsequent ^FO positions.
^PQ^PQqtyPrint quantity — how many copies of this label to print.
^PR^PRspeedPrint rate (speed) in inches per second. Slower often prints darker and sharper.
^MD^MDdarknessMedia darkness adjustment, -30 to 30. Raise it if print is faint.

Fields and text

CommandSyntaxWhat it does
^FO^FOx,yField origin — position the next field at x,y dots from the label home.
^FD^FDdataField data — the content (text or barcode data) of the current field.
^FS^FSField separator — closes the current field. Required after each field.
^FB^FBwidth,lines,space,alignField block — wraps ^FD text into a block: max width, max lines, line spacing, alignment (L/C/R/J).
^FR^FRField reverse — prints the field white-on-black where it overlaps a black area.
^FH^FHField hexadecimal — allows _xx hex escapes in ^FD, e.g. _C3_A9 for é.
^CI^CIencodingCharacter set; ^CI28 selects UTF-8 and is recommended for any non-ASCII text.

Fonts

CommandSyntaxWhat it does
^A^Afo,h,wFont for the next field: font letter f (0–9, A–Z), orientation, height and width in dots. ^A0N,40,40 is the scalable default font at 40 dots.
^CF^CFf,h,wChange default font for all following fields that do not set their own ^A.
^A@^A@o,h,w,nameUse a font file stored on the printer (e.g. downloaded TrueType).

Font 0 is the scalable vector font and the usual choice; fonts A–H are fixed-size bitmap fonts that only look right at their native sizes or integer multiples.

Barcodes

CommandSyntaxWhat it does
^BY^BYw,r,hBarcode field defaults: module (narrow bar) width in dots, wide-to-narrow ratio, default height. Set before the barcode command.
^BC^BCo,h,f,g,e,mCode 128 — the workhorse 1D barcode for shipping and logistics. f=Y prints the human-readable line, g=Y prints it above the code.
^B3^B3o,e,h,f,gCode 39 — older 1D symbology still required by some industrial and defense specs.
^BE^BEo,h,f,gEAN-13 retail barcode (use ^BU for UPC-A).
^BQ^BQa,model,mag,ecQR code. Magnification 1–10 sets module size; ec sets error correction (H/Q/M/L). Prefix the data with the encoding mode, e.g. ^FDQA,https://…
^BX^BXo,h,s,c,r,fData Matrix — compact 2D code common on electronics and healthcare labels.
^B7^B7o,h,m,c,r,tPDF417 — stacked 2D code used on IDs and some logistics documents.

For a scannable barcode, get three things right: a module width (^BY first parameter) of at least 2–3 dots at 203 dpi, a quiet zone of ~10 module widths of empty space either side, and enough height (a 1D barcode under ~50 dots is hard for handheld scanners to read).

Graphics

CommandSyntaxWhat it does
^GB^GBw,h,t,c,rGraphic box: width, height, border thickness, color (B/W), corner rounding 0–8. A thin ^GB is how you draw lines.
^GC^GCd,t,cGraphic circle with diameter d and border thickness t.
^GD^GDw,h,t,c,oGraphic diagonal line inside a w×h box; o sets the direction (L or R).
^GF^GFa,b,c,d,dataGraphic field — embeds a bitmap (e.g. a logo) directly in the label as hex or binary data.
~DG~DGd:name,t,w,dataDownload graphic — store an image on the printer, then place it with ^XG.
^XG^XGd:name,mx,myRecall a stored graphic at the current field origin, with x/y magnification.

Printer control and status

CommandSyntaxWhat it does
~HS~HSHost status — the printer replies with paper-out, pause, buffer and odometer info.
~HI~HIHost identification — model, firmware version, DPI and memory.
^MM^MMmodePrint mode: T tear-off, P peel-off, R rewind, C cutter.
^MN^MNtypeMedia tracking: Y gap/web sensing, M black-mark, N continuous.
~JC~JCRun media calibration (the printer feeds a few labels to find the gap).
~JA~JACancel all label formats in the printer buffer.
^JUS^JUSSave current settings to flash so they survive a power cycle.

Putting it together

A typical 4×6 shipping-style label using most of the groups above:

^XA
^PW812
^CI28
^CF0,32

^FO40,40^FDSHIP TO:^FS
^FO40,80^A0N,44,44^FDAcme Industries^FS
^FO40,130^FD500 Warehouse Way^FS
^FO40,170^FDSpringfield, IL 62701^FS

^FO40,230^GB732,3,3^FS

^FO40,260^FDOrder #A-10592 / 3 of 4^FS

^BY3,2,120
^FO140,320^BCN,120,Y,N,N^FD4210159200083^FS
^XZ

Hand-editing dot coordinates gets old quickly — every layout tweak means changing numbers and reprinting. If you would rather drag the fields into place and let the ZPL write itself, the ZPLCraft editor below compiles a visual canvas to exactly this kind of clean ZPL, and can print it from the browser over USB.

For exhaustive parameter-by-parameter detail beyond this cheat sheet, the authoritative source is Zebra’s official ZPL II Programming Guide, available free from Zebra’s support site.