Saltar al contenido

Data Matrix codes in ZPL with ^BX

To print a Data Matrix code in ZPL, use ^BXN,{module size},200 and the data: ^FO60,40^BXN,8,200^FDOZ-2026-0042^FS. The second parameter is the size of each square in dots, and 200 selects ECC 200, the error correction that current scanners read.

Actualizado 2026-10-20 · Renderizados hechos con el motor de OpenZPL

Abrir en el visor

Generador

Generando…

Etiqueta de 4 × 2 pulgadas a 203 dpi. Una vista previa muestra cómo la impresora dibuja el código; confirme con un escáner antes de imprimir una serie.

The ^BX command

ParámetroQué haceValores
^BX oOrientaciónN, R, I, B
^BX hModule size: dots per square1 up to the label width
^BX sCorrección de errores200 (ECC 200); 0 to 140 are the legacy levels
^BX c, rColumns and rowsempty = the smallest symbol that fits the data
Data Matrix code for OZ-2026-0042, 112 dots square
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^FO60,40^BXN,8,200
^FDOZ-2026-0042^FS
^XZ

Tamaño en puntos

The printer picks the smallest symbol that fits the data, and the module size scales it. Measured on OpenZPL renders at 203 dpi:

DatosSymbolModule sizeTamaño en puntos
OZ-2026-0042 (12 characters)14 × 14456 × 56
OZ-2026-004214 × 148112 × 112
OZ-2026-0042, columns and rows set to 2222 × 228176 × 176
https://openzpl.com/barcodes/data-matrix/ (41 characters)24 × 245120 × 120

Data Matrix fits a lot in a small square, which is why it is used on small parts and healthcare products. Keep at least 4 dots per module at 203 dpi so the printer can draw each square cleanly.

ECC 200 versus the legacy levels

Use 200. Levels 0 to 140 are an older format; our test code with level 0 rendered, but zxing-cpp, a common open-source decoder, could not read it, and many scanners can't either.

^BXN,8,0 (legacy, not read by our decoder)

The same data with legacy error correction 0, drawn as a different pattern
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^FO60,40^BXN,8,0
^FDOZ-2026-0042^FS
^XZ

^BXN,8,200 (ECC 200)

Data Matrix code for OZ-2026-0042, 112 dots square
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^FO60,40^BXN,8,200
^FDOZ-2026-0042^FS
^XZ

Datos válidos e inválidos

  • Any text, digits or URLs. Escape ^ and ~ with ^FH; see special characters in data.
  • For GS1 Data Matrix (healthcare, some retail), the data needs the FNC1 character and GS1 application identifiers; check the Zebra guide for the escape sequence your printer uses before printing.
  • If you fix columns and rows too small for the data, the printer cannot fit it; leave them empty unless a specification requires a size.

Verifique un código de barras antes de imprimir una tanda

Una vista previa muestra cómo la impresora dibujará el código: anchos de barras, zona muerta y la línea legible por humanos. No prueba que cada escáner lo lea en su medio. Imprima una etiqueta a la densidad real y escáneela con el escáner que utiliza su cliente o transportista; para códigos de venta al por menor y logística, un verificador de códigos de barras califica la calidad de impresión.

Preguntas

Data Matrix or QR code?

Both are 2D codes. Data Matrix is more compact for short data and common in industry; QR codes are what phone cameras expect for URLs. See QR codes in ZPL.

How do I make a Data Matrix code bigger?

Raise the module size, the second parameter of ^BX: ^BXN,10,200.

Fuentes