Data Matrix
Data Matrix is the square 2D barcode on pharma vials, electronic components, surgical instruments, jet-engine blades, and pretty much anything small enough that a QR wouldn't fit. It's the only 2D symbology specified for direct-part marking (DPM), laser-etched, dot-peen, or chemically-etched straight onto metal, and the only one with an ISO standard (29158) for grading DPM-quality decodes.
DPM grading:ISO/IEC TR 29158:2020, Direct part mark (DPM) quality guideline.
Pharma application:FDA UDI Rule (2013) and EU Medical Device Regulation 2017/745, both mandate GS1-formatted Data Matrix on most medical devices.
Originator: International Data Matrix Inc, 1987. Now maintained by AIM and ISO. Royalty-free.
What it is
A square (or rectangular) matrix with an L-shaped finder pattern on two adjacent sides and a clock track (alternating black/white) on the other two. Inside that frame is a grid of data modules encoding the payload via Reed-Solomon ECC (the modern variant, ECC 200, is the only one in current use, older variants ECC 000, ECC 050, ECC 080, ECC 100, ECC 140 are deprecated).
Three properties that make Data Matrix the industrial-marking standard:
- Extreme compactness. A 10×10 symbol carries 6 digits or 3 alphanumeric chars. That's small enough to mark on a surface-mount resistor (3 × 1.6 mm) or a pharma glass vial (diameter 8 mm).
- Survives direct-part marking. Laser-etched into stainless steel, dot-peened into titanium, chemically etched into glass, Data Matrix is the only 2D symbology where these marking processes are standardised (ISO/IEC 29158).
- Fixed ECC per size. Unlike QR's four ECC levels or PDF417's nine, Data Matrix ECC 200 has error correction baked into the symbol-size definition. 10×10 has 25% ECC; 144×144 has ~28%. No manual tuning, the spec chose the right tradeoff per size.
Sizes and capacity (ECC 200)
Data Matrix supports 24 square sizes from 10×10 to 144×144, plus 6 rectangular sizes from 8×18 to 16×48. Representative capacities:
| Size (modules) | Max numeric | Max alphanumeric | Typical use |
|---|---|---|---|
| 10 × 10 | 6 digits | 3 chars | SMT resistor, tiny electronic part |
| 12 × 12 | 10 digits | 6 chars | SMT capacitor, small connector |
| 16 × 16 | 24 digits | 16 chars | Pharma glass vial, small IC package |
| 20 × 20 | 44 digits | 31 chars | Pharma blister pack, medium IC |
| 26 × 26 | 88 digits | 64 chars | Pharma carton with lot + expiry + GTIN |
| 32 × 32 | 124 digits | 91 chars | Full GS1 element string with serial |
| 52 × 52 | 408 digits | 301 chars | Maintenance tag on industrial equipment |
| 144 × 144 | 3,116 digits | 2,335 chars | Theoretical max, rarely shipped |
GS1 element strings, pharma + supply-chain use
In pharma and regulated supply chains, Data Matrix payloads are GS1 element strings with parentheses-wrapped Application Identifiers (AIs). Common AIs:
| AI | Name | Format | Example |
|---|---|---|---|
(01) | GTIN | 14 digits | (01)09506000134352 |
(10) | Batch / Lot | alphanumeric, var | (10)ABC123 |
(17) | Expiry date | YYMMDD | (17)270630 |
(21) | Serial number | alphanumeric, var | (21)SN00042 |
(240) | Additional ID | alphanumeric, var | (240)CAT-7A |
In the encoded payload, the parentheses are visualisation only, the actual symbol uses the FNC1 function character as a field separator. Encoders must emit FNC1 at the start (to signal GS1 mode) and between variable-length AIs.
Canonical test vectors
| Case | Payload | Expected substring |
|---|---|---|
| Pharma UDI (GS1 element string) | (01)09506000134352(17)270630(10)ABC123 | 09506000134352 |
| Electronic part (plain) | PN:4321-ABC SN:00001234 | 4321-ABC |
| Short numeric ID | 12345678 | 12345678 |
| URL (rare but valid) | https://example.com/p/X42 | example.com/p/X42 |
Common pitfalls
- Consumer phones won't decode Data Matrix reliably. iPhone Camera returns nothing. Google Lens decodes some Data Matrix (e.g. on product packaging with high contrast) but inconsistently. For industrial scanning, use a dedicated imager.
- DPM verification requires ISO/IEC 29158 grading. A phone-camera decode does NOT prove a laser-etched or dot-peened Data Matrix will pass a pharma reader's quality grade. Use a DPM verifier (Microscan, Cognex DataMan, Dynamsoft) before shipping.
- ECC 200 is the only modern variant. Deprecated older variants (ECC 000 through ECC 140) still appear in some legacy code generators. Always use ECC 200; older variants decode poorly on modern scanners.
- Rectangular sizes are valid but specialist. Data Matrix supports 6 rectangular sizes (8×18, 8×32, 12×26, 12×36, 16×36, 16×48). Useful for tight spaces like cable labels, but some older scanners only support square sizes.
- GS1 requires FNC1 at the start. Without the leading FNC1, the decoder can't distinguish a GS1 payload from plain text. Abundera's encoder emits FNC1 automatically when the payload starts with a GS1-shaped element string
(NN)…. - GS1 compliance for pharma requires a GS1-aware encoder. Abundera encodes GS1 element strings as Code 128 / Data Matrix but is not officially GS1-certified. For FDA UDI / EU MDR regulatory submissions, use a certified GS1 solution provider.
- Module pitch for DPM. Direct-part marking needs at least 0.25 mm/module for industrial imagers; 0.4 mm for portable DPM readers. Below that, decode yield drops fast regardless of ECC.
- Contrast minimum. ISO/IEC 29158 requires at least 20% contrast ratio between mark and substrate. Laser-etched stainless steel with heavy oxidation can drop below this, verify with a DPM grader.
- Styling disabled. QR-specific features (custom dot shapes, gradients, centre logos) don't apply to Data Matrix. Abundera's Style panel disables itself for this type.
Scanner compatibility
| Reader | Data Matrix support | Notes |
|---|---|---|
| iOS Camera (iOS 15+) | No | Apple has not added Data Matrix to the native Camera app. Third-party apps with Scandit or Dynamsoft SDKs work. |
| Android Camera (Google/Pixel) | Yes (via Google Lens) | Google Lens decodes Data Matrix reasonably well on high-contrast product packaging. Fails on laser-etched DPM. |
| Pharma / medical DPM reader (ISO 29158) | Yes (canonical) | Microscan, Cognex DataMan, Dynamsoft DPM readers, full support with quality grading. |
| Zebra / Honeywell / Datalogic industrial imager | Yes | Every industrial 2D imager supports Data Matrix natively. Default symbology for their factory-automation lines. |
| GS1 QR-enabled POS scanner | Yes | Retail POS scanners that accept GS1 DataBar also accept GS1 Data Matrix with FNC1 encoding. |
| Airline / transit gate reader | No | Not used for transit. Use Aztec for boarding passes. |
| 1D laser scanner | No | Data Matrix is 2D, requires an imager. Only PDF417 decodes on 1D lasers. |
See also
- /data-matrix-code-generator/, the Data Matrix generator.
- GS1 Digital Link reference, the GTIN-first successor to traditional GS1 element strings.
- Aztec · PDF417 · Data Matrix comparison, side-by-side comparison.
- Aztec reference, the display-first sibling, for boarding passes and transit.
- PDF417 reference, the stacked-linear sibling, for driver licenses and airbills.
- Standards index, back to the reference hub.