Data Matrix vs QR Code: Same Data, Measured Side by Side
We encoded the same text as a Data Matrix and as a QR code and measured both. Short data is much smaller as a Data Matrix; very long data can be smaller as a QR code. Try your own text below.
Data Matrix or QR code: the short answer
Pick a Data Matrix when a machine reads the code, the space is small, or a rule names it: parts and electronics, healthcare packs (GS1 DataMatrix) and EU prescription medicines. Pick a QR code when a person scans it with a phone camera, when it must open a web page, or when you want to choose the error correction level.
The sections below put numbers on that, measured on the same data.
Try it: your text as a Data Matrix and as a QR code
Type your data. Both codes are drawn at the same module scale, each with the quiet zone its standard asks for (1 module for a Data Matrix, 4 for a QR code), so you see their real relative size. The printed size follows the module size and printer resolution you pick. Everything runs in your browser; nothing is uploaded.
With quiet zones, the QR Code (level M) takes 2.6 times the area of the Data Matrix.
How big is the same data in each code?
We encoded each sample with the encoders behind this site: the smallest square Data Matrix (ECC 200), and a QR code at error correction levels L, M and H. Sizes are modules per side, without the quiet zone.
| Data | Data Matrix | QR level L | QR level M | QR level H |
|---|---|---|---|---|
12-digit number 123456789012 | 14 × 14 | 21 × 21 | 21 × 21 | 21 × 21 |
Part number PN-48213-A7 | 16 × 16 | 21 × 21 | 21 × 21 | 25 × 25 |
Serial SN-2026-000123 | 16 × 16 | 21 × 21 | 21 × 21 | 25 × 25 |
Web address https://data-matrix-generator.com | 22 × 22 | 29 × 29 | 29 × 29 | 33 × 33 |
GS1 element string (01)…(21)12345 | 22 × 22 | 25 × 25 | 25 × 25 | 29 × 29 |
A square Data Matrix starts at 10 × 10 modules and a QR code at 21 × 21, so short data gives the biggest gap: the 12-digit number is 14 × 14 as a Data Matrix and 21 × 21 as a QR code. A higher QR level makes the code bigger: the web address goes from 29 × 29 at level L to 33 × 33 at level H. The last row is a GS1 element string: GS1 DataMatrix and GS1 QR Code both start with FNC1; see the GS1 Data Matrix generator.
How small can each code be printed?
GS1 gives 0.254 mm as the smallest module for regulated healthcare items (Table 5-52). At 300 dpi that is exactly 3 printer dots per module; at 203 dpi the nearest is 2 dots (0.25 mm) and at 600 dpi it is 6 dots. The sizes below use that module, the quiet zones of Table 5-46 (1 module for a Data Matrix, 4 for a QR code) and QR level M.
| Data | Data Matrix, square side | QR code, square side | QR code area compared with Data Matrix |
|---|---|---|---|
12-digit number 123456789012 | 4.1 mm | 7.4 mm | 3.3× |
Part number PN-48213-A7 | 4.6 mm | 7.4 mm | 2.6× |
Serial SN-2026-000123 | 4.6 mm | 7.4 mm | 2.6× |
Web address https://data-matrix-generator.com | 6.1 mm | 9.4 mm | 2.4× |
GS1 element string (01)…(21)12345 | 6.1 mm | 8.4 mm | 1.9× |
So the 12-digit number needs a 4.1 mm square as a Data Matrix and 7.4 mm as a QR code, quiet zone included. 0.254 mm is a floor for good printers and verifiers, not a comfortable size: for phones and cheap scanners use bigger modules (GS1 gives 0.495 mm as the target for retail packs). The Data Matrix generator rounds a module to whole printer dots and shows the size you get.
Source: GS1 General Specifications, Release 26.0, section 5.6.
When is a QR code the smaller one?
For long data, sometimes. A Data Matrix spends a fixed, fairly large share of its symbol on error correction, while QR level L spends little. We encoded mixed-case text of growing length and compared the area with quiet zones:
| Characters | Data Matrix | QR level L | QR level M | Smallest with quiet zones |
|---|---|---|---|---|
| 20 | 18 × 18 | 25 × 25 | 25 × 25 | Data Matrix |
| 50 | 32 × 32 | 29 × 29 | 33 × 33 | Data Matrix |
| 100 | 40 × 40 | 37 × 37 | 41 × 41 | Data Matrix |
| 200 | 52 × 52 | 53 × 53 | 57 × 57 | Data Matrix |
| 500 | 80 × 80 | 77 × 77 | 85 × 85 | Data Matrix |
| 1000 | 120 × 120 | 105 × 105 | 121 × 121 | QR level L |
The Data Matrix is smallest up to 500 characters here. At 1000 characters QR level L is smaller (105 × 105 against 120 × 120), but it has the least error correction. Against QR level M, the usual default of QR generators, the Data Matrix is smaller or about equal in every row.
How much data fits?
A QR code holds more, about twice as much: a version 40 QR code at level L against the largest square Data Matrix, 144 × 144 modules.
| Kind of data | Data Matrix (144 × 144) | QR code (version 40, level L) |
|---|---|---|
| Digits only | 3,116 | 7,089 |
| Capital letters and digits | 2,335 | 4,296 |
| Any bytes (lower case, URLs) | 1,556 | 2,953 |
We checked every limit with the encoder: it takes exactly that much and refuses one more. Most labels hold a part number, a serial and a date, a tiny fraction of either limit.
Error correction: fixed in a Data Matrix, your choice in a QR code
A Data Matrix has no level to choose: the amount of error correction is fixed for each size (the table on the home page lists it). A QR code has four levels, L, M, Q and H, which can restore roughly 7%, 15%, 25% and 30% of the symbol (ISO/IEC 18004). More correction costs size, as the table above shows. The two are not directly comparable: a larger Data Matrix gets more room for correction, a QR code gets more only if you ask for it.
Who can scan it?
Most phone camera apps open QR codes without extra software. Many do not read Data Matrix, so test with the phones your users have, or tell them which app to use. Industrial scanners and imagers usually read both. Either code can hold a web address that redirects wherever you point it later (a GS1 Digital Link works this way). In practice QR codes are the ones people open as links, while a Data Matrix mostly carries the data itself, and data printed in a code cannot be changed without reprinting.
Rules that name one of them
In the EU, prescription medicines (except those listed in Annex I) and the few non-prescription ones listed in Annex II must carry a Data Matrix. The Commission’s regulation lists what goes in it (product code, serial number of up to 20 characters, batch, expiry date, and a national number where a country requires one) and says that a print quality of at least 1.5 under ISO/IEC 15415 is presumed to comply.
US device labels work differently: 21 CFR 801.40, Form of a unique device identifier asks for the UDI in plain text and in “Automatic identification and data capture (AIDC) technology” and does not name a symbology; the issuing agency’s rules do. For GS1 on healthcare items the usual choice is the GS1 DataMatrix: see the GS1 Data Matrix generator. Check the rule that applies to your product and market before you choose.
The barcode shall be a machine-readable Data Matrix and have error detection and correction equivalent to or higher than those of the Data Matrix ECC200.
Source: Commission Delegated Regulation (EU) 2016/161, Articles 4 to 6.
Make your Data Matrix
This site makes Data Matrix codes, not QR codes; the QR codes on this page are there for the comparison. Plain text, numbers and URLs: the Data Matrix generator. Product data with GTIN, expiry and batch: the GS1 Data Matrix generator. A list on label sheets: Data Matrix labels.