How to scan a Data Matrix code

Phone, USB scanner or browser, plus a checklist for codes that refuse to read.

Updated 8 min read By the Data Matrix Code Generator team

On this page 8 sections
  1. Short answer
  2. Scan with your phone
  3. USB or handheld scanner
  4. Scan online from a photo
  5. Won't scan? Checklist
  6. Test your scanner
  7. Size vs printer dots
  8. FAQ

The short answer

To scan a Data Matrix code you need a 2D reader: a phone scanner app or camera that supports Data Matrix, a 2D imaging barcode scanner, or an online reader like ours that decodes a photo. Standard 1D laser scanners cannot read it. If a code won't scan, check its size, the blank border around it, contrast, glare and whether the scanner has Data Matrix enabled.

Phones and scanners differ. Where this guide says what a device can read, it names the source, and the test codes let you check your own phone or scanner in a minute.

Scan with your phone

iPhone and iPad

Apple's help page for the Camera app and the Code Scanner in Control Center (checked November 2026) talks about QR codes only and does not list Data Matrix. So do not count on the built-in camera: if nothing pops up when you point it at a Data Matrix, that is expected, not a fault in the code.

Scanner apps are the reliable route. Apple's developer frameworks include Data Matrix as a supported code type, so many App Store scanner apps read it. Pick one whose description names Data Matrix, and if you need GS1 fields split out, one that mentions GS1.

Android

In November 2025 GS1 and Google announced that Google Lens on Android reads GS1 DataMatrix codes on medicine packs and shows product information from the manufacturer, with iOS support to follow. Google does not document general Data Matrix support in Lens or in each phone's camera app, so results vary by phone and by what the code holds. Many scanner apps use Google's ML Kit, which lists Data Matrix among its supported formats.

Tips for any phone

  • Fill a good part of the screen with the code. If it is tiny, move back a little and zoom rather than pushing the lens up to it: phones cannot focus very close.
  • Tilt slightly to move reflections off glossy labels or screens.
  • Give it light. Turn on the torch for dark shelves, but tilt to avoid its reflection.
  • Hold still for a second. Dense codes with many small squares need a sharp image.

Scan with a USB or handheld scanner

Barcode scanners come in two kinds. Laser scanners sweep a red line and read 1D barcodes such as UPC, not Data Matrix. 2D imagers take a picture and read both 1D and 2D codes. For Data Matrix you need an imager: look for “2D” or “Data Matrix” on the spec sheet.

  • Turn on the code types you need. Data Matrix is usually on by default, but inverted (light-on-dark) codes and DMRE rectangles are often off. The scanner's manual has setup barcodes to enable them.
  • Keyboard mode types the result into whatever field has focus, like a keyboard. If symbols come out wrong (for example @ or -), set the scanner's keyboard language to match the computer's.
  • GS1 codes contain an invisible separator (ASCII 29) between some fields. Many scanners have a setting for how to send it, and one to send the symbology identifier ]d2 that tells software the code is GS1. The GS1 DataMatrix guide shows what the output should look like.
  • Codes etched or dot-peened into metal (direct part marking) are low contrast and often shiny. They usually need an industrial DPM reader with special lighting; office scanners and phones often fail on them.

Scan online from a photo

Our Data Matrix reader online decodes a code from a photo, a screenshot, a pasted image or your camera. It runs in your browser with the open-source zxing-cpp decoder, so the image never leaves your device. It shows the decoded text, GS1 fields by name, the bytes in hex (handy when a scanner shows odd characters) and the symbol size.

  1. Take a sharp photo, square on, with the whole code and a little blank space around it in the frame.
  2. Open the reader and drop, paste or choose the image, or tap the camera button.
  3. Compare the result with what you expected. If the reader decodes it and your scanner does not, the scanner needs a setting changed.

Data Matrix won't scan? Checklist

One question splits almost every case in two: is the problem the code, or the thing reading it? Answer it first, then work down the matching list.

Start here: take a sharp, well-lit photo of the code and open it in our Data Matrix reader. Does it decode?

Yes The code is fine. Check the scanner.

  1. Is it a 1D laser scanner? Laser scanners read lines, not squares. You need a 2D imager, a phone app or our reader.
  2. Is Data Matrix turned on? Some scanners ship with it off. Scan the “enable Data Matrix” setup code in the manual.
  3. Is the code light on dark? Turn on inverted (reverse) reading, or print dark squares on a light background.
  4. Is it a DMRE rectangle? Sizes such as 8 × 64 need ISO/IEC 21471 (DMRE) support. Enable it, or use a standard size.
  5. It reads, but the text is wrong? Match the scanner’s keyboard language to the computer’s, and set how it sends the GS1 separator (ASCII 29), which some programs drop.

No The printed code is the problem.

  1. Is there blank space all round? Keep at least 1 module (one square) of quiet zone on every side; 2 or more is safer. No borders or text touching it.
  2. Is it big enough for the printer? Each square should be at least 2 printer dots. See the printer dot table below.
  3. Is the contrast high? Black on white is best. Avoid red or pale inks, transparent backgrounds and patterned stock.
  4. Glare, curve or shine? Tilt the scanner or phone slightly off straight, use matte labels, and keep codes off tight curves.
  5. Blurred, stretched or damaged? Squares must stay square: print at 100%, never “fit to page”. Clean the print head and reprint.

Quiet zone and print size cause most print failures. The quiet zone and print size guide covers both in detail.

Test your phone or scanner with these codes

Each code below is real and was decoded by an independent reader in our tests. Scan them from the screen at 100% zoom (a laser scanner cannot read screens at all), or print this page. Start with code 1: if that one fails, nothing else will work until the reader supports Data Matrix.

  • 1. Plain square

    16 × 16

    Should read: TEST-01 SQUARE

    Nothing reads at all: the app or scanner has Data Matrix turned off, or it is a 1D-only scanner.

  • 2. Rectangle

    8 × 32

    Should read: TEST-02 RECT

    Some older scanners skip rectangular sizes. Use a square code, or update the scanner.

  • 3. DMRE rectangle (8 × 64)

    8 × 64 · DMRE

    Should read: TEST-03 DMRE

    The scanner does not support the newer DMRE sizes (ISO/IEC 21471). Stay with standard sizes.

  • 4. Inverted (light on dark)

    18 × 18

    Should read: TEST-04 INVERTED

    Reverse (inverted) reading is off. Turn it on in the scanner settings, or print dark on light.

  • 5. GS1 DataMatrix

    20 × 20 · GS1

    Should read: 010950600013435210TEST-05<GS>210042

    The <GS> is one invisible character (ASCII 29); it may show as a box, a space or nothing. Some scanners also add ]d2 in front.

    If it reads but the fields run together, the scanner drops the group separator. See the GS1 tip in the scanner section.

  • 6. Dense (100+ characters)

    36 × 36

    Should read: TEST-06 DENSE: The quick brown fox …

    The camera cannot resolve the small squares. Zoom the page, hold steady in good light, or print codes larger.

For a printed version, download the scanner test sheet (US Letter PDF or A4 PDF) from our scanner test sheet page. It prints a set of codes at several sizes, and the page lists the expected text for each.

Size vs printer dots

A printer draws each square from whole dots. One dot per square prints unevenly, so aim for at least 2. This table shows the square (module) size each printer resolution gives, and how wide two common codes come out with a 2-module quiet zone on each side. A 16 × 16 code holds up to 16 capital letters and digits (a short part number); a 24 × 24 holds up to 52.

Module size by printer resolution, calculated by our sizing engine. Widths include a 2-module quiet zone on each side.
Printer Dots per square Square size 16 × 16 code 24 × 24 code
203 dpi 2 0.250 mm 9.9 mils 5.0 mm 0.20 in 7.0 mm 0.28 in
203 dpi 3 0.375 mm 14.8 mils 7.5 mm 0.30 in 10.5 mm 0.41 in
203 dpi 4 0.500 mm 19.7 mils 10.0 mm 0.39 in 14.0 mm 0.55 in
300 dpi 2 0.169 mm 6.7 mils 3.4 mm 0.13 in 4.7 mm 0.19 in
300 dpi 3 0.254 mm 10.0 mils 5.1 mm 0.20 in 7.1 mm 0.28 in
300 dpi 4 0.339 mm 13.3 mils 6.8 mm 0.27 in 9.5 mm 0.37 in
600 dpi 2 0.085 mm 3.3 mils 1.7 mm 0.07 in 2.4 mm 0.09 in
600 dpi 3 0.127 mm 5.0 mils 2.5 mm 0.10 in 3.6 mm 0.14 in
600 dpi 4 0.169 mm 6.7 mils 3.4 mm 0.13 in 4.7 mm 0.19 in

There is no universal minimum size. How small a phone or scanner can read depends on its camera, the distance and the light, so test a printed sample before a batch. Our labels tool snaps squares to whole dots for your printer's resolution and warns below 2 dots.

“Data decoded successfully” is not a grade

When our tools or a phone read a code, that shows the data is right and the image is readable. It does not grade print quality. Supply chains that require a grade (GS1 healthcare, for example) use an ISO/IEC 15415 verifier on the printed label.

Frequently asked questions

Can you scan a data matrix code?
Yes, with any reader that handles 2D codes: a scanner app on a phone, a 2D imaging barcode scanner, or an online reader such as our Data Matrix reader, which decodes a photo in your browser. A 1D laser scanner, the kind that sweeps a red line, cannot read it.
How to scan a Data Matrix?
Open a scanner app that lists Data Matrix (or our reader’s camera mode), hold the phone so the code fills a good part of the screen, keep it flat and out of glare, and wait a second for focus. With a USB scanner, click into the field that should receive the text and pull the trigger: the scanner types the result like a keyboard.
Is there an app that can read Data Matrix codes?
Yes. Many free barcode scanner apps for iPhone and Android read Data Matrix; check that the app’s description lists it. Apple’s and Google’s developer toolkits both support Data Matrix, so most modern scanner apps can. If you would rather not install anything, our reader works in the phone’s browser and nothing is uploaded.
How can I decode data matrix code?
Take a clear photo or screenshot and open it in our Data Matrix reader. It shows the decoded text, splits GS1 data into named fields (GTIN, expiry, batch, serial), shows the raw bytes and the symbol size, and runs entirely in your browser. For GS1 codes, the GS1 DataMatrix guide explains each field.
Why won’t my Data Matrix scan?
First find out whether the code or the scanner is at fault: if our reader decodes a photo of it, the scanner needs a setting changed (Data Matrix, inverted or DMRE support turned on, or a 2D imager instead of a laser). If the reader also fails, the print is the problem: too little blank space around it, squares smaller than 2 printer dots, low contrast, glare, or a stretched or smudged print. The checklist walks through each one.