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
| Command | Syntax | What it does |
|---|---|---|
^XA | ^XA | Start of a label format. Every label begins with this command. |
^XZ | ^XZ | End of a label format. The printer renders and prints the label when it receives this. |
^FX | ^FXcomment | Comment — ignored by the printer. End it with ^FS like any field. |
^PW | ^PWwidth | Print width in dots. Set this to your label width so fields are not clipped. |
^LL | ^LLlength | Label length in dots. Needed mainly for continuous (non-gap) media. |
^LH | ^LHx,y | Label home — shifts the origin for all subsequent ^FO positions. |
^PQ | ^PQqty | Print quantity — how many copies of this label to print. |
^PR | ^PRspeed | Print rate (speed) in inches per second. Slower often prints darker and sharper. |
^MD | ^MDdarkness | Media darkness adjustment, -30 to 30. Raise it if print is faint. |
Fields and text
| Command | Syntax | What it does |
|---|---|---|
^FO | ^FOx,y | Field origin — position the next field at x,y dots from the label home. |
^FD | ^FDdata | Field data — the content (text or barcode data) of the current field. |
^FS | ^FS | Field separator — closes the current field. Required after each field. |
^FB | ^FBwidth,lines,space,align | Field block — wraps ^FD text into a block: max width, max lines, line spacing, alignment (L/C/R/J). |
^FR | ^FR | Field reverse — prints the field white-on-black where it overlaps a black area. |
^FH | ^FH | Field hexadecimal — allows _xx hex escapes in ^FD, e.g. _C3_A9 for é. |
^CI | ^CIencoding | Character set; ^CI28 selects UTF-8 and is recommended for any non-ASCII text. |
Fonts
| Command | Syntax | What it does |
|---|---|---|
^A | ^Afo,h,w | Font 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,w | Change default font for all following fields that do not set their own ^A. |
^A@ | ^A@o,h,w,name | Use 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
| Command | Syntax | What it does |
|---|---|---|
^BY | ^BYw,r,h | Barcode 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,m | Code 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,g | Code 39 — older 1D symbology still required by some industrial and defense specs. |
^BE | ^BEo,h,f,g | EAN-13 retail barcode (use ^BU for UPC-A). |
^BQ | ^BQa,model,mag,ec | QR 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,f | Data Matrix — compact 2D code common on electronics and healthcare labels. |
^B7 | ^B7o,h,m,c,r,t | PDF417 — 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
| Command | Syntax | What it does |
|---|---|---|
^GB | ^GBw,h,t,c,r | Graphic box: width, height, border thickness, color (B/W), corner rounding 0–8. A thin ^GB is how you draw lines. |
^GC | ^GCd,t,c | Graphic circle with diameter d and border thickness t. |
^GD | ^GDw,h,t,c,o | Graphic diagonal line inside a w×h box; o sets the direction (L or R). |
^GF | ^GFa,b,c,d,data | Graphic field — embeds a bitmap (e.g. a logo) directly in the label as hex or binary data. |
~DG | ~DGd:name,t,w,data | Download graphic — store an image on the printer, then place it with ^XG. |
^XG | ^XGd:name,mx,my | Recall a stored graphic at the current field origin, with x/y magnification. |
Printer control and status
| Command | Syntax | What it does |
|---|---|---|
~HS | ~HS | Host status — the printer replies with paper-out, pause, buffer and odometer info. |
~HI | ~HI | Host identification — model, firmware version, DPI and memory. |
^MM | ^MMmode | Print mode: T tear-off, P peel-off, R rewind, C cutter. |
^MN | ^MNtype | Media tracking: Y gap/web sensing, M black-mark, N continuous. |
~JC | ~JC | Run media calibration (the printer feeds a few labels to find the gap). |
~JA | ~JA | Cancel all label formats in the printer buffer. |
^JUS | ^JUS | Save 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
^XZHand-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.