Short answer
Data Matrix and QR code are both 2D barcodes. Data Matrix (L-shaped border) packs short IDs into a smaller square and is the standard for marking parts, medicines and medical devices; QR (three corner squares) holds more data and is what phone cameras open for links. Use Data Matrix for small items and industrial or GS1 healthcare data; use QR for consumers and URLs.
Measured below on real codes: a 16-character serial number is a 16 × 16 Data Matrix and a 21 × 21 QR code. Printed at 0.5 mm per module with each format’s minimum blank margin, that is 9.0 mm against 14.5 mm wide, so the Data Matrix needs about 39% of the space. If you are new to the format, start with what a Data Matrix code is.
Side-by-side: same data, both codes
Most comparisons just list specs. Here the same four pieces of data were encoded both ways when this page was built: the Data Matrix by our generator’s engine, the QR code by the open-source bwip-js library at error-correction level M, the usual default. Every code is drawn at the same scale and scans.
Short serial (16 characters) “SN-00012345-2026”
Data Matrix
QR code (level M)
Data Matrix takes 39% of the QR code’s area.
Web address “https://example.com/p/PART-000123”
Data Matrix
QR code (level M)
Data Matrix takes 42% of the QR code’s area.
GS1 GTIN + expiry + lot + serial (01)09506000134352(17)281231(10)LOT42(21)SN1001
Data Matrix
GS1 QR code (level M)
Data Matrix takes 53% of the QR code’s area.
100 characters of text “PART-000123 REV C LOT 2611-A QTY 25 MFG 2026-11-02 LINE 4 STATION 12 OPERATOR 117 RESULT PASS ID 900”
Data Matrix
QR code (level M)
Data Matrix takes 71% of the QR code’s area.
| Data | Data Matrix | QR level L | QR level M | Relative area |
|---|---|---|---|---|
| Short serial (16 characters) | 16 × 16 9.0 mm | 21 × 21 version 1 · 14.5 mm | 21 × 21 version 1 · 14.5 mm | 39% |
| Web address | 22 × 22 12.0 mm | 25 × 25 version 2 · 16.5 mm | 29 × 29 version 3 · 18.5 mm | 42% |
| GS1 GTIN + expiry + lot + serial | 22 × 22 12.0 mm | 25 × 25 version 2 · 16.5 mm | 25 × 25 version 2 · 16.5 mm | 53% |
| 100 characters of text | 36 × 36 19.0 mm | 33 × 33 version 4 · 20.5 mm | 37 × 37 version 5 · 22.5 mm | 71% |
What the measurements show:
- Data Matrix is smaller for every sample, from 39% to 71% of the QR code’s area at level M. Most of the gap comes from the finder patterns and the quiet zone: QR needs 4 blank modules on each side, Data Matrix 1.
- The gap shrinks as the data grows. For 100 characters of capitals and digits, a level-L QR code has fewer modules than the Data Matrix (33 × 33 against 36 × 36). Only the quiet zone keeps the Data Matrix ahead, and level L gives the QR code the least error correction.
- Error correction is not equal. The 16 × 16 Data Matrix spends 12 of its 24 codewords on error correction; a version 1 QR code at level M spends 10 of 26. So the smaller code is not the weaker one here.
- GS1 data: the same GTIN, expiry, lot and serial fit a 22 × 22 GS1 DataMatrix or a 25 × 25 GS1 QR code.
Want to try your own data? Create a Data Matrix code and compare its size with any QR generator at the same module size.
Comparison table
| Feature | Data Matrix | QR code |
|---|---|---|
| Looks like | Solid L on two edges, dotted “clock” track on the other two | Three large squares in the corners |
| Standard | ISO/IEC 16022 (DMRE rectangles: ISO/IEC 21471) | ISO/IEC 18004 (also covers Micro QR) |
| Sizes | 24 squares from 10 × 10 to 144 × 144; 6 rectangles up to 16 × 48; 18 DMRE rectangles | 40 versions from 21 × 21 to 177 × 177; Micro QR 11 × 11 to 17 × 17 |
| Most data | 3,116 digits, 2,335 letters and digits, or 1,556 bytes | 7,089 digits, 4,296 letters and digits, or 2,953 bytes (version 40, level L) |
| Error correction | Reed–Solomon, fixed per size (ECC 200) | Reed–Solomon, you choose: L, M, Q or H (about 7, 15, 25 or 30% recovery) |
| Quiet zone | At least 1 module | At least 4 modules (Micro QR: 2) |
| Shapes | Square or rectangle | Square only (rectangular rMQR is a separate, newer standard) |
| Phone cameras | Support varies by phone and app; a scanner app works | Built into iPhone and Android camera apps |
| GS1 use | GS1 DataMatrix: medicines, medical devices, regulated healthcare | QR with a GS1 Digital Link web address: consumer packaging |
| Typical uses | Parts and PCBs, direct part marking, medicine packs, lab samples | Links, menus, tickets, payments, marketing |
Capacities depend on the kind of data: digits pack tightest, then capitals, then other bytes. For every Data Matrix size, see the Data Matrix capacity chart.
Which should I use?
Go down the list and stop at the first “yes”.
-
Will the public scan it with a phone camera, for example to open a web page?
Yes: use a QR code.
-
Is it a medicine, a medical device or another product where a GS1 healthcare rule applies?
Yes: use a GS1 DataMatrix. GS1 generator
-
Is the space tight, or will the code be marked straight onto a part?
Yes: use a Data Matrix. Generator
-
Do you need to store more than about 1,556 bytes in one code?
Yes: a QR code holds more, or store an ID and look the rest up.
-
None of the above?
Either works. Pick what your scanners and partners already read; for internal labels read by 2D scanners, Data Matrix saves space.
When to use Data Matrix
- Small items. The smallest Data Matrix is 10 × 10 modules and holds 6 digits; a QR code starts at 21 × 21.
- Narrow spaces. Rectangular sizes go down to 8 modules tall, for the edge of a part, a cable or a test tube. QR codes are square.
- Parts marked for life. Laser-etched or dot-peened codes on metal (direct part marking) are almost always Data Matrix.
- Regulated healthcare. EU and US medicine packs and many medical-device labels use GS1 DataMatrix.
- Industrial scanning. Factory, warehouse and lab imagers read Data Matrix as a matter of course.
When to use a QR code
- Anything the public scans. Posters, menus, packaging links and business cards: phone cameras open QR codes with no app.
- Web addresses. Phones turn a QR code’s URL into a tap-to-open link. With a Data Matrix, many phones need a scanner app first.
- Lots of data. Up to 2,953 bytes against 1,556 for Data Matrix.
- Consumer retail packaging. GS1 is moving consumer packaging toward 2D codes; QR codes that carry a GS1 Digital Link web address serve both shoppers and checkout scanners (GS1 US calls the transition Sunrise 2027).
Phone support for Data Matrix changes with each operating system and app update, so test with the phones your audience uses. The guide to scanning Data Matrix with a phone covers the options.
What about PDF417 and Aztec?
Two other 2D codes come up in the same searches. Neither competes with Data Matrix for small marks:
| Code | Looks like | Standard | Where you see it | Worth knowing |
|---|---|---|---|---|
| PDF417 | A stack of short barcode rows, wider than tall | ISO/IEC 15438 | US driver’s licenses and ID cards, some shipping labels, boarding passes | Holds about 1,850 text characters. Some linear imagers can read it; it needs far more space than Data Matrix for the same data. |
| Aztec | A bullseye in the center | ISO/IEC 24778 | Train and airline tickets on phones | Needs no quiet zone, which suits phone screens. Rare on products or parts. |
| Micro QR | One corner square | ISO/IEC 18004 | Small parts in some factories | Close to Data Matrix in size for short data (our serial: 17 × 17, 10.5 mm with its quiet zone), but phone camera apps generally do not read it. |
Is a Data Matrix a QR code?
No. A Data Matrix is not a kind of QR code, and a QR code is not a kind of Data Matrix. They are two separate barcode types with their own standards, finder patterns and encoding rules, and a scanner has to support each one. The mix-up is natural: “QR code” has become the everyday name for any square barcode. If you were asked for a “Data Matrix QR code”, the person almost always means a Data Matrix, the small square with the L-shaped border, and you can create a Data Matrix code here for free.