Data Matrix Barcode Scanner and Decoder SDK

Data Matrix is a square or rectangular 2D barcode that packs text, numbers or GS1 product data into a small grid of black and white modules. barKoder reads printed, damaged and direct-marked Data Matrix codes with the phone and tablet cameras in your iOS, Android and web apps.

Data Matrix

Data Matrix at a glance

Data Matrix (ECC 200) key facts
Type2D matrix symbology. ECC 200 is the version in use today.
Character set and dataNumeric, alphanumeric and bytes (ISO/IEC 8859-1 by default, other character sets through ECI). GS1 data through a leading FNC1.
CapacityUp to 3,116 digits, 2,335 alphanumeric characters or 1,555 bytes in a 144 x 144 symbol
Sizes24 square sizes from 10 x 10 to 144 x 144 modules. 6 rectangular sizes from 8 x 18 to 16 x 48. The DMRE extension (ISO/IEC 21471) adds rectangular sizes from 8 x 48 to 26 x 64. barKoder reads square, rectangular and DMRE symbols.
Error correctionReed-Solomon (ECC 200)
StandardISO/IEC 16022 (current edition 2024). GS1 DataMatrix is defined in the GS1 General Specifications.

What a Data Matrix code is and how it is built

A Data Matrix code stores data in a grid of square cells called modules. A dark module and a light module each stand for one bit. Because the data runs in both directions, a Data Matrix holds far more than a 1D barcode in the same space, which is why it fits on small parts, vials and medicine packs.

Every symbol has four parts:

  • Finder pattern: a solid L-shaped border on two adjacent sides. The scanner uses it to find the code and work out its orientation.
  • Clock track: alternating dark and light modules on the two opposite sides. It tells the decoder how many rows and columns the symbol has and how big each module is.
  • Data region: the modules inside the border that carry the encoded data and the Reed-Solomon error correction codewords. Larger symbols split it into several regions separated by alignment patterns.
  • Quiet zone: a blank margin at least one module wide on all four sides that separates the code from the rest of the label.

The error correction lets a reader rebuild data from a symbol that is scratched, partly covered or badly printed. barKoder goes further with MatrixSight®, which reads codes with a missing finder pattern or clock track.

Sample Data Matrix 2D barcode
The solid L-shaped finder pattern is on the left and bottom edges. The clock track runs along the top and right.

Data Matrix variants

Most Data Matrix codes you scan today are ECC 200. What changes is the shape, the data format and how the code is marked.

Data Matrix variants and what they mean for scanning
VariantWhat it isScanning notes
ECC 200The current version, with Reed-Solomon error correction. Used for all new applications.The default for printed labels, GS1 and DPM codes
ECC 000-140The original versions, with an older error correction scheme. Removed from ISO/IEC 16022:2024 and not allowed for GS1 data.Found only in older closed systems
Square and rectangularSquare symbols from 10 x 10 to 144 x 144 modules. Rectangular symbols from 8 x 18 to 16 x 48 fit narrow spaces such as cable labels, vials and the edge of a box.Same decoder, same settings
DMREData Matrix Rectangular Extension, defined in ISO/IEC 21471. Adds longer rectangles from 8 x 48 to 26 x 64 modules, ECC 200 only. barKoder reads DMRE codes.Used where a long, narrow code fits better than a square one
GS1 DataMatrixECC 200 with FNC1 in the first position and GS1 Application Identifiers, such as (01) GTIN, (10) batch or lot, (17) expiration date and (21) serial numberParse the AIs into fields with the GS1 parser
DPM Data MatrixMarked directly on the part by laser etching, dot peening or chemical etching, on metal such as steel, aluminum or copper, plastic, glass or siliconLow contrast, glare and separate dots. Turn on DPM mode

Where Data Matrix codes are used

Data Matrix is the code of choice where space is tight and every item needs its own identity.

Healthcare and pharmaceuticals

EU FMD, US DSCSA

The EU Falsified Medicines Directive requires the unique identifier on prescription medicine packs to be encoded in a Data Matrix (ECC 200) code. In the US, the DSCSA requires the NDC, serial number, lot and expiry in a 2D Data Matrix barcode on each package. Hospitals also use Data Matrix on surgical tools and patient wristbands.

Barcode scanning for healthcare →

Manufacturing and electronics

ISO/IEC 16022, IPC-1782, MIL-STD-130

Factories mark parts, PCB assemblies and components with Data Matrix codes for work-in-progress tracking, quality records and component-level traceability. Aerospace and defense parts are marked and graded to SAE AS9132 and MIL-STD-130.

Barcode scanning for manufacturing →

Automotive

Direct part marking, anti-counterfeiting

Automakers mark engine and safety components with permanent Data Matrix codes so each part can be traced through the supply chain and genuine parts can be told apart from counterfeits. Parts warehouses and repair shops scan Data Matrix codes on packaging too.

Barcode scanning for automotive →

Warehousing and labs

Pharma logistics, specimen tubes

Pharmaceutical logistics track medicine packs, bundles and cases by their Data Matrix codes from manufacturer to wholesaler to pharmacy. Labs label tubes, vials and specimen cassettes with Data Matrix codes and register many samples at once with Batch MultiScan.

Barcode scanning for warehousing →

Scanning Data Matrix with barKoder

The barKoder Barcode Scanner SDK reads Data Matrix on iOS, Android, the web, Windows and Linux, and in Flutter, React Native, .NET MAUI, Capacitor, Cordova and NativeScript apps. These features matter most for this code.

DPM mode for marked parts

A decoder setting and a predefined template for laser-etched and dot-peened Data Matrix codes. It connects separate dots into a readable grid, boosts local contrast on dark plastic and machined metal, and tolerates the distortion of curved parts.

DPM Barcode Scanner SDK →

MatrixSight® for damaged codes

MatrixSight reads Data Matrix codes with a missing finder pattern or missing clock tracks. It tolerates up to three missing rows or columns on any side of a symbol larger than 48 modules, and up to two on smaller ones.

MatrixSight® algorithm →

GS1 parser for GS1 DataMatrix

Turns the raw GS1 DataMatrix string into labeled fields such as GTIN, batch, expiry and serial number. It handles fixed- and variable-length Application Identifiers and follows the GS1 General Specifications.

GS1 Barcode Parser →

Batch MultiScan for many codes at once

Decodes several barcodes in a single camera view, whatever their type or size. Use it to register several Data Matrix-labeled tubes, vials or medicine packs in one pass.

Batch MultiScan →

Data Matrix barcode reader API

Enable only the decoders you need. This Web SDK example from the barKoder docs enables Data Matrix and turns on DPM mode.

Web SDK (JavaScript)

JavaScript
Barkoder.setEnabledDecoders(Barkoder.constants.Decoders.Datamatrix);

Barkoder.setDatamatrixDpmModeEnabled(true);
Barkoder.setRegionOfInterest(35, 40, 30, 14);
Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Slow);
Barkoder.setCameraResolution(Barkoder.constants.CameraResolution.FHD);

For printed labels, the first line is enough. The other lines are the docs' recommended settings for direct part marks: DPM mode, a small region of interest, slow decoding and Full HD resolution.

Get scanning in three steps

  1. Get a free trial license and install the SDK for your platform.
  2. Enable the Data Matrix decoder. Add DPM mode if you scan marked parts.
  3. Read the result in your callback, and pass GS1 DataMatrix strings to the GS1 parser.
See the Web SDK example

DPM mode examples for other platforms: Android, iOS, Flutter, React Native, Capacitor, Cordova, .NET MAUI and NativeScript.

Scan a Data Matrix code on your phone or in your browser

Install the free barKoder demo app, or open the web demo, and scan your own Data Matrix labels and parts before you integrate the SDK. The demo app includes a DPM scanning template.

iPhone and iPad

barKoder demo app for iOS

Scan with your camera, or point it at the QR code to open the App Store.

Download on the App Store
QR code linking to the barKoder demo app on the App Store

Android phones and tablets

barKoder demo app for Android

Scan with your camera, or point it at the QR code to open Google Play.

Get it on Google Play
QR code linking to the barKoder demo app on Google Play

Any modern browser

barKoder web demo

Runs the Web SDK in your browser, on desktop or mobile, with nothing to install.

Open the web demo
QR code linking to the barKoder web demo

Test with known samples. Print or display the testing sheet and scan each 1D and 2D barcode with the demo app. The data sheet summarizes the SDK for your team.

Data Matrix scanner questions

What is the difference between Data Matrix and QR Code?

Both are 2D matrix codes. Data Matrix is located by a solid L-shaped border and a clock track on the opposite two sides, while QR Code uses three square finder patterns in its corners. Data Matrix can be printed smaller and in rectangular shapes, so it is the usual choice for small parts, medicine packs and direct part marking. QR Code holds more data (up to about 4,296 alphanumeric characters against 2,335) and is the usual choice for consumer-facing codes. barKoder reads both, and its MatrixSight® algorithm handles damaged codes of either type.

Can a phone camera read Data Matrix codes engraved or dot-peened on metal?

Yes, with a decoder built for it. Stock camera apps often fail on direct part marks because of low contrast, glare and separate dots instead of solid modules. With barKoder's DPM mode turned on, ordinary iOS and Android phones and Android-based industrial mobile computers read laser-etched and dot-peened Data Matrix codes on metal, plastic and glass. Test your own parts in the free demo app, which includes a DPM scanning template.

What is GS1 DataMatrix?

GS1 DataMatrix is a Data Matrix (ECC 200) symbol that starts with the FNC1 character and carries GS1 Application Identifiers, such as (01) GTIN, (10) batch or lot, (17) expiration date and (21) serial number. It is the code required on prescription medicine packs in the EU and in the US. The barKoder GS1 parser splits the scanned string into labeled fields, so your app gets the GTIN, batch, expiry and serial number without manual parsing.

How much data can a Data Matrix code hold?

The largest square symbol, 144 x 144 modules, holds up to 3,116 digits, 2,335 alphanumeric characters or 1,555 bytes. Most labels need far less, so the symbol grows in fixed steps from 10 x 10 modules as you add data. For more, the optional structured append feature spreads one message over up to 16 symbols. Data Matrix uses Reed-Solomon error correction, so a symbol can still be decoded when part of it is damaged.

Is there a Data Matrix reader API for web apps?

Yes. The WASM Barcode Scanner SDK decodes Data Matrix in the browser with the device camera. Enable the decoder with Barkoder.setEnabledDecoders(Barkoder.constants.Decoders.Datamatrix); and turn on DPM mode with Barkoder.setDatamatrixDpmModeEnabled(true); when you scan direct-marked parts. See the Web SDK DPM mode example.

What is the best mobile SDK for scanning Data Matrix codes?

The one that reads your real codes on your target devices. Shortlist SDKs that handle damaged codes, direct part marks and GS1 parsing, then test them on your own samples. barKoder covers all three with MatrixSight®, DPM mode and the GS1 parser, and runs on iOS, Android, the web and cross-platform frameworks such as Flutter, React Native and .NET MAUI. The free trial runs for 30 days on up to 25 devices, so you can compare results on your own labels and parts.

Add Data Matrix scanning to your app

Test the SDK on your own labels, medicine packs and marked parts with a free 30-day trial, or talk to an SDK expert about your project.