zpl.tools
Bar codes

^B2 - Interleaved 2 of 5 Bar Code

Dense numeric symbology that encodes digits in pairs, so the payload must have an even length.

^B2 prints an Interleaved 2 of 5 symbol. The symbology is numeric only and continuous, and it carries data in the spaces as well as the bars. Two digits share five bars and five spaces, which makes it the densest member of the 2 of 5 family and forces an even payload length.

Interleaved 2 of 5 is the symbology behind ITF-14, the carton-level GTIN. Use it on outer packaging. ^BI and ^BJ encode the same digits in approximately twice the width.

Syntax

^B2o,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 32000 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 (33000). 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)
eMod 10 check digitoptional · Y or N

The renderer appends a mod-10 check digit to the encoded data.

Default
N
Invalid value
discarded, and the default applies. The renderer reports any character except Y or N, and adds no check digit.
Test coverage
No documented value is exercised by a test (Y, N). The invalid-value rule is not pinned by a test.
Y
Add the check digit
N
No check digit (default)

Behavior

Every character is five elements, two wide and three narrow. The encoder interleaves characters made entirely of bars with characters made entirely of spaces. It therefore encodes the digits two at a time, and it cannot encode an odd count of digits.

The printer does not reject an odd count. It prepends a zero and encodes the padded value. A payload whose length varies at run time therefore gains a leading digit sometimes, and such a symbol scans one digit longer than expected.

The optional check digit uses the mod-10 scheme and counts towards the digit pairing. It makes an even payload odd, and that payload then takes the padding zero.

Interleaved 2 of 5 has no start or stop character of its own to print, so the interpretation line shows only the digits. It is a two-width symbology, so the ^BY ratio applies over the guide's range of 2.0:1 to 3.0:1. The width of the label limits the field data. For a rotated symbol, the length of the label limits it.

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

Six digits, an even count, with no check digit added:

^XA
^FO50,50^BY3
^B2N,80,Y,N,N
^FD123456^FS
^XZ

Open in viewer