ZPL II Commands Cheat Sheet & Reference
Essential Zebra Programming Language (ZPL II) syntax reference for label dimensions, fonts, boxes, Code 128 barcodes, QR codes, and graphics — test any snippet live.
Clicking opens this template directly in the browser editor.
^XA
^PW812
^LL1218
^CF0,32
^FO40,40^A0N,44,38^FDZPL II COMMANDS CHEAT SHEET^FS
^FO40,95^GB732,4,4^FS
^FO40,120^FD^FO = Field Origin (X,Y in dots)^FS
^FO40,165^FD^A0 = Scalable Font (Orient, H, W)^FS
^FO40,210^FD^GB = Graphic Box (W, H, Border)^FS
^FO40,260^GB732,90,3^FS
^FO65,290^A0N,30,26^FDBOXED CALLOUT USING ^GB732,90,3^FS
^FO40,390^BY3,3,120^BCN,120,Y,N,N^FDCHEATSHEET128^FS
^FO40,570^BQN,2,7^FDQA,https://fastzpl.app/commands/zpl-commands-cheat-sheet/^FS
^FO210,590^A0N,28,24^FD^BQ = QR Code Model 2^FS
^FO210,630^A0N,26,22^FDPREFIX: QA, (AUTO + HIGH ECC)^FS
^XZTechnical Specifications
Why FastZPL is the #1 Choice
Copy-Paste Production Snippets
Every ZPL command includes exact parameter ordering and real 203 DPI coordinate examples.
Live CodeMirror Autocomplete
Launch FastZPL Studio to get syntax highlighting, inline command autocomplete, and sub-30ms visual updates.
Zero Hardware Required
Prototype warehouse, FBA, and carrier templates directly in your browser without a physical Zebra printer on your desk.
Essential Zebra ZPL II Commands Reference Table
| Command | Purpose | Syntax & Production Example |
|---|---|---|
| ^XA / ^XZ | Start / End label format | ^XA ... ^XZ (Mandatory wrapper for every label) |
| ^PW / ^LL | Print Width & Label Length (dots) | ^PW812^LL1218 (4×6" at 203 DPI) or ^PW1200^LL1800 (300 DPI) |
| ^LH | Label Home origin offset (x,y) | ^LH0,0 (Resets top-left margin to 0,0 dots) |
| ^FO | Field Origin (position in dots) | ^FO50,100 (50 dots from left, 100 dots from top) |
| ^A0 / ^CF | Scalable Font / Default Font | ^A0N,40,35 (Normal orientation, 40h × 35w) / ^CF0,30 |
| ^FD / ^FS | Field Data & Field Separator | ^FDTRACKING 1Z999^FS (Every ^FD must close with ^FS) |
| ^FB | Field Block (word wrap & align) | ^FB700,3,0,C,0 (700 dots wide, max 3 lines, Centered) |
| ^GB | Graphic Box / Divider Line | ^GB712,4,4^FS (Horizontal line) or ^GB300,120,3^FS (Box) |
| ^BY | Barcode Default Module Width | ^BY3,3,130 (3-dot narrow bar, 3:1 ratio, 130-dot height) |
| ^BC | Code 128 Linear Barcode | ^BCN,130,Y,N,N^FD1Z99999990^FS (With text below) |
| ^BQ | QR Code 2D Barcode (Model 2) | ^BQN,2,7^FDQA,https://fastzpl.app^FS (QA, prefix required) |
| ^GF | Graphic Field (Bitmap / Logo) | ^GFA,totalBytes,totalBytes,bytesPerRow,<hex/RLE data>^FS |
Understanding ZPL II dot coordinates (203 DPI vs 300 DPI math)
Unlike CSS or PDF points, ZPL II positions every element strictly in physical printhead dots. At standard 203 DPI (8 dots/mm), 1 inch equals ~203 dots, so a 4×6" shipping label spans 812 × 1218 dots. At 300 DPI (12 dots/mm), the same 4×6" label spans 1200 × 1800 dots. Always verify your target printer DPI before calculating ^FO, ^PW, and ^LL coordinates.
Best practices for clean, bug-free ZPL templates
Always terminate every field with ^FS, set explicit ^PW and ^LL dimensions near the top of your ^XA block, and place ^BY right before linear barcodes so earlier commands do not bleed into your bar width. Use FastZPL's built-in inch/mm/dot rulers to confirm quiet zones around ^BC and ^BQ barcodes before deploying templates to production.
Frequently Asked Questions
What is the difference between ^FO and ^FT in ZPL II?
^FO (Field Origin) anchors an element from its top-left corner relative to ^LH, whereas ^FT (Field Typeset) anchors text from its baseline (bottom-left). ^FO is recommended for predictable cross-engine layouts.
How do I wrap long multi-line addresses in ZPL?
Place ^FB (Field Block) right before ^FD, for example ^FO50,120^A0N,28,24^FB700,3,4,L,0^FDLong Address Line...^FS. This wraps text automatically at 700 dots across up to 3 lines.
How do I print a horizontal divider line or border box in ZPL?
Use ^GB (Graphic Box): ^FO50,200^GB712,4,4^FS draws a 4-dot thick horizontal line 712 dots wide, while ^FO20,20^GB772,1178,4^FS draws an outer border around a 4×6" label.