zpl.tools

ZPL Commands Reference

Reference for every Zebra Programming Language (ZPL) II command, with renderer support status

ZPL Commands Reference

Every command in Labelary's command table has a page here, with its syntax, its full parameter table, a rendered example, and the measured differences between the renderer, Labelary and the specification.

Documentation is not support: the renderer implements the most-used subset. Renderer support states what renders today, and how the renderer reports an unsupported command.

Renderer support

The renderer behaves like a physical Zebra printer. It renders best-effort, and never fails a label because of a command it does not implement. It also reports every ignored command and silent default as a diagnostic. The diagnostic appears inline in the online viewer and the desktop app, and in the X-Warnings header on the API.

Renders today (verified against the engine):

  • label structure and fields (^XA ^XZ ^FS ^FX ^FO ^FT ^FB ^FD ^FV ^FH ^FR ^FW)
  • fonts and text (^A ^CF, ^CI partially)
  • barcodes (^BY ^BC Code 128 / GS1-128, ^B2 Interleaved 2-of-5, ^B3 Code 39, ^B7 PDF417, ^BQ QR Code, ^BX Data Matrix, ^BD MaxiCode)
  • graphics (^GB ^GF ~DG ^XG ^ID)
  • layout (^LH ^PW ^CC ^CT)

Everything else falls into two buckets, one per diagnostic code on the diagnostics reference:

  • Recognized but not implemented — documented ZPL that changes the rendered label, and that the renderer does not implement yet: for example ^PM (print mirror image). The renderer ignores it and reports warning severity, which reaches the API's X-Warnings header:

    UNSUPPORTED_COMMAND: command "^PM" is valid ZPL but is not supported by this renderer yet; it was skipped
  • Recognized and intentionally ignored — commands that cannot affect a rendered label at all. The set covers printer, job, device and network configuration, host status queries, sensor calibration, and RFID, for example ^PR, ^MM and ^MN. Labelary ignores the same set. These commands report IGNORED_COMMAND at info severity, which does not reach X-Warnings. The skip policy gives the full list and the reasons.

The renderer reports anything that is not ZPL (a typo, wrong case) as:

UNKNOWN_COMMAND: This ZPL command does not exist and was ignored

Quick start commands

The first ZPL commands to learn:

Command categories

The reference has 231 commands in 16 categories. The sidebar links to every command page. Each category below links to its section of the command support matrix, which gives the per-command status and a note wherever the renderer differs.

"Renders" counts commands that draw something: supported plus partial. "Ignored" counts commands that cannot affect a rendered label. The renderer and Labelary both ignore them. "Not yet" counts planned plus unsupported.

Common command patterns

The three blocks below are annotated, not runnable. ZPL has no comment syntax, so a printer reads everything after # as field data and warns about the rest. For runnable examples, use any command page.

Basic label structure

^XA                    # Start format
^FO50,50              # Position at (50,50)
^ADN,50,50            # Font: Arial, Normal, 50x50
^FDHello World^FS     # Data and separator
^XZ                   # End format

With barcodes

^XA
^FO50,50
^BCN,100,Y,N,N        # Code 128 barcode
^FD123456789^FS
^FO50,200
^ADN,40,40
^FDProduct Code^FS
^XZ

With multiple fields

^XA
^LH0,0                # Label home
^LL812                # Label height
^FO50,50
^ADN,50,50
^FDField 1^FS
^FO50,150
^ADN,40,40
^FDField 2^FS
^XZ

Parameter notation

Throughout ZPL documentation:

  • Required parameters must have a value
  • Optional parameters can be absent
  • Comma delimiters separate parameters
  • Trailing commas are optional with the defaults

Orientation values

For fields and bar codes:

  • N = Normal (0°)
  • R = Rotated 90° clockwise
  • I = Inverted 180°
  • B = Read from bottom up (270°)

Device designations

Storage locations:

  • R: = RAM (volatile memory)
  • E: = Permanent storage (EPROM, Flash)
  • B: = Optional memory (Flash card)
  • A: = All memory devices

Quick access by use case

Build a label

  1. Start with ^XA (Start Format)
  2. Set label dimensions with ^LL and ^LH
  3. Position with ^FO
  4. Select font with ^A or ^CF
  5. Add text with ^FD and ^FS
  6. End with ^XZ (End Format)

Add a barcode

  • Code 128: ^BC
  • Code 39: ^B3
  • QR Code: ^BQ
  • Data Matrix: ^BX
  • Set size with ^BY

Work with graphics

  • Store images: ~DG
  • Recall images: ^XG
  • Draw shapes: ^GB, ^GC
  • Inline bitmap: ^GF

Printer control

  • Print quantity: ^PQ
  • Print speed: ^PR
  • Media type: ^MT
  • Print mode: ^MM

Troubleshoot and set up

  • Configuration: ~WC (Print Configuration Label)
  • Memory status: ~HM
  • Reset printer: ~JR
  • Calibrate sensors: ~JC

Tips and best practices

  1. Always end with ^XZ - Every label format must end with this command
  2. Position before content - Use ^FO before ^FD and barcode commands
  3. Set fonts early - Use ^A or ^CF at the beginning to avoid repetition
  4. Test before production - Verify labels look correct before large print jobs
  5. Use comments - Add ^FX comments to document complex formats
  6. Consider reuse - Use ^DF to store frequently used formats
  7. Optimize for speed - Minimize command size for faster transmission
  8. Check memory - Use ~HM to verify available memory before large downloads
  9. Validate codes - Enable code validation with ^CV for quality assurance
  10. Document configuration - Print configuration labels with ~WC for reference