2D Data Matrix code generator
The square 2D matrix 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 14–28 % damage depending on size |
| Dimensions | Two-dimensional (matrix) |
| Quiet zone | 1 module on every side |
| Standard | ISO/IEC 16022 |
How a Data Matrix code is built
Every ECC 200 symbol has the same frame. The left and bottom edges are solid dark lines that form the L-shaped finder pattern; the top and right edges alternate dark and light modules to form the clock track, also called the timing pattern. Inside the frame, each 8-bit codeword occupies a block of eight modules, and the data codewords are followed by Reed–Solomon error correction codewords.
From 32 × 32 upwards the symbol is split into several data regions, each with its own finder and clock edges, so that a scanner can keep track of the grid across a large mark. A 144 × 144 symbol is 36 regions of 22 × 22 data modules. Square symbols run from 10 × 10 to 144 × 144 modules in 24 sizes; six rectangular sizes from 8 × 18 to 16 × 48 fit narrow strips. Every size has an even number of rows and columns.
This generator always chooses the smallest square size that holds your text. The capacities below are maxima for data of a single type; mixed content fits somewhat less.
| Size (modules) | Digits | Alphanumeric | Bytes |
|---|---|---|---|
| 10 × 10 | 6 | 3 | 1 |
| 12 × 12 | 10 | 6 | 3 |
| 14 × 14 | 16 | 10 | 6 |
| 16 × 16 | 24 | 16 | 10 |
| 18 × 18 | 36 | 25 | 16 |
| 20 × 20 | 44 | 31 | 20 |
| 22 × 22 | 60 | 43 | 28 |
| 24 × 24 | 72 | 52 | 34 |
| 26 × 26 | 88 | 64 | 42 |
| 32 × 32 | 124 | 91 | 60 |
| 36 × 36 | 172 | 127 | 84 |
| 40 × 40 | 228 | 169 | 112 |
| 44 × 44 | 288 | 214 | 142 |
| 48 × 48 | 348 | 259 | 172 |
| 52 × 52 | 408 | 304 | 202 |
| 64 × 64 | 560 | 418 | 278 |
| 72 × 72 | 736 | 550 | 366 |
| 80 × 80 | 912 | 682 | 454 |
| 88 × 88 | 1,152 | 862 | 574 |
| 96 × 96 | 1,392 | 1,042 | 694 |
| 104 × 104 | 1,632 | 1,222 | 814 |
| 120 × 120 | 2,100 | 1,573 | 1,048 |
| 132 × 132 | 2,608 | 1,954 | 1,302 |
| 144 × 144 | 3,116 | 2,335 | 1,556 |
| 8 × 18 | 10 | 6 | 3 |
| 8 × 32 | 20 | 13 | 8 |
| 12 × 26 | 32 | 22 | 14 |
| 12 × 36 | 44 | 31 | 20 |
| 16 × 36 | 64 | 46 | 30 |
| 16 × 48 | 98 | 72 | 47 |
Data Matrix vs QR code
Both are square 2D codes with Reed–Solomon error correction that read at any angle. Data Matrix is the smaller of the two for short data — a twelve-character serial number fits in a 16 × 16 Data Matrix but needs a 21 × 21 QR code — and it asks for a one-module quiet zone where QR asks for four. That is why industry marks parts, instruments and medicine packs with Data Matrix. QR codes have selectable error correction levels and near-universal support in phone camera apps, which is why anything aimed at the public uses QR.
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.
What does ECC 200 mean?
It is the Data Matrix version that uses Reed–Solomon error correction, and the only one recommended for new applications. The older ECC 000 to ECC 140 versions used convolutional coding. Every symbol this generator produces is ECC 200.
How big is a Data Matrix code?
Its size in modules is chosen by the amount of data, from 10 × 10 up to 144 × 144. The printed size is that module count times the module size: a 16 × 16 symbol at 0.5 mm per module is 8 mm square, plus one module of quiet zone on each side.