zpl.tools
Format control

^XA - Start Format

Begins a label format.

^XA opens a label format. Everything between it and the matching ^XZ describes one label, and a printer does not act on a field until the pair closes. ^XA does not give a clean slate: it opens a format, and it does not reset the printer. Anything a previous format set — the current font, the bar code defaults, the caret and tilde characters — stays in force.

Syntax

^XA

Alternate form: 0x02.

Support

Supportedparsed: full · state: full · rendered: full

Every documented parameter renders the same output Labelary produces.

Labelary renders this command.

Parameters

^XA takes no arguments.

Behavior

The parser still reads commands outside an ^XA^XZ pair. That is the point of the control commands: ~CC, ~CD, ~JA and their kind belong between formats. Format commands such as ^FO and ^FD need the brackets, because they describe a label that must exist first.

Format-level state carries over from one label to the next, and readers most often assume it away. In this renderer and on Labelary alike, ^CFA,60 in one format still sizes the text of the following format, and ^BY5 still widens the following format's bar codes (measured 2026-07-30). The prefix and delimiter changes from ^CC, ^CT and ^CD persist the same way. In a stream of labels, set every dependency inside each pair rather than trust the state the previous label left.

An empty format, ^XA^XZ, renders no page at all rather than a blank one. Both renderers agree on that, so a label whose entire layout came from an unimplemented command can come back as zero pages rather than as a blank sheet.

Tested behavior

Differences from the specification

zpl.tools against the ZPL II guide

Where our renderer behaves differently from the specification.

  • The guide does not state what a second ^XA before the matching ^XZ does. The renderer restarts the label and discards everything drawn so far, as a printer does with a truncated format. We measured this on 2026-07-30; Labelary behaves the same way. — pinned by test_xa_overrides_printable_input

Example

A minimal format: one text field and a rule beneath it.

^XA
^FO50,50^A0N,40,40^FDHello World^FS
^FO50,110^GB300,3,3^FS
^XZ

Open in viewer