Glossary Term

Data Matrix Code

glossary data matrix code featured

A Data Matrix code is a two-dimensional barcode that stores data as a grid of dark and light square modules. It is defined by ISO/IEC 16022 and is built for marking small items, because it needs a smaller grid than a QR code for the same data. It has no corner squares. An L-shaped border tells the scanner where the code is.

How a Data Matrix Code Is Built

Every Data Matrix symbol has four borders and a data area. Two adjacent borders form a solid “L” (the finder pattern) that locates and orients the code. The two opposite borders alternate dark and light modules (the timing pattern), which tells the scanner how many rows and columns to expect. Data and error correction codewords fill the interior.

The current format, ECC 200, uses Reed-Solomon error correction. Older ECC 000 to 140 versions used a different method, and ISO/IEC 16022 says they should only be used in closed applications. QR codes let you pick a correction level (L, M, Q or H). A Data Matrix symbol does not: the correction amount comes with the symbol size.

Data Matrix Sizes and Capacity

Data Matrix grids always have an even number of rows and columns. Three size families exist:

  • Square: 24 sizes from 10 x 10 to 144 x 144 modules.
  • Rectangular: 8 x 18 up to 16 x 48 modules.
  • Rectangular extension (DMRE): more rectangular sizes, such as 8 x 48 and 26 x 40, defined separately in ISO/IEC 21471.

At 144 x 144 the largest square holds 3,116 digits, 2,335 uppercase letters, or about 1,556 binary bytes. In the test below, zxing-cpp 3.1.1 reached the first two exactly and managed 1,553 random binary bytes. A QR code (Version 40) holds up to 7,089 digits, more than twice as many.

Data Matrix vs QR Code

Data Matrix wins on footprint for short payloads. QR wins on capacity and phone support. The same payloads were encoded both ways, with QR at level M (grids are identical at level L).

Payload Data Matrix grid Modules QR grid Modules Data Matrix as share of QR
10 digits 12 x 12 144 21 x 21 (V1) 441 33%
20-character link 18 x 18 324 25 x 25 (V2) 625 52%
24-character URL 20 x 20 400 25 x 25 (V2) 625 64%
83-character tagged URL 26 x 40 1,040 37 x 37 (V5) 1,369 76%

The advantage shrinks as the payload grows. The 26 x 40 grid is a rectangular extension size the encoder chose on its own. Segno 1.6.6 built the QR codes. zxing-cpp built the Data Matrix codes.

Both decoded at 1 pixel per module in this clean digital test, so the gap shows up in print size, not in this reading limit.

How Much Damage a Data Matrix Code Survives

A Data Matrix code survives a lot of interior damage but none at the borders. A random square was blanked inside the 83-character code (40 trials per row). The QR codes use the same payload at each correction level.

Area blanked Data Matrix, interior only Data Matrix, anywhere QR level M QR level Q QR level H
5% 40/40 33/40 33/40 36/40 36/40
10% 40/40 31/40 20/40 35/40 36/40
15% 9/40 6/40 0/40 32/40 34/40
20% 0/40 0/40 0/40 3/40 26/40

The grids differ (1,040 modules for Data Matrix, 1,369 to 2,401 for QR), and each percentage is of that code’s own area. The “anywhere” column is lower because a patch sometimes lands on a border. The borders hold 12.3% of this symbol’s modules.

A separate check on a 20 x 20 code blanked each of the four borders in turn. None decoded. Flipping one module in the timing edge also broke the read. Flipping one in the solid edge did not. This was one trial per case, so treat it as an illustration.

Where Data Matrix Codes Are Used

Data Matrix codes mark things too small or too rough for a label. Wikipedia notes that the US Electronic Industries Alliance recommends them for small electronic components. The code can be applied directly to metal parts by laser, dot-peen, inkjet or chemical etching, which is common in aerospace.

In retail and healthcare, GS1 DataMatrix carries structured product data. A typical string holds a product number, expiry and lot:

(01)09520123456788(17)271231(10)LOT42

GS1 supports it as one of two 2D barcodes for retail, alongside the QR route covered in GS1 Digital Link.

Can a Phone Scan a Data Matrix Code?

Support varies, and no official Apple or Google documentation was found. A developer on Apple’s own forums reported that a Data Matrix code was not detected by the Camera app, while a handheld reader read it fine. Third-party apps and SDKs such as Scandit’s read it. Test on the devices your audience uses before printing.

Data Matrix Code Quiet Zone

A Data Matrix code needs a blank margin. On a black background, a 20 x 20 code with no margin failed to decode in zxing-cpp, while margins of 1, 2 and 4 modules read. The width the standard requires was not confirmed here, so follow the specification your printer or label software uses.

Frequently Asked Questions

What is a Data Matrix code?

A Data Matrix code is a square or rectangular 2D barcode made of dark and light modules, with an L-shaped finder border. It holds up to 3,116 digits. It is common on small electronic parts, metal components and healthcare products.

What is the difference between Data Matrix and QR code?

Data Matrix is more compact for short data, and QR holds more. In the test above, 10 digits needed 144 modules in Data Matrix and 441 in QR. QR has three corner squares and four selectable correction levels, while Data Matrix has an L-shaped border and fixed correction. Phone cameras are built around QR.

Is a Data Matrix code a 2D barcode?

Yes. A 2D barcode stores data across both rows and columns, unlike a 1D barcode, which stores it in one line of bars. QR code, Data Matrix, Aztec Code and PDF417 are all 2D barcodes. Data Matrix and QR are matrix codes, while PDF417 is stacked.

Can I use a Data Matrix code for a marketing campaign?

Rarely. Most customers scan with a phone camera, which may not read Data Matrix. A QR code is the safer choice for any campaign link that must be scanned and tracked.

To pick the right format for a campaign, compare the types of QR codes before you print.