zpl.tools
Bar codes

^B8 - EAN-8 Bar Code

Eight-digit retail symbology for small packages, the short form of EAN-13.

^B8 prints an EAN-8 symbol, the short form of EAN-13 for packages too small for the full thirteen digits. It is a GS1 retail symbology, and GS1 must allocate the number as an EAN-8. An EAN-8 is not a truncation of an existing EAN-13. Use ^BE EAN-13 or ^BU UPC-A for a pack that is not a small retail pack.

Syntax

^B8o,h,f,g

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
Values exercised: 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
Values exercised: 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
Values exercised: Y, N. The invalid-value rule is not pinned by a test.
Y
Above the symbol
N
Below the symbol (default)

Behavior

The field data is exactly seven digits. The eighth digit of an EAN-8 is a mod-10 check digit, the printer computes it, and the field data never contains it.

The printer pads a shorter payload on the left with zeros. We measured this against Labelary on 2026-07-30. ^FD12345 prints 0012345 and the computed check digit. The printer also accepts eight digits and recomputes the eighth, so ^FD12345670 and ^FD1234567 render the same symbol.

Do not rely on a payload longer than eight digits. Check the length before the label is built.

JAN-8 is the Japanese application of EAN-8 and the same symbology. Its first two non-zero digits sent to the printer are always 49.

EAN-8 has a fixed print ratio, so the ^BY ratio argument has no effect and only the module width and the height apply. The printer prints the interpretation line in the split retail layout, with each half of the number under its own half of the symbol.

Known issues

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
  • The eighth digit is a check digit that the renderer computes from the first seven. The renderer ignores an eighth digit in ^FD, so a payload with a wrong check digit prints as the corrected symbol instead of a rejection. — pinned by test_b8_payload_with_check_digit_decodes, test_ean_8_reports_a_supplied_check_digit_that_disagrees

zpl.tools against Labelary

Where our output differs from Labelary for the same input. These are the differences that break a migration.

  • A payload longer than eight digits keeps its rightmost eight. This is the guide's left truncation applied to the data-plus-check form. Labelary drops the first five characters instead. On Labelary, ^FD123456789 prints 00067898. That rule fits no reading of the guide, so the renderer does not reproduce it. The two engines encode different articles for the same field data. — not pinned by a test

Example

Seven digits, with the eighth computed. The interpretation line reads 1234 5670:

^XA
^FO50,50^BY3
^B8N,80,Y,N
^FD1234567^FS
^XZ

Open in viewer