ZPL Barcode Commands: Code 128, QR Code, Code 39 and DataMatrix
Barcodes are where a pretty label becomes an operational label. If the barcode scans reliably, the warehouse forgives a lot. If it does not, everyone suddenly cares about module width, quiet zones, darkness, and whether somebody copied a Code 39 example for a Code 128 job.
This is a practical tour of the ZPL barcode commands most teams use first. You can generate these blocks with the Barcode Generator, then preview the full label in the ZPL Viewer.
Code 128 with ^BC
Code 128 is the everyday choice for shipping, inventory, and mixed alphanumeric IDs. It is compact and widely supported.
^FO60,80
^BY3
^BCN,120,Y,N,N
^FD1Z999AA10123456784^FS
The ^BY command controls module width. If the barcode looks thin in preview or fails on a real scanner, try changing the width before redesigning the whole label.
QR Code with ^BQ
QR codes are useful for URLs, compact product data, or internal lookup keys. They need enough physical size to survive print quality and phone cameras.
^FO60,80
^BQN,2,6
^FDQA,https://zplpreview.com^FS
The last number in ^BQN,2,6 is magnification. It is easy to make QR codes too small while trying to save label space.
Code 39 with ^B3
Code 39 is older and less dense, but it still appears in maintenance systems and simple asset workflows. It is usually fine for short uppercase values.
^FO60,80
^BY2
^B3N,100,Y,N,N
^FDASSET-1042^FS
DataMatrix with ^BX
DataMatrix is common where space is tight, especially manufacturing and healthcare. It is a good fit for small labels, but you should test the exact printer and scanner combination.
^FO60,80
^BXN,6,200
^FDLOT-2026-05-A17^FS
Barcode checklist before production
- Leave quiet space around the symbol. A border or text block too close to the barcode can break scanning.
- Preview the layout, but test the real scanner too. Thermal darkness and ribbon quality matter.
- Keep human-readable text when operators need to recover from a failed scan.
- For DPI changes, scale barcodes along with coordinates using the DPI Converter.
If you are still hand-writing barcode ZPL, use the generator once and compare the output. Even if you keep your own template, it gives you a known-good command shape.
