FastZPL
Interactive ZPL II Syntax Guide

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.

100% Client-Side RAM (Zero-Upload)
Instant Sub-30ms Conversion
No 429 Rate Limits
Offline PWA Ready
Vector SVG Pre-render (203 DPI)
1-Bit Crisp
ZPL II COMMANDS CHEAT SHEET ^FO = Field Origin (X,Y in dots) ^A0 = Scalable Font (Orient,H,W) ^GB = Graphic Box (W,H,Border) BOXED CALLOUT USING ^GB732,90,3 CHEATSHEET128 ^BQ = QR CODE MODEL 2 PREFIX: QA, (AUTO + HIGH ECC)
Load in FastZPL Studio & Convert to PDF

Clicking opens this template directly in the browser editor.

ZPL II Source Code
^XA ... ^XZ
^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
^XZ

Technical Specifications

Language Spec
Zebra Programming Language II (ZPL II)
Coordinate Units
Printer Dots (8 dpmm @ 203 DPI, 12 dpmm @ 300 DPI)
Core Delimiters
^XA (Start), ^XZ (End), ^FD (Data), ^FS (Field Sep)
Live Sandbox
1-Click Load into FastZPL CodeMirror Editor

Why FastZPL is the #1 Choice

01

Copy-Paste Production Snippets

Every ZPL command includes exact parameter ordering and real 203 DPI coordinate examples.

02

Live CodeMirror Autocomplete

Launch FastZPL Studio to get syntax highlighting, inline command autocomplete, and sub-30ms visual updates.

03

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

CommandPurposeSyntax & Production Example
^XA / ^XZStart / End label format^XA ... ^XZ (Mandatory wrapper for every label)
^PW / ^LLPrint Width & Label Length (dots)^PW812^LL1218 (4×6" at 203 DPI) or ^PW1200^LL1800 (300 DPI)
^LHLabel Home origin offset (x,y)^LH0,0 (Resets top-left margin to 0,0 dots)
^FOField Origin (position in dots)^FO50,100 (50 dots from left, 100 dots from top)
^A0 / ^CFScalable Font / Default Font^A0N,40,35 (Normal orientation, 40h × 35w) / ^CF0,30
^FD / ^FSField Data & Field Separator^FDTRACKING 1Z999^FS (Every ^FD must close with ^FS)
^FBField Block (word wrap & align)^FB700,3,0,C,0 (700 dots wide, max 3 lines, Centered)
^GBGraphic Box / Divider Line^GB712,4,4^FS (Horizontal line) or ^GB300,120,3^FS (Box)
^BYBarcode Default Module Width^BY3,3,130 (3-dot narrow bar, 3:1 ratio, 130-dot height)
^BCCode 128 Linear Barcode^BCN,130,Y,N,N^FD1Z99999990^FS (With text below)
^BQQR Code 2D Barcode (Model 2)^BQN,2,7^FDQA,https://fastzpl.app^FS (QA, prefix required)
^GFGraphic 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.

Related ZPL Tools & Guides