zpl.tools
Bar codes

^BU - UPC-A Bar Code

Twelve-digit retail symbology used in North America.

^BU prints a UPC-A symbol, the twelve-digit retail bar code used in North America. It is a subset of ^BE EAN-13: the same twelve digits with a leading zero make a valid EAN-13. The two are therefore interchangeable at the scanner, and ^BU is the command for a label that must match a North American retail specification. ^B9 UPC-E is the compressed form for smaller packages.

Syntax

^BUo,h,f,g,e

Support

Supportedparsed: full · state: full · rendered: full

Every documented parameter renders the same output Labelary produces.

Labelary renders this command.

Parameters

oBar code orientationoptional · one of a set

Rotation of the symbol and interpretation line.

Default
the orientation set by ^FW, which itself defaults to N
Invalid value
discarded, and the default applies. The renderer reports an unrecognized character as invalid, and uses the default.
Test coverage
No documented value is exercised by a test (N, R, I, B). The invalid-value rule is not pinned by a test.
N
No rotation (default)
R
Rotated 90° clockwise
I
Rotated 180°. The symbol reads upside down
B
Rotated 270° clockwise
hBar code heightoptional · dots

Height of the bars, without the interpretation line.

Default
the height set by ^BY, which itself defaults to 10 dots
Accepted range
1 to 9999 dots
Invalid value
clamped to the nearest allowed value. We measured this against live Labelary on 2026-07-12. The renderer clamps an out-of-range value to the violated bound, and does not ignore it.
Test coverage
Bounds pinned: below the minimum (0), above the maximum (10000). No test at the minimum or maximum. The invalid-value rule is not pinned by a test.
fPrint interpretation lineoptional · Y or N

Whether the renderer prints the interpretation line.

Default
Y
Invalid value
discarded, and the default applies. The renderer reports any character except Y or N, and uses the default.
Test coverage
No documented value is exercised by a test (Y, N). The invalid-value rule is not pinned by a test.
Y
Print the text (default)
N
Print the symbol only
gInterpretation line aboveoptional · Y or N

Where the interpretation line sits. It has no effect without that line.

Default
N
Invalid value
discarded, and the default applies. The renderer reports any character except Y or N, and uses the default.
Test coverage
No documented value is exercised by a test (Y, N). The invalid-value rule is not pinned by a test.
Y
Above the symbol
N
Below the symbol (default)
eShow check digitoptional · Y or N

Whether the check digit appears in the interpretation line. The renderer always encodes it.

Default
Y
Invalid value
discarded, and the default applies. The renderer reports any character except Y or N, and shows the check digit.
Test coverage
Values exercised: N. Not exercised: Y. The invalid-value rule is not pinned by a test.
Y
Show it (default)
N
Hide it

Behavior

The field data is exactly eleven digits and not twelve. The twelfth digit of a UPC-A is a mod-10 check digit, and the printer computes it. We measured this against Labelary on 2026-07-30. The printer accepts all twelve digits and recomputes the last one, so ^FD07000021981 and a twelve-digit payload with the same first eleven digits render the same symbol. The printer pads a shorter payload on the left with zeros.

The fifth argument only decides whether the computed check digit appears in the interpretation line. The printer always encodes it.

Zero is not a valid module width for this symbology. The guide also ties the interpretation line's typeface to the module width and the printhead density. On an 8 dot/mm printer a module of 3 dots or more prints the line in OCR-B. A module of 1 or 2 dots prints it in font A. The UPC and EAN symbologies print at full size on 6, 12 and 24 dot/mm printheads, and at 77 per cent on an 8 dot/mm head.

UPC-A has a fixed print ratio, so the ^BY ratio argument has no effect.

The renderer parses ^BU and draws no symbol. It reports a diagnostic and does not default to a text run. ^BE EAN-13 renders and encodes the same GTIN, so the workaround adds a leading zero to the eleven digits and sends twelve digits through ^BE.

Tested behavior

Differences from the specification

zpl.tools against the ZPL II guide

Where our renderer behaves differently from the specification.

  • The guide takes the default orientation from ^FW. The renderer applies ^FW to text fields only. A barcode after ^FWR prints unrotated unless its own o argument rotates it. — not pinned by a test

Example

Eleven digits, with the twelfth computed and shown in the interpretation line as 0 70000 21981 8:

^XA
^FO50,50^BY3
^BUN,80,Y,N,Y
^FD07000021981^FS
^XZ

Open in viewer