The short answer
A GS1 DataMatrix is a Data Matrix ECC 200 code that starts with a special FNC1 character and stores product data as GS1 Application Identifier fields, such as (01) GTIN, (17) expiry date, (10) batch or lot and (21) serial number. Variable-length fields are followed by a group separator unless they are last. The brackets you see in the printed text are not encoded.
Every code, table and byte on this page is generated by the same engine as our GS1 DataMatrix generator, and each example is decoded by an independent reader in our tests. Field formats come from the GS1 Barcode Syntax Dictionary (release 2026-01-27). The rules come from the GS1 General Specifications (Release 26.0, January 2026) and the GS1 DataMatrix Guideline (Release 2.5.1), checked November 2026.
Plain Data Matrix vs GS1 DataMatrix
The squares are the same. Both use Data Matrix ECC 200 from ISO/IEC 16022, with the same sizes and the same error correction. The difference is in the data and the rules around it.
| Feature | Plain Data Matrix | GS1 DataMatrix |
|---|---|---|
| First character | Your data | FNC1 (codeword 232) |
| Content | Any text: a part number, a URL, a serial | GS1 fields only: AI + value, AI + value… |
| Who defines the meaning | You and the system that reads it | GS1, worldwide |
| Scanner prefix | ]d1 | ]d2 |
| Needs a GS1 number | No | Yes for a GTIN, (01) |
| Typical use | Parts, assets, internal tracking | Medicines, medical devices, retail food |
So a plain code that happens to contain 0109506000134352 is not a GS1 DataMatrix. Without the leading FNC1, a scanner has no
way to know the first two digits are an Application Identifier. If you only need your own part or asset numbers, use the
plain generator.
Anatomy of a GS1 element string
An element string is one Application Identifier (AI: a 2 to 4 digit number that says what the next value is) followed by its value. A GS1 DataMatrix chains several element strings after one FNC1. Here is a real medicine-pack code, taken apart.
- Printed under the code (human readable text)
- (01)09506000134352 (17)280531 (10)A1B2C3 (21)4K7P9X2M5Q
- Encoded in the symbol
- Start character FNC1
- AI 01
- value 09506000134352
- AI 17
- value 280531
- AI 10
- value A1B2C3
- Separator, FNC1 GS
- AI 21
- value 4K7P9X2M5Q
- What a scanner sends
- Symbology identifier ]d2
- AI 01
- value 09506000134352
- AI 17
- value 280531
- AI 10
- value A1B2C3
- Group separator, ASCII 29 <GS>
- AI 21
- value 4K7P9X2M5Q
- The same, as bytes (hex)
-
5D 64 3230313039353036303030313334333532313732383035333131304131423243331D3231344B37503958324D3551
- Finder pattern. The solid L on the left and bottom edges tells a scanner where the code is and which way up it is.
- Clock track. Alternating squares on the top and right edges give the grid size.
- Data area. Your data plus Reed-Solomon error correction. This one is 22 × 22 and uses 30 of its 30 data codewords.
- Quiet zone. Blank margin, at least 1 module wide on all four sides (we default to 2).
Reading it from left to right:
- FNC1 first: this is a GS1 code. A scanner turns it into the prefix
]d2(bytes5D 64 32). - (01) + 14 digits: the GTIN, the product number. Its length is predefined, so no separator follows.
- (17) + 6 digits: expiry date as YYMMDD.
280531means 31 May 2028. Also predefined, no separator. - (10) + up to 20 characters: the batch. It can be any length, so a GS separator (encoded as FNC1, sent as
ASCII 29, hex
1D) marks where it ends. - (21) + up to 20 characters: the serial number. It is the last field, so it needs no separator.
The printed text under the code (the human readable interpretation, or HRI) puts each AI in brackets so a person can key it in if the scan fails. The brackets help people only. They are never encoded, and FNC1 never appears in the printed text.
Field order: fixed lengths first
GS1 gives field order no meaning, but order changes the size. The same four fields with the batch and serial before the expiry date need 2 separators instead of 1. Here that pushes the code from 22 × 22 up to 24 × 24 modules (30 vs 31 data codewords). The GS1 DataMatrix Guideline recommends putting a single variable-length field at the end for exactly this reason. Moving fields never changes what the data says, so put predefined-length fields (GTIN, dates, weights) first.
Fixed length is not the same as predefined length
Only AIs that start with 00, 01, 02, 03, (04), 11, 12, 13, (14), 15, 16, 17, (18), (19), 20, 31, 32, 33, 34, 35, 36 or 41 have a predefined length and can skip the separator. GS1 fixed that list (Table 7-6 in the GS1 General Specifications) when AIs were first introduced and will not change it, so decoders never need updating. No AIs use 04, 14, 18 and 19 yet (the ones in brackets); GS1 keeps them for future predefined-length AIs, so a decoder should include them too. Every other field needs a separator when another field follows, even if its length never varies. For example, (422) country of origin is always 3 digits and still needs one.
Application Identifiers you will meet most
GS1 defines 541 AIs (counting each number in a range). These are the ones most labels use. In the format column, N means digits, X means letters, digits and some punctuation, and .. means “up to”: N14 is exactly 14 digits, X..20 is up to 20 characters.
| AI | Meaning | Format | Separator | Example value |
|---|---|---|---|---|
| (01) | Product number (GTIN) | N14 14 digits with check digit | No | 09506000134352 |
| (02) | GTIN of the items inside | N14 14 digits with check digit | No | 09506000134352 |
| (00) | Serial shipping container code (SSCC) | N18 18 digits with check digit | No | 095060001343520000 |
| (10) | Batch or lot number | X..20 up to 20 characters | Yes | A1B2C3 |
| (21) | Serial number | X..20 up to 20 characters | Yes | 4K7P9X2M5Q |
| (11) | Production date | N6 date YYMMDD (day 00 allowed) | No | 260915 |
| (13) | Packaging date | N6 date YYMMDD (day 00 allowed) | No | 261016 |
| (15) | Best before date | N6 date YYMMDD (day 00 allowed) | No | 270630 |
| (16) | Sell by date | N6 date YYMMDD (day 00 allowed) | No | 270531 |
| (17) | Expiry date | N6 date YYMMDD (day 00 allowed) | No | 280531 |
| (7003) | Expiry date and time | N6+N4 date YYMMDD + time HHMM | Yes | 2805312359 |
| (30) | Variable count of items | N..8 up to 8 digits | Yes | 24 |
| (37) | Count of trade items inside | N..8 up to 8 digits | Yes | 48 |
| (310n) | Net weight (kg); n = decimal places, 0 to 5 | N6 6 digits | No | 001250 |
| (400) | Customer purchase order number | X..30 up to 30 characters | Yes | PO-77812 |
| (410) | Ship to (GLN) | N13 13 digits with check digit | No | 9506000134369 |
| (414) | Physical location (GLN) | N13 13 digits with check digit | No | 9506000134369 |
| (422) | Country of origin | N3 3-digit ISO country code | Yes | 840 |
| (8004) | Individual asset ID (GIAI) | X..30 up to 30 characters | Yes | 9506000134ASSET042 |
| (712) | National healthcare number: Spain (CN) | X..20 up to 20 characters | Yes | 654321 |
| (715) | National healthcare number: USA (NDC) | X..20 up to 20 characters | Yes | 0123456789 |
Download all 541 AIs (CSV) with format, length, separator rule and the fields each one needs or excludes. Generated from engine v2.0.1. Free to share; please link back to this page.
Dates are YYMMDD. Day 00 means the last day of that month, in every date field that allows it (for example production 11,
best before 15 and expiry 17), but not on regulated healthcare products: since 1 January 2025 GS1 requires the real day there. Some AIs also need a
partner: a batch (10) or expiry (17) means nothing without the GTIN (01) of the item, so a validator should reject them alone. Weights put the
number of decimals in the last AI digit: (3103) 001250 is 1.250 kg.
Three real-format examples
Each example below is generated by our engine and decoded by an independent reader. The GTINs use GS1's example company prefix, so they belong to no real product. Scan them with your phone or paste a screenshot into the reader to see the same fields.
Example 1
Medicine pack
The four fields EU and US medicine pack rules ask for: product code, expiry, batch and a serial number.
Printed text
(01)09506000134352(17)280531(10)A1B2C3(21)4K7P9X2M5Q
Encoded
- Start character FNC1
- AI 01
- value 09506000134352
- AI 17
- value 280531
- AI 10
- value A1B2C3
- Separator, FNC1 GS
- AI 21
- value 4K7P9X2M5Q
| AI | Field | Value |
|---|---|---|
| (01) | Product number (GTIN) N14 | 09506000134352 |
| (17) | Expiry date N6 | 280531
= 31 May 2028 |
| (10) | Batch or lot number X..20 | A1B2C3 |
| (21) | Serial number X..20 | 4K7P9X2M5Q |
Example 2
Medical device label
A UDI-style label: the GTIN identifies the device model, the dates, lot and serial identify this unit.
Printed text
(01)09506000134376(11)260915(17)310914(10)LOT2609(21)00042
Encoded
- Start character FNC1
- AI 01
- value 09506000134376
- AI 11
- value 260915
- AI 17
- value 310914
- AI 10
- value LOT2609
- Separator, FNC1 GS
- AI 21
- value 00042
| AI | Field | Value |
|---|---|---|
| (01) | Product number (GTIN) N14 | 09506000134376 |
| (11) | Production date N6 | 260915
= 15 Sep 2026 |
| (17) | Expiry date N6 | 310914
= 14 Sep 2031 |
| (10) | Batch or lot number X..20 | LOT2609 |
| (21) | Serial number X..20 | 00042 |
Example 3
Fresh food pack
A pack of cheese sold by weight: GTIN, net weight, best before date and batch. No separators at all.
Printed text
(01)09506000134383(3103)001250(15)261120(10)B2611
Encoded
- Start character FNC1
- AI 01
- value 09506000134383
- AI 3103
- value 001250
- AI 15
- value 261120
- AI 10
- value B2611
| AI | Field | Value |
|---|---|---|
| (01) | Product number (GTIN) N14 | 09506000134383 |
| (3103) | Net weight (kg), 3 decimal places N6 | 001250
= 1.250 kg |
| (15) | Best before date N6 | 261120
= 20 Nov 2026 |
| (10) | Batch or lot number X..20 | B2611 |
Example 3 has no separators at all: GTIN, weight and date are predefined lengths, and the one variable field, the batch, is last. That is the ordering advice from above in practice.
Where GS1 DataMatrix is required
These are the best-known uses. The rules belong to regulators and trading partners, and they change. Always check the current text that applies to you; our tools check GS1 syntax, not legal compliance.
- Medicines in the EU. The Falsified Medicines Directive safety rules (Delegated Regulation (EU) 2016/161) require a Data Matrix on most prescription medicine packs with the product code, serial number, batch and expiry, plus a national reimbursement number in some countries. GS1 DataMatrix is the usual way to meet it.
- Medicines in the US. The Drug Supply Chain Security Act asks for a product identifier (product code, serial number, lot and expiry) in a 2D Data Matrix on each package. That is the four-field layout of example 1.
- Medical devices. The FDA's Unique Device Identification (UDI) rule needs a device identifier plus production identifiers in plain text and machine-readable form. GS1 is one of three FDA-accredited issuing agencies, with HIBCC and ICCBBA.
- Retail. Under GS1 US Sunrise 2027, checkout scanners should read 2D codes by the end of 2027. A 2D code can carry the batch, weight and best-before date that a UPC cannot, as in example 3. UPC barcodes stay.
GS1 Digital Link is a different format
https://id.gs1.org/01/09506000134352/10/A1B2C3, usually in a QR
code. It is plain text with no FNC1, so it is not an element string. Our GS1 generator refuses Digital Link URLs on purpose; encode them as plain
text in the generator if a partner asks for one.
Print quality is graded separately, with an ISO/IEC 15415 verifier. The GS1 DataMatrix Guideline's tables set a minimum grade of 1.5 (C) for most applications. A phone or our reader decoding a code is a good sign, but it is not a verification grade.
Make or check one
- Make one: the GS1 DataMatrix generator has a guided form for GTIN, dates, batch, serial and more. It computes check digits, adds FNC1 and separators, and shows the printed text apart from the encoded data. It says “Supported GS1 fields passed syntax checks”. It does not prove you own the GTIN or that a partner will accept the label.
- Check one: decode a GS1 DataMatrix from a photo or your camera. The reader names each field and shows the separators. Nothing is uploaded.
- Many at once: the bulk generator takes a spreadsheet of values, one code per row.