Look closely at a strip of tablets, a syringe, or a box of eye drops and you will often find a tiny square of black-and-white dots, barely the size of a pea. That little square is a GS1 DataMatrix — and packed inside it is a surprising amount of information: exactly which product it is, when it expires, which batch it came from, and a unique serial number that belongs to that one pack alone. It is one of the most important barcodes in the modern world, yet almost nobody knows how it works. This guide fixes that. We will start from zero, use plenty of simple illustrations, and by the end you will understand GS1 DataMatrix better than most professionals.
What Is a GS1 DataMatrix, in Plain English?
A DataMatrix is a type of 2D (two-dimensional) barcode — a grid of small black and white squares called modules. Unlike the striped barcode on a soda can, which stores data only in the width of its bars, a DataMatrix stores data in two directions, up-and-down as well as left-and-right. That is why it can hold far more information in a much smaller space.
The word "GS1" in front simply means the data inside follows the global GS1 standard — the same rulebook that governs the everyday retail barcode (the GTIN). A GS1 DataMatrix does not just store a random string; it stores clearly labelled pieces of data (product number, expiry date, batch, serial) in a way that any compliant scanner, anywhere in the world, can read and understand. New to GS1? Start with our GS1 Compliance guide.
Figure 1 — Old 1D barcode vs. GS1 DataMatrix (2D)
8 9 0 1 2 3 4 5 6 7 8 9 0
1D Barcode (EAN-13)
Stores ~13 digits. Data only across the width. One thing: the product number.
2D GS1 DataMatrix
Stores 50+ characters in a tiny square. Data in two directions. Four things at once: product + expiry + batch + serial.
Why Does the World Need It? The Problem It Solves
A normal retail barcode answers only one question: "What product is this?" But safety-critical industries need to answer four questions at once, right there on a tiny label:
What is it?
GTIN
Until when?
Expiry date
Which run?
Batch / lot
Which pack?
Serial number
Answering all four is what enables precise recalls (pull only the affected batch, not the whole product), anti-counterfeiting (every pack has a unique serial that can be verified), and expiry management at the pharmacy counter. A single GS1 DataMatrix carries all four — and still fits on the flap of a small medicine carton.
The Anatomy of a DataMatrix (What Those Dots Actually Are)
A DataMatrix is not a random sprinkle of dots. It has a clever, fixed structure that lets a scanner read it even if it is rotated, poorly lit, or slightly damaged. There are three parts:
Figure 2 — The three building blocks of a DataMatrix
- Finder pattern — the two solid black edges forming an "L". This is how a scanner instantly locates the symbol and works out its orientation, so it reads correctly whether the pack is upside down or sideways.
- Timing pattern — the alternating dots along the opposite two edges. These act like a ruler, telling the scanner how many rows and columns the grid has.
- Data region — everything in the middle. This holds your actual data plus built-in error correction (called Reed-Solomon), which is the magic that lets a DataMatrix still be read even if up to ~30% of it is scratched, smudged, or torn.
What Makes It "GS1"? Application Identifiers Explained
Here is the single most important idea in this whole guide. Inside a GS1 DataMatrix, every piece of data is introduced by a short numeric prefix called an Application Identifier (AI). The AI is like a labelled envelope: it tells the scanner "the next few characters are a GTIN" or "the next six characters are an expiry date". This is why any GS1 scanner in the world knows what it is looking at — no guessing required.
Figure 3 — How one GS1 DataMatrix is "unpacked"
(01)08901234567890(17)280610(10)B2606(21)000001
The brackets around the AIs — like (01) — are shown to humans for readability only. They are not actually stored in the barcode. Inside, GS1 uses an invisible marker (FNC1) and separators to do the same job.
Two behind-the-scenes details make this work reliably:
- The FNC1 character — a special hidden symbol placed at the very start. It is the flag that says "this is GS1 data, read it using Application Identifiers." A DataMatrix without this flag is just a plain DataMatrix, not a GS1 DataMatrix.
- The Group Separator (GS) — some fields, like batch and serial, can vary in length. After a variable-length field, an invisible GS character marks "this field ends here" so the scanner knows where the next AI begins. Fixed-length fields like GTIN (always 14 digits) and expiry (always 6 digits) do not need one.
The Most Common GS1 Application Identifiers
You do not need to memorise the hundreds of AIs that exist. In practice, GS1 DataMatrix labels — especially in healthcare — use a small, predictable set. Here are the ones you will meet 95% of the time:
| AI | Meaning | Format | Example |
|---|---|---|---|
| (01) | GTIN (product number) | 14 digits (fixed) | 08901234567890 |
| (17) | Expiry date | YYMMDD (fixed) | 280610 |
| (10) | Batch / lot number | up to 20 chars (variable) | B2606 |
| (21) | Serial number | up to 20 chars (variable) | 000001 |
| (11) | Production date | YYMMDD (fixed) | 260610 |
| (240) | Additional product ID (e.g. NDC, catalog no.) | up to 30 chars (variable) | ABC-123 |
Tip: order matters (a little)
GS1 recommends putting fixed-length AIs (like (01) and (17)) before variable-length ones (like (10) and (21)). This avoids needing extra separator characters and keeps the symbol as small as possible. Learn how these same AIs work in a scannable URL in our GS1 Digital Link guide.
GS1 DataMatrix vs. QR Code vs. GS1-128: Which Do You Need?
This is the question most people actually arrive with. All three can carry GS1 data, but they shine in different places. Here is the honest comparison:
| Feature | GS1 DataMatrix | GS1 QR Code | GS1-128 (1D) |
|---|---|---|---|
| Shape | 2D square | 2D square | 1D stripes |
| Smallest size | Tiniest — great for vials | Small | Long & wide |
| Consumer phone scan | Limited (many camera apps ignore it) | Excellent | No |
| Opens a web page | Not by itself | Yes (Digital Link) | No |
| Best for | Pharma, medical devices, tiny packs | Consumer engagement, retail 2027 | Cases, cartons, logistics |
Rule of thumb
If your priority is regulatory compliance in healthcare on a small pack, use GS1 DataMatrix. If your priority is letting a shopper scan with their phone to see product info, use a GS1 QR Code (Digital Link). Many modern products carry a QR Code on the front for consumers and keep a DataMatrix or GS1-128 for the supply chain. See the full breakdown in QR Code vs Barcode.
Where Is GS1 DataMatrix Legally Required?
DataMatrix is not just a nice-to-have in regulated industries — it is the law in many. Here are the big mandates:
| Regulation / Region | Applies to | What must be encoded |
|---|---|---|
| EU FMD (Falsified Medicines Directive) | Prescription medicines in the EU | GTIN + serial + batch + expiry in a GS1 DataMatrix |
| US DSCSA | Prescription drugs in the USA | Product identifier (GTIN + serial + lot + expiry), 2D DataMatrix |
| FDA UDI / EU MDR | Medical devices | Unique Device Identifier — commonly a GS1 DataMatrix |
| India CDSCO (top-300 drugs) | Specified drug brands in India | QR / DataMatrix with GTIN, batch, expiry, serial |
"Sunrise 2027": DataMatrix Comes to Everyday Retail
For decades the checkout beep came from a 1D barcode. GS1 is now leading a global transition — often called "Sunrise 2027" — where retail point-of-sale systems will be able to scan 2D codes (GS1 DataMatrix and GS1 QR Code) in addition to the classic stripes. The goal is that a single code on a product can serve the checkout, tell the till if the item is expired, and link a shopper to product information — all at once. If you sell physical products, this is the moment to start understanding 2D codes. Our GS1 Compliance guide covers the bigger picture.
How to Create a GS1 DataMatrix (Step by Step)
Get a valid GTIN. This is your GS1-issued product number. Not sure yours is valid? Run it through our free GTIN validator first.
Decide which AIs you need. For pharma that is usually (01) GTIN, (17) expiry, (10) batch, (21) serial. For a device it may be just (01) and (21).
Assemble the data string with fixed-length AIs first, e.g. (01)...(17)...(10)...(21)... A proper generator inserts the FNC1 flag and GS separators for you — do not type the brackets into a plain barcode font.
Generate the symbol as a print-ready vector (SVG/EPS) so it stays crisp at any size. If you need unique serials per pack, generate them in bulk as a CSV — see how in our variable-data printing guide.
Print and verify. Always scan a printed sample before a production run (see quality section below).
Size, Quiet Zone, and Print Quality
A DataMatrix that looks fine to the eye can still fail a scanner. Three things decide whether it reads reliably:
- Module size (X-dimension) — the width of a single cell. Smaller means a smaller symbol, but go too small for your printer and the cells blur together. For thermal/inkjet on cartons, ~0.25–0.5 mm modules are common; check the standard for your industry.
- Quiet zone — a clear, blank margin of at least one module all around the symbol. Crowd the DataMatrix with text or artwork and scanners struggle to find its edges.
- Contrast & ink spread — dark modules on a light background, printed cleanly. Over-inking makes cells merge; under-inking leaves gaps. Both lower the grade.
Verify, do not just eyeball
Professional lines use a barcode verifier that grades print quality against the ISO/IEC 15415 standard (grades A to F). For everyday checks, at minimum scan several printed samples with a real 2D imaging scanner — not just a phone — and confirm every AI decodes correctly.
Common Mistakes to Avoid
- Typing the brackets into the barcode. The (01), (17) brackets are for humans. The barcode needs the FNC1 flag and GS separators instead — use a real GS1 generator, not a plain DataMatrix font.
- Forgetting the FNC1 flag. Without it you have a plain DataMatrix, and GS1 scanners will not interpret your AIs. It will look identical but fail compliance.
- Wrong date format. Expiry (17) and production (11) are strictly YYMMDD. If a day is unknown, GS1 allows "00" for the day — do not invent formats like DDMMYY.
- No quiet zone. The single most common reason a DataMatrix "won't scan" is artwork or text touching its edge.
- Skipping the check digit on the GTIN. An invalid GTIN poisons everything downstream. Confirm it with our check digit calculator.
- Reusing serial numbers. In serialised regimes each (21) must be unique within a GTIN. Learn more in our serialization guide.
Frequently Asked Questions
Is a GS1 DataMatrix the same as a QR code?
No. Both are 2D codes, but they are different symbologies with different patterns. A QR code has three big square "eyes" in its corners; a DataMatrix has a solid "L" finder on two edges and a dotted pattern on the other two. DataMatrix packs into a smaller space, which is why pharma prefers it; QR codes are friendlier for consumer phone scanning and can open a web page directly.
Can my phone scan a GS1 DataMatrix?
Sometimes. Many phone camera apps only recognise QR codes out of the box. A dedicated barcode-scanning app can read DataMatrix, but for reliable, high-speed reading — especially in a warehouse or pharmacy — a purpose-built 2D imaging scanner is the norm.
How much data can a DataMatrix hold?
Up to about 2,335 alphanumeric characters at its largest, but GS1 DataMatrix labels use only a fraction of that — typically 30 to 60 characters for GTIN, expiry, batch and serial. Keeping it short keeps the symbol small and easy to print.
What happens if the code gets scratched?
DataMatrix has built-in Reed-Solomon error correction, so it can usually still be read even with meaningful damage — roughly up to a quarter to a third of the symbol obscured, depending on size. This robustness is a big reason it is trusted on packaging that gets handled roughly.
Do I need to pay GS1 to use DataMatrix?
The DataMatrix symbology itself is a free, open ISO standard. What you need from GS1 is a licensed GTIN (and, for some use cases, a company prefix) so that the product number inside is globally unique. See our GS1 registration cost breakdown.
Generate & Validate GS1 Codes for Free
TrueGTIN gives you free tools to validate your GTIN, calculate check digits, and build print-ready GS1 barcodes with the right Application Identifiers — plus serialized traceability for every pack.