← Back to Blog
Barcodes & QR Codes

QR Code vs Data Matrix: Which 2D Barcode Should You Use

Leah ReynoldsAugust 11, 2026733 views

QR Code and Data Matrix are the two most widely used 2D barcode symbologies today. QR Code is the better default for consumer-facing labels where a smartphone camera is the scanner, while Data Matrix is preferred for industrial, medical, and very small labels where high-density encoding and precision scanners matter most. Label Toolkit lets you generate, preview, and print either symbology directly in your browser at no cost.

  • QR Code handles up to 7,089 numeric or 4,296 alphanumeric characters and is readable by any smartphone camera without a dedicated app.
  • Data Matrix stores up to 3,116 numeric or 2,335 alphanumeric characters in a smaller physical footprint, making it the industry standard for tiny parts, PCBs, and pharmaceutical labels.
  • Both use Reed-Solomon error correction, but they apply it differently: QR Code offers four named levels (L, M, Q, H) while Data Matrix uses a fixed scheme tied to the ECC 200 standard.
  • Your printer, scanner fleet, and label size should drive the choice more than any single feature comparison.

What is a 2D barcode, and why does the symbology matter?

A 2D barcode (two-dimensional barcode) encodes data in both the horizontal and vertical axes, unlike a 1D barcode (linear barcode) that only uses horizontal bars. The symbology is the specific encoding standard: the pattern geometry, data capacity rules, quiet-zone requirements, and error-correction algorithm that define how data gets written and read. Picking the wrong symbology means your scanners may not read it, your label may be too large for the substrate, or you may carry redundant quiet-zone space you cannot afford.

For a broader look at where QR and Data Matrix fit among all barcode types, see the complete barcode symbology guide on this site.

QR Code: how it works and where it excels

QR Code (Quick Response Code) was invented by DENSO WAVE in 1994 and is now standardized under ISO/IEC 18004. A QR Code is built from square modules arranged in a square grid. Three large "finder patterns" sit in three corners so any scanner can locate and orient the code regardless of rotation. A fourth "alignment pattern" helps larger versions stay readable when the label is curved or slightly distorted.

QR Code data capacity and versions

QR Code has 40 versions. Version 1 is a 21x21 module grid. Each version adds four modules per side, so Version 40 reaches 177x177 modules. At Version 40 with the lowest error-correction level (L, which recovers 7% of codeword damage), you can encode 7,089 numeric digits. At the highest level (H, which recovers 30%), that drops to 1,817 numeric digits because more of the module space is reserved for error-correction codewords.

Error-correction levelRecovery capacityMax numeric chars (V40)Max alphanumeric chars (V40)Best use
L (Low)7%7,0894,296Clean, flat surfaces
M (Medium)15%5,5963,391General product labels
Q (Quartile)25%3,9932,420Labels with a logo overlay
H (High)30%2,9531,789Outdoor, rough, or dirty surfaces

The quiet zone (the blank border around the code) for a QR Code must be at least 4 modules wide on all sides. At 203 DPI (dots per inch, the most common thermal printer resolution), one module printed at the smallest practical size is about 10 dots, so the quiet zone alone adds roughly 40 dots per edge. That is about 5 mm at 203 DPI. Shrink below that and scan rates fall sharply.

When to choose QR Code

  • Consumer packaging, restaurant menus, business cards, or any label a smartphone camera must read without a dedicated scanner.
  • Marketing URLs, contact cards (vCard), Wi-Fi credentials, or plain-text payloads where human-readable fallback is not needed.
  • Labels where a logo or brand graphic overlays the center of the code: set error correction to Q or H to compensate for the obscured modules. See how Label Toolkit handles styled QR codes with logos for the practical steps.
  • Labels with enough physical space for a minimum printed size of roughly 20x20 mm at 203 DPI.

Data Matrix: how it works and where it excels

Data Matrix is standardized under ISO/IEC 16022. The modern variant, ECC 200 (Error Checking and Correction 200), uses Reed-Solomon error correction and an "L-shaped" finder pattern called the solid "L" border, plus a dashed border on the remaining two sides to define the symbol edges. Unlike QR Code, Data Matrix is always square (or rectangular for special variants) with no version-dependent corner patterns, which makes optical alignment simpler for industrial imagers.

Data Matrix data capacity and symbol sizes

ECC 200 Data Matrix ranges from a 10x10 module grid up to 144x144. The maximum capacity is 3,116 numeric digits or 2,335 alphanumeric characters. Error correction in ECC 200 is not user-selectable the way QR Code's four levels are: the standard defines the correction capacity per symbol size, and it always recovers up to approximately 25% of damaged codewords, similar to QR Code's Q level.

The quiet zone requirement for Data Matrix is just 1 module on all sides, compared to QR Code's 4-module requirement. At 300 DPI (dots per mm equivalent: 300 DPI = 11.81 dpmm) with a 10x10 symbol, a Data Matrix code can be printed legibly in under 2.5x2.5 mm on a laser-etched metal part. That is physically impossible with a QR Code at the same scanner reliability.

When to choose Data Matrix

  • Small labels or direct-part marking (DPM) on circuit boards, surgical instruments, or pharmaceutical unit-dose packaging where space is measured in millimeters.
  • FDA UDI (Unique Device Identification) labels: the FDA mandates Data Matrix for device labels under 21 CFR Part 830.
  • GS1 DataMatrix on healthcare labels where GS1 Application Identifiers (AIs) such as (01) for GTIN, (17) for expiry date, and (10) for lot number are encoded in a single symbol.
  • High-speed industrial scanning lines where a fixed-mount imager can resolve very small modules reliably.
  • Any substrate where you cannot guarantee a 4-module quiet zone around the code.

Head-to-head comparison

FeatureQR CodeData Matrix (ECC 200)
ISO standardISO/IEC 18004ISO/IEC 16022
ShapeSquareSquare or rectangular
Max numeric capacity7,089 digits3,116 digits
Max alphanumeric capacity4,296 chars2,335 chars
Minimum quiet zone4 modules all sides1 module all sides
Minimum practical print size (203 DPI)~20x20 mm~5x5 mm
Error correction optionsL (7%), M (15%), Q (25%), H (30%)Fixed ~25% per ECC 200
Smartphone camera readableYes, nativelyRequires a dedicated app
GS1 complianceGS1 QR Code profileGS1 DataMatrix (preferred for healthcare)
Direct-part marking (DPM)UncommonStandard choice
FDA UDI complianceAcceptablePreferred / required in many cases
ZPL command (Zebra printers)^BQ^BX

Printing QR Code and Data Matrix on Zebra printers: ZPL commands

If you print on a Zebra thermal printer, you use ZPL (Zebra Programming Language) commands to embed either symbology. Here are minimal working examples for both.

QR Code with ^BQ

The ^BQ command generates a QR Code. The key parameters are model (1 or 2; always use 2 for modern QR Code), magnification factor (1 to 10, where each unit equals one module printed as that many dots), and error-correction level (H, Q, M, or L).

^XA
^FO50,50
^BQN,2,5,Q,7
^FDhttps://labeltoolkit.com^FS
^XZ

Breaking that down: ^FO50,50 places the field origin at 50 dots from the left and 50 dots from the top. ^BQN,2,5,Q,7 sets orientation to Normal, model 2, magnification 5 (so each module is 5 dots wide at the printer's native resolution), error correction Q (25%). ^FD carries the data and ^FS closes the field. At 203 DPI, magnification 5 means each module is about 0.62 mm, giving a compact but very scannable code. For a deep dive into every ^BQ parameter, see the ^BQ ZPL command reference.

Data Matrix with ^BX

The ^BX command generates a Data Matrix ECC 200 symbol. Parameters include orientation, module height in dots, quality level (0 for auto), columns, rows, format ID, and escape sequence character.

^XA
^FO50,50
^BXN,4,200
^FD[01]09501101530003[17]250630[10]LOT-A^FS
^XZ

Here ^BXN,4,200 sets orientation Normal, module size 4 dots, quality 200 (ECC 200). At 300 DPI, a 4-dot module is about 0.34 mm, producing a dense code suitable for pharmaceutical labels. The data string includes GS1 Application Identifiers: (01) for a GTIN-14, (17) for expiry date in YYMMDD format, and (10) for lot number. Note that square brackets are the readable representation of the non-printable FNC1 character that Zebra encodes automatically when you use the correct format ID.

Error correction in practice: what the numbers mean on a real label

Reed-Solomon error correction (the algorithm both symbologies use, developed originally for CD audio) works by adding redundant codewords. If a portion of the code is scratched, smeared, or missing, the decoder reconstructs the lost data from the surviving codewords, up to the recovery limit.

In practice: a shipping label on a corrugated box that rides a conveyor belt, gets wet, and partly tears needs at least QR Code M level or a Data Matrix symbol with some size headroom. A clean retail hang-tag scanned once at point of sale can use QR Code L and achieve the smallest printed size. A surgical tool label that gets laser-etched directly onto steel benefits from Data Matrix because the etching process itself guarantees high contrast, the quiet zone is just 1 module, and industrial imagers handle the small size without trouble.

GS1's technical specification for GS1 DataMatrix (GS1 DataMatrix Guideline) recommends a minimum X-dimension (the width of one module) of 0.375 mm for healthcare labels and 0.495 mm for general distribution. ISO/IEC 16022 (ISO 16022) defines the full ECC 200 specification including all symbol sizes and error-correction capacities.

Label size and substrate: the deciding factors most guides skip

Data capacity comparisons look clean in a table, but the real selection driver is usually physical space combined with scanner type.

  1. Measure your available label area in millimeters. If the barcode area is smaller than 15x15 mm, Data Matrix is almost always the only viable choice at 203 DPI.
  2. Identify who scans the code. If a consumer with a smartphone is the end reader, QR Code is the only practical option: no dedicated scanner app is required, and iOS and Android both decode QR natively since 2017 and 2018 respectively.
  3. Check your printer resolution. At 203 DPI a single module is a minimum of 5 dots (about 0.62 mm) for reliable scanning. At 300 DPI you can go down to 3 dots per module (0.25 mm) with a good imager. At 600 DPI, direct thermal label printers such as the Zebra ZD620 can produce Data Matrix codes under 3x3 mm that pass GS1 verification grades.
  4. Consider the substrate surface. Curved, reflective, or textured surfaces reduce contrast. Data Matrix's 1-module quiet zone means you can use the entire label face for the symbol, while QR Code's 4-module quiet zone eats into available space and can be violated by nearby artwork on small labels.
  5. Verify industry or regulatory requirements. Healthcare (FDA UDI), aerospace (ATA Spec 2000), and automotive (AIAG) standards often mandate Data Matrix specifically.

Generating both symbologies in Label Toolkit

Label Toolkit's browser-based designer supports QR Code and Data Matrix without any software to install. You pick the symbology from the barcode element panel, set the module size, error-correction level (for QR Code), and data payload. The live preview updates instantly at your chosen DPI so you can verify the printed size before committing to a print run. For variable-data labels (different serial numbers, lot codes, or URLs on each label), the data merge feature pulls values from a spreadsheet column directly into the barcode field.

You can also export ZPL directly from the designer. The exported ^BQ or ^BX commands match exactly what you see on screen, so there are no surprises at the Zebra printer. If you need to bring existing ZPL into the editor, the ZPL import feature parses the commands back into editable label elements.

Frequently asked questions

Can a smartphone read a Data Matrix code?

Not natively on most phones. iOS and Android cameras decode QR Code without an app, but Data Matrix requires a third-party scanner app such as Scanbot or a dedicated barcode scanner. If your end user has a smartphone and no special app, use QR Code.

Which symbology holds more data, QR or Data Matrix?

QR Code holds more: up to 7,089 numeric digits vs Data Matrix's 3,116. In real-world label use, both capacities are far larger than most payloads (a URL or a GS1 AI string rarely exceeds 100 characters), so capacity is rarely the deciding factor.

Is Data Matrix the same as a QR Code?

No. They are separate symbologies defined by different ISO standards (ISO/IEC 16022 for Data Matrix, ISO/IEC 18004 for QR Code). They have different module geometries, finder patterns, error-correction schemes, and quiet-zone requirements, and they are not interchangeable.

What ZPL command do I use for Data Matrix on a Zebra printer?

Use ^BX for Data Matrix and ^BQ for QR Code. The ^BX syntax is ^BXo,h,s,c,r,f,g where h is the module height in dots and s is the quality level (set to 200 for ECC 200).

Which 2D barcode is better for GS1 healthcare labels?

GS1 recommends GS1 DataMatrix for unit-dose pharmaceutical and medical device labels because it fits in a very small area and the ECC 200 standard is explicitly cited in FDA UDI regulations. GS1 QR Code is an accepted alternative for some use cases but is less commonly deployed in healthcare supply chains.

Ready to generate your first QR Code or Data Matrix label without installing anything? Create a free Label Toolkit account and have a print-ready label in minutes.

#qr vs data matrix #data matrix barcode #QR code #barcode symbology #2D barcode #barcodes and qr codes
LR
Written by Leah Reynolds
View profile →