Data Matrix code generator
The square 2D code that still reads when it is only a few millimetres across. Standard for marking components, instruments and pharmaceutical packs.
Generate a Data Matrix barcode
SVG shape mask (decorative)
Upload an SVG — the barcode is clipped to its shape. A horse SVG makes a horse-shaped barcode.
Data Matrix packs data into a square (or occasionally rectangular) grid of modules, surrounded on two sides by a solid L-shaped finder pattern and on the other two by an alternating light-dark clock track. The scanner uses the L to find the symbol and the clock track to work out how many modules it contains, which is why Data Matrix tolerates being photographed at an angle far better than a linear barcode.
Modern Data Matrix means ECC 200, the variant with Reed–Solomon error correction. It can rebuild the payload from a symbol with roughly a quarter of its area damaged, which is what makes it usable for direct part marking — dot peening, laser etching or chemical etching straight onto metal, where the mark is never as clean as ink on paper.
Its real advantage is size. A short serial number fits into a 12 × 12 module symbol that can be printed at two or three millimetres square and still scanned by a decent imager. Nothing else in common use is that small, which is why it ends up on circuit boards, surgical instruments and the tiny panel of a medicine carton where the EU Falsified Medicines Directive requires a unique identifier.
What Data Matrix encodes
| Character set | Full byte range; ASCII, Latin-1 and raw binary |
|---|---|
| Capacity | Up to 2,335 alphanumeric characters, 3,116 digits or 1,556 bytes |
| Sizes | Square from 10 × 10 to 144 × 144 modules, plus six rectangular sizes |
| Error correction | ECC 200, Reed–Solomon, recovers roughly 25 % damage |
| Dimensions | Two-dimensional (matrix) |
| Quiet zone | 1 module on every side |
| Standard | ISO/IEC 16022 |
Where Data Matrix is actually used
Electronics manufacturing
Serial numbers laser-marked on PCBs, components and connectors.
Pharmaceutical packaging
The EU Falsified Medicines Directive unique identifier is carried in a GS1 Data Matrix on every prescription pack.
Medical devices and instruments
UDI marking, often etched directly onto stainless steel that will be autoclaved repeatedly.
Aerospace and automotive parts
Traceability marks applied by dot peen, which survive the life of the part.
Rules this Data Matrix generator enforces
- Any text is valid, so errors here are almost always about size rather than content.
- The symbol always has an even number of rows and columns; the encoder rounds up to the next legal size and pads.
- Keep the payload short if the mark will be small. A serial number reads reliably at 3 mm; a paragraph does not.
- A GS1 Data Matrix additionally needs FNC1 and Application Identifiers. Plain text in a Data Matrix is not a GS1 Data Matrix, even though the symbol looks identical.
Printing a Data Matrix symbol that scans
Data Matrix only needs a one-module quiet zone, but it does need the contrast. On metal, the readable ones are almost always the ones where the marking process produced a genuine light-dark difference under the imager’s illumination rather than a shallow scratch.
Print or mark it square. Unlike a linear barcode, a Data Matrix distorted along one axis quickly stops decoding, because the clock track no longer matches the module grid the scanner reconstructs. Export SVG and scale proportionally.
Data Matrix questions
Data Matrix or QR code?
Data Matrix wins when the mark has to be very small or is applied to a part rather than to paper. QR wins for anything a consumer will scan with a phone, because phone cameras and camera apps are tuned for it.
How much data fits in a Data Matrix?
Up to 3,116 digits or 2,335 alphanumeric characters at the largest 144 × 144 size. Real-world marks carry far less — usually a serial number or a GS1 identifier string.
What is a GS1 Data Matrix?
The same symbology carrying GS1 Application Identifiers with a leading FNC1, so a scanner can parse GTIN, batch, expiry and serial as separate fields.