ZPL barcode command examples for Code 128 QR Code and DataMatrix

ZPL Barcode Commands: Field Notes for Code 128, QR Code, Code 39 and DataMatrix

Barcode problems rarely start with the command name. Most failures happen around the command: a module width that is too small for 203 DPI, a quiet zone clipped by a border, a QR payload that became too dense, or a scanner that was tested at a desk instead of on the warehouse floor.

This guide is written for the moment when you already know you need a barcode on a Zebra label, but you want the first printed sample to scan without drama.

Code 128 with ^BC: the everyday workhorse

For shipping, inventory, work orders, and internal IDs, Code 128 is usually the first command to try. Start with a deliberately boring label and preview it before adding logos and extra text.

^XA
^PW812
^LL406
^FO60,60^A0N,32,32^FDTracking ID^FS
^FO60,120^BY2,3,120
^BCN,120,Y,N,N
^FD1Z999AA10123456784^FS
^XZ

The ^BY2,3,120 line sets default barcode width, ratio, and height. If the scanner struggles, do not immediately switch symbology. First test a slightly wider module with ^BY3, then check quiet zones.

QR Code with ^BQN: compact data, generous space

QR codes are forgiving, but not magic. Long payloads create dense symbols. Small modules blur on thermal media. Borders and nearby text can eat into the quiet zone.

^XA
^PW609
^LL406
^FO40,40^BQN,2,6
^FDLA,https://zplpreview.com/zpl-qr-scan-checker^FS
^FO250,92^A0N,28,28^FDScan to verify QR rules^FS
^XZ

Use the ZPL QR Scan Checker when you want a quick review of size, prefix, quiet zone, and payload density.

Code 39 with ^B3: useful, but wider than people expect

Code 39 is simple and still appears in maintenance, asset, and older manufacturing workflows. It is not as compact as Code 128, so give it room.

^XA
^PW609
^LL305
^FO40,50^BY2
^B3N,N,90,Y,N
^FDASSET-20491^FS
^XZ

If the value grows, Code 39 can become too wide quickly. That is a template-design issue, not a printer bug.

DataMatrix with ^BX: small labels and regulated data

DataMatrix is useful for compact part labels and regulated identifiers. It rewards clean data preparation. If you are encoding GS1 data, use the GS1 DataMatrix Helper first so the application identifiers and separators are intentional.

^XA
^PW406
^LL305
^FO40,40^BXN,5,200
^FD01095011015300031726063010LOT42^FS
^FO150,70^A0N,24,24^FDGTIN + LOT^FS
^XZ
Human habit that helps: keep a one-label barcode test file for each symbology you use. When a scanner report arrives, test the simple label first. If the simple label scans, the production template or data changed.

A scanner-ready checklist

  • Preview at the printer DPI, not just a default browser size.
  • Protect quiet zones around every barcode.
  • Use ^BY deliberately; small modules are not a badge of honor.
  • Keep human-readable fallback text for operational labels.
  • Test with the same scanner, label stock, ribbon, distance, and lighting used in production.
  • Use ZPL Barcode Scan Checker before changing printer darkness or speed.

A barcode command is only one line of ZPL. A reliable barcode is a layout, media, scanner, and printer-settings decision. Treat it that way and your labels will fail less often in the only place that matters: the floor.

ZPL Barcode Commands: Field Notes for Code 128, QR Code, Code 39 and DataMatrix | ZPL Blog