ZPLToolkit

^BC

Code 128 Bar CodePreview: partial

Draws a Code 128 barcode — the symbology almost every shipping label uses for tracking numbers.

Syntax

^BCo,h,f,g,e,m

Parameters

ParameterDescription and accepted valuesIf omitted
oRotation of the barcode.N normal, R 90°, I 180°, B 270°Last ^FW value, else N
hBar height in dots, overriding ^BY for this field.1 to 32000 dotsHeight set by ^BY
fPrint the human-readable interpretation line.Y or N — print the human-readable lineY
gPrint that line above the barcode rather than below it.Y or N — put that line above the barsN
eAdd a UCC check digit.Y or N — add a UCC check digitN
mEncoding mode. D is UCC/EAN-128 for GS1 data.N none, U UCC case, A automatic, D UCC/EANN

How it works

^BC produces a Code 128 barcode from the data in the following ^FD. It is the default choice for carrier tracking numbers because it encodes the full ASCII set and packs digits two per symbol character, which keeps long numeric codes compact.

The height parameter overrides the default set by ^BY for this field. The interpretation line — the human-readable digits — is printed below the bars by default, and the third and fourth parameters control whether it appears at all and whether it moves above the symbol.

Mode D switches to UCC/EAN-128 for GS1 data, where the payload is wrapped in application identifiers. Mode A lets the printer choose subsets automatically, which usually produces a slightly narrower symbol than the explicit encoding.

Example

ZPL
^XA
^BY3,3,90
^FO60,60^BCN,90,Y,N,N^FDZPLTOOLKIT^FS
^XZ

Rendering…

A Code 128 symbol with its interpretation line, at module width 3.
Open in the viewer

How the preview on this site handles it

Drawn with a real Code 128 encoder, so the preview scans. Height, module width and the interpretation line are honoured. Rotation is not applied, and the UCC check digit and mode D wrapping are not yet reproduced.

Common mistakes

  • Placing the barcode too close to the label edge. Code 128 needs a quiet zone of about 10 module widths on each side or scanners fail on it.
  • Leaving the default module width at a high resolution, which produces a symbol far narrower than the scanner expects.
  • Assuming the interpretation line is part of the height. The bars are h dots tall and the text is drawn below that, so the field is taller than h.

See also