zpl.tools
Bar codes

^BK - ANSI Codabar Bar Code

Numeric symbology with four selectable start and stop characters, still seen in libraries and blood banks.

^BK prints an ANSI Codabar symbol, also called USD-4, NW-7 and 2 of 7 Code. Its makers built it for retail price labels, and it survives in libraries, blood banks and overnight parcel systems. In those systems the four selectable start and stop characters state which kind of number the symbol carries.

That convention is the only reason to choose Codabar over ^B3 Code 39, which encodes the same digits and has better support.

Syntax

^BKo,e,h,f,g,k,l

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
eCheck digitoptional · Y or N

For backward compatibility only. N is the only accepted value.

Default
N
Invalid value
discarded, and the default applies. The renderer reports any value except N, and adds no check digit.
Test coverage
No documented value is exercised by a test (N). The invalid-value rule is pinned by 1 test.
N
No check digit (default)
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)
kStart characteroptional · one of a set

Codabar carries its start and stop characters in the symbol. ZPL passes them as arguments rather than in the field data.

Default
A
Invalid value
discarded, and the default applies. The renderer reports any character outside A-D, and uses A.
Test coverage
Values exercised: A, B, C, D. The invalid-value rule is pinned by 1 test.
A
Start character A (default)
B
Start character B
C
Start character C
D
Start character D
lStop characteroptional · one of a setnot honoured by zpl.tools

The stop character. The same four characters apply.

Default
A
Invalid value
discarded, and the default applies. The renderer reports any character outside A-D, and uses A.
Test coverage
Values exercised: D. Not exercised: A, B, C. The invalid-value rule is not pinned by a test.
A
Stop character A (default)
B
Stop character B
C
Stop character C
D
Stop character D

Behavior

The guide describes the character set as the digits and the control characters for start and stop. Each character is seven elements, four bars and three spaces.

The start and stop characters make Codabar unusual. They are part of the symbol and not of the data, and ZPL takes them as the sixth and seventh arguments, not in the field data. Both characters print in the interpretation line, one on each side of the payload. We measured this against Labelary on 2026-07-30. ^BKN,N,80,Y,N,A,C with ^FD12345678 prints A12345678C.

The check-digit argument exists only for backward compatibility. N is the only value the guide accepts, and the printer never adds a check digit. Error detection in Codabar belongs to the reader configuration and not to the symbol.

Codabar 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, or its length for a rotated symbol.

The renderer parses ^BK and draws no symbol. It reports a diagnostic and does not default to a text run. A line of digits where a bar code belongs looks correct in a preview and scans nowhere. The parser also stops after the start character and does not read the stop character. Until the renderer supports ^BK, ^B3 Code 39 is the closest symbology that renders.

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

Start character A, stop character C, and a numeric payload:

^XA
^FO50,50^BY3
^BKN,N,80,Y,N,A,C
^FD12345678^FS
^XZ

Open in viewer