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 visorGenerador
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ámetro | Qué hace | Valores |
|---|---|---|
^BX o | Orientación | N, R, I, B |
^BX h | Module size: dots per square | 1 up to the label width |
^BX s | Corrección de errores | 200 (ECC 200); 0 to 140 are the legacy levels |
^BX c, r | Columns and rows | empty = the smallest symbol that fits the data |

^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:
| Datos | Symbol | Module size | Tamaño en puntos |
|---|---|---|---|
OZ-2026-0042 (12 characters) | 14 × 14 | 4 | 56 × 56 |
OZ-2026-0042 | 14 × 14 | 8 | 112 × 112 |
OZ-2026-0042, columns and rows set to 22 | 22 × 22 | 8 | 176 × 176 |
https://openzpl.com/barcodes/data-matrix/ (41 characters) | 24 × 24 | 5 | 120 × 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)

^XA ^FO60,40^BXN,8,0 ^FDOZ-2026-0042^FS ^XZ
^BXN,8,200 (ECC 200)

^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.