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.
Mis à jour le 2026-10-20 · Renders made with the OpenZPL engine
Open in the viewerGenerator
4 × 2 in label at 203 dpi. A preview shows how the printer draws the code; confirm with a scanner before printing a run.
The ^BX command
| Paramètre | Ce que cela fait | Valeurs |
|---|---|---|
^BX o | Orientation | N, R, I, B |
^BX h | Module size: dots per square | 1 up to the label width |
^BX s | Error correction | 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
Size in dots
The printer picks the smallest symbol that fits the data, and the module size scales it. Measured on OpenZPL renders at 203 dpi:
| Data | Symbol | Module size | Size in dots |
|---|---|---|---|
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
Valid and invalid data
- 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.
Check a barcode before printing a run
A preview shows how the printer will draw the code: bar widths, quiet zone and the human-readable line. It does not prove that every scanner reads it on your media. Print one label at the real density and scan it with the scanner your customer or carrier uses; for retail and logistics codes, a barcode verifier grades the print quality.
Questions
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.