Data Matrix
vs QR code

The same data, encoded both ways, at the same module size. See the difference, then pick the right one.

Updated 8 min read By the Data Matrix Code Generator team

On this page 9 sections
  1. Short answer
  2. Side-by-side: same data, both codes
  3. Comparison table
  4. Which should I use?
  5. When to use Data Matrix
  6. When to use a QR code
  7. What about PDF417 and Aztec?
  8. Is a Data Matrix a QR code?
  9. FAQ

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, 16 by 16 modules

Data Matrix

16 × 16 modules · 9.0 mm

QR code, 21 by 21 modules

QR code (level M)

21 × 21 modules (version 1) · 14.5 mm

Data Matrix takes 39% of the QR code’s area.

Web address “https://example.com/p/PART-000123”

Data Matrix, 22 by 22 modules

Data Matrix

22 × 22 modules · 12.0 mm

QR code, 29 by 29 modules

QR code (level M)

29 × 29 modules (version 3) · 18.5 mm

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, 22 by 22 modules

Data Matrix

22 × 22 modules · 12.0 mm

QR code, 25 by 25 modules

GS1 QR code (level M)

25 × 25 modules (version 2) · 16.5 mm

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, 36 by 36 modules

Data Matrix

36 × 36 modules · 19.0 mm

QR code, 37 by 37 modules

QR code (level M)

37 × 37 modules (version 5) · 22.5 mm

Data Matrix takes 71% of the QR code’s area.

Both codes at 0.5 mm per module, drawn to the same scale. Shaded bands are each format’s minimum quiet zone: 1 module for Data Matrix, 4 for QR. Widths include the quiet zone.
Module counts and printed width at 0.5 mm per module, including each format’s minimum quiet zone. Relative area: the Data Matrix’s area as a share of the level-M QR code’s.
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

Data Matrix vs QR code (Data Matrix figures from our engine’s size table; QR figures from ISO/IEC 18004)
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”.

  1. Will the public scan it with a phone camera, for example to open a web page?

    Yes: use a QR code.

  2. Is it a medicine, a medical device or another product where a GS1 healthcare rule applies?

    Yes: use a GS1 DataMatrix. GS1 generator

  3. Is the space tight, or will the code be marked straight onto a part?

    Yes: use a Data Matrix. Generator

  4. 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.

  5. 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:

Other 2D barcodes, one line each
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.

Frequently asked questions

Is a Data Matrix the same as a QR code?
No. Both are 2D barcodes made of small black and white squares, but they are different symbologies with different standards: Data Matrix is ISO/IEC 16022 and has a solid L-shaped border, while a QR code is ISO/IEC 18004 and has three large squares in its corners. A scanner has to support each one. People often call any square barcode a “QR code”, which is where the confusion comes from.
What are the key differences between a Data Matrix and a QR code?
Size, capacity and who scans it. For short data a Data Matrix is smaller: our 16-character serial needs 16 × 16 modules as a Data Matrix and 21 × 21 as a QR code. A QR code holds more (up to 4,296 letters and digits against 2,335), lets you choose its error-correction level, and opens in any phone camera. Data Matrix is the standard for marking parts and for GS1 healthcare codes.
Which is better, Data Matrix or QR code?
Neither is better everywhere. Use a QR code when the public will scan it with a phone, especially for a web link. Use a Data Matrix when the code must be very small, is marked on a part, is read by 2D scanners in a factory, warehouse or lab, or must follow a GS1 healthcare rule such as the EU and US medicine codes. The decision list above walks through it.
How to scan a Data Matrix?
Use a camera-based scanner: a 2D handheld imager, a barcode scanner app on your phone, or our Data Matrix reader, which decodes a photo or your camera feed in the browser without uploading it. Built-in phone camera apps are made for QR codes and may not read a Data Matrix. More in the guide to scanning Data Matrix with a phone.
How can I create a Data Matrix QR code?
There is no such thing as a “Data Matrix QR code”: it is one or the other. If you need the small square code with the L-shaped border, used on parts and medicine packs, create a Data Matrix code in our free generator. If you need a code that phone cameras open as a web link, you want a QR code, which this site does not make.