Basics

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 ZPL II emulation: CAB, Novexx, … . A label is a…

ZPL (Zebra Programming Language) is the printer language used by Zebra and many other thermal label printers (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):

DPIdots per mm
2038.0
30011.8
60023.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 (^xa works like ^XA).
  • Unsupported commands are silently ignored by most printers – validate with the ZPL Linter first.
  • Always terminate text with ^FS; a missing ^FS swallows the next command.