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

Compare QR codes and Data Matrix barcodes in size, data capacity, scanning, and use cases. Learn which 2D barcode format fits your application.

QR codes and Data Matrix are the two dominant 2D barcode formats. Both encode data in a two-dimensional pattern of dark and light modules. Both handle text, numbers, and binary data. Both include error correction that lets them scan when partially damaged. But they were designed for different environments — QR for speed and consumer scanning, Data Matrix for density and industrial marking — and those design choices create real differences in where each one excels.

Quick Comparison

FeatureQR CodeData Matrix
Year introduced19941987
Invented byDenso Wave (Japan)RVSI Acuity CiMatrix
ShapeSquare (with finder patterns in 3 corners)Square or rectangular (L-shaped border)
Max data capacity7,089 numeric / 4,296 alphanumeric3,116 numeric / 2,335 alphanumeric
Minimum practical size~10mm × 10mm (phone scanning)~2mm × 2mm (machine scanning)
Error correction7-30% (4 configurable levels)~28% (fixed, ECC 200)
Phone camera scanningNative in all modern phonesRequires Google Lens or scanner app
Industrial scanner supportUniversalUniversal
ISO standardISO/IEC 18004ISO/IEC 16022
GS1 variantGS1 QR CodeGS1 DataMatrix
Primary domainConsumer-facing, marketing, paymentsIndustrial, healthcare, electronics

Size: Where Data Matrix Wins

Data Matrix was designed to fit on small components — circuit boards, medical devices, aerospace parts. Its compact design comes from two structural differences:

No large finder patterns. QR codes use three large square patterns in their corners (each 7×7 modules) for orientation. These finder patterns make QR codes easy for phone cameras to detect from a distance, but they consume about 30% of the barcode's total area. Data Matrix uses a simpler L-shaped solid border and a dotted timing pattern that take up less space.

Higher data density per module. For the same data payload, Data Matrix typically requires fewer modules than QR code. A 20-character alphanumeric string produces a 25×25 module QR code versus a 16×16 module Data Matrix.

Practical Size Comparison

DataQR Code SizeData Matrix Size
10-digit number~21 × 21 modules~12 × 12 modules
20-char text~25 × 25 modules~16 × 16 modules
URL (50 chars)~33 × 33 modules~22 × 22 modules
100 bytes binary~29 × 29 modules~20 × 20 modules

At a 0.25mm module size, that 20-character Data Matrix is only 4mm × 4mm — small enough to fit on a microchip, a pill, or a surgical instrument. The equivalent QR code would be over 6mm × 6mm.

This size difference is why Data Matrix dominates in electronics marking (the tiny code on your laptop's circuit board), pharmaceutical packaging (the code on a blister pack), and medical device identification (the code laser-etched on a scalpel).

Scanning: Where QR Code Wins

QR codes were designed to be decoded rapidly from any angle by a camera. Their three large finder patterns serve as instant beacons — even a basic camera can locate and orient a QR code from meters away, at an angle, partially obscured, or in poor lighting.

Phone Camera Support

PlatformQR CodeData Matrix
iPhone (Camera app)Automatic since iOS 11 (2017)Not supported natively
Android (Camera app)Automatic on most phones since 2018Not supported natively
Google LensYesYes
Web scanner (barcodescanner.online)YesYes

This is the decisive difference for consumer applications. When you put a QR code on a poster, menu, or product, anyone with a modern phone can scan it instantly. A Data Matrix on the same poster requires the user to open Google Lens or download a scanner app — a friction step that kills adoption.

For industrial applications, this doesn't matter. Factories, warehouses, and hospitals use dedicated barcode scanners that read both formats equally well.

Scanning Distance

QR codes' large finder patterns make them detectable from greater distances. A 2cm QR code scans reliably from 30-50cm with a phone camera. A 2cm Data Matrix needs the phone to be within 10-20cm for reliable detection.

For industrial scanners, both formats read at similar distances for equivalent sizes and module densities.

Error Correction Comparison

Both formats use Reed-Solomon error correction to recover data when part of the barcode is damaged:

QR Code: Four Configurable Levels

LevelError RecoveryUse Case
L (Low)7%Maximum data capacity, minimal damage expected
M (Medium)15%Default for most applications
Q (Quartile)25%Moderate damage expected
H (High)30%Harsh environments, logo overlays

Data Matrix: Fixed ECC 200

Data Matrix ECC 200 (the current standard, used in virtually all modern implementations) provides approximately 28% error recovery. This is comparable to QR Code Level Q, but it's not configurable — you get the same level of protection regardless of use case.

Trade-off: QR code's configurable levels let you optimize for your specific situation — maximum data capacity when damage isn't a concern (Level L), or maximum reliability when it is (Level H). Data Matrix gives you strong protection by default without the need to choose.

For a deeper dive into how QR error correction works, see our QR code guide.

Data Capacity

QR codes hold more total data, but Data Matrix holds more data per unit area:

Data TypeQR Code MaximumData Matrix Maximum
Numeric only7,089 characters3,116 characters
Alphanumeric4,296 characters2,335 characters
Binary/bytes2,953 bytes1,556 bytes

In practice, most barcodes encode well under 100 characters. At these typical lengths, both formats handle the data comfortably. The capacity limits rarely matter for real-world applications.

Industry Standards and Adoption

Where QR Code Dominates

  • Consumer marketing: URLs, promotions, event tickets
  • Mobile payments: WeChat Pay, PayPay, many banking apps
  • Authentication: TOTP/2FA setup codes
  • WiFi sharing: WiFi connection QR codes
  • Restaurant menus: Digital menu QR codes
  • Boarding passes: Many airlines use QR codes for mobile boarding
  • GS1 Digital Link: GS1 QR codes carrying product information URLs, part of the GS1 Sunrise 2027 initiative

Where Data Matrix Dominates

  • Electronics: Component marking on PCBs, chips, and connectors (IPC-1066 standard)
  • Healthcare: Unique Device Identification (UDI) on medical devices (FDA requirement)
  • Pharmaceuticals: Drug packaging identification (EU FMD, US DSCSA)
  • Aerospace: Part marking per ATA Spec 2000 / AS9132
  • Automotive: Direct Part Marking (DPM) on engine components
  • Postal services: USPS Intelligent Mail barcode supplements
  • GS1 Healthcare: GS1 DataMatrix for pharmaceutical and medical device identification

Where Either Works

  • Inventory management: Both work well for internal inventory barcodes
  • Asset tracking: Depends on label size requirements
  • Shipping: Both are supplementary to the primary Code 128 barcode on shipping labels

Marking Methods

Data Matrix has an advantage in Direct Part Marking (DPM) — permanently marking the barcode onto the surface of a part using laser etching, dot peening, chemical etching, or inkjet printing:

Marking MethodQR CodeData Matrix
Laser etchingPossiblePreferred (smaller = less material affected)
Dot peeningPossiblePreferred (fewer dots needed)
Inkjet printingBoth work equallyBoth work equally
Chemical etchingBoth work equallyBoth work equally
Thermal printingBoth work equallyBoth work equally

Data Matrix's smaller footprint means less surface area needs to be marked, which matters on precision components where marking affects material properties (e.g., aerospace turbine blades, surgical instruments).

Decision Guide

Choose QR Code When:

  • Consumers scan with phone cameras — QR's native phone support eliminates friction
  • Marketing and promotions — posters, packaging, print ads where customers need to reach a URL
  • Payments — most mobile payment systems are built around QR codes
  • WiFi and contact sharing — standardized QR code formats for WiFi and vCard
  • You need maximum data capacity — QR holds about 2× more data than Data Matrix
  • Scanning distance matters — QR's finder patterns enable detection from farther away

Choose Data Matrix When:

  • Space is very limited — labels under 10mm, direct part marking, small packaging
  • Industrial scanning equipment reads the barcode — no consumer phone scanning needed
  • Industry standards require it — electronics (IPC), healthcare (UDI), aerospace (ATA)
  • Direct Part Marking — laser etching, dot peening on metal or plastic surfaces
  • Pharmaceutical or medical device complianceGS1 DataMatrix is the mandated format
  • You don't need configurable error correction — Data Matrix's default ~28% is sufficient

Choose Based on Existing Infrastructure

If your scanning systems and supply chain partners already use one format, stick with it. The marginal benefits of switching rarely justify the cost of new scanners, updated software, and retraining.

Generating Barcodes

Create barcodes in either format with our free generators:

Both generators produce print-ready barcodes downloadable as SVG, PNG, or PDF. For more on format selection and output options, see our free barcode generator guide.

9 min read

Frequently Asked Questions

Which is smaller, QR code or Data Matrix?
Data Matrix is smaller. For the same amount of data, a Data Matrix barcode takes up roughly 60-70% of the space of a QR code because it doesn't need the large finder patterns that QR codes require. Data Matrix can be reliably printed as small as 2mm × 2mm, while QR codes need at least 10mm × 10mm for reliable phone scanning.
Can phones scan Data Matrix codes?
Yes, but not as easily as QR codes. Most modern phones (iPhone with iOS 11+, Android 9+) scan QR codes automatically with the built-in camera app. Data Matrix scanning typically requires Google Lens (Android) or a dedicated scanner app. Web-based scanners like barcodescanner.online read both formats from camera input or uploaded images.
Is Data Matrix more reliable than QR code?
Both use Reed-Solomon error correction. Data Matrix supports up to 28% error recovery by default (ECC 200 standard). QR codes support up to 30% at the highest level (Level H), but most implementations use Level M (15%) or Level L (7%). For equivalent error correction settings, reliability is comparable.
When should I use QR code vs Data Matrix?
Use QR codes when consumers will scan with phone cameras — marketing, payments, WiFi sharing, restaurant menus. Use Data Matrix when space is tight, machines do the scanning, or industrial standards require it — electronics marking, healthcare, aerospace, pharmaceutical packaging.
Can I switch from QR code to Data Matrix or vice versa?
Technically yes — both encode the same types of data. But the switch depends on your scanning infrastructure. If consumers scan with phone cameras, switching to Data Matrix creates friction. If industrial scanners do the reading, either format works. The practical switching cost is in updating scanners and printed materials.