Basics
What is ZPL? - Structure, Units and the Basic Label
ZPL (Zebra Programming Language) is the printer language used by Zebra and many
What is ZPL? - Structure, Units and the Basic Label
ZPL (Zebra Programming Language) is the printer language used by Zebra and many
other thermal label printers (with ZPL II emulation: CAB, Novexx, …). A label is a
text document made of commands (^ commands and ~ commands).
Label structure
Every label starts with ^XA (start format) and ends with ^XZ (end format):
^XA
^FO50,50^FDHello World^FS
^XZ
^FO50,50- field origin (position) at x=50 dots, y=50 dots^FDHello World- field data (the text to print)^FS- field separator (end of the field)
Units: dots, mm and DPI
All positions and sizes in ZPL are in dots. The physical size depends on the
printer resolution (DPI = dots per inch):
| DPI | dots per mm |
|---|---|
| ----- | ------------- |
| 203 | 8.0 |
| 300 | 11.8 |
| 600 | 23.6 |
dots = mm × DPI / 25.4
Example: 75 mm label at 203 dpi → 75 × 203 / 25.4 = 600 dots wide.
Minimal working example
^XA
^PW600 ; label width in dots (75 mm @ 203 dpi)
^LL400 ; label length in dots (50 mm @ 203 dpi)
^FO50,50^A0N,30,30^FDHello ZplCloud^FS
^XZ
Tips
- Commands are case-insensitive (
^xaworks like^XA). - Unsupported commands are silently ignored by most printers - check the ZPL Linter!
- Always terminate text with
^FS; forgetting it swallows the next command.